NetBSD Problem Report #57938

From Manuel.Bouyer@lip6.fr  Thu Feb 15 21:19:43 2024
Return-Path: <Manuel.Bouyer@lip6.fr>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 01C4C1A9238
	for <gnats-bugs@gnats.NetBSD.org>; Thu, 15 Feb 2024 21:19:42 +0000 (UTC)
Message-Id: <20240215211927.89D9010373@armandeche.soc.lip6.fr>
Date: Thu, 15 Feb 2024 22:19:27 +0100 (CET)
From: Manuel.Bouyer@lip6.fr
Reply-To: Manuel.Bouyer@lip6.fr
To: gnats-bugs@NetBSD.org
Subject: cad/occt OpenCASCADEFoundationClassesTargets.cmake sets -ldl
X-Send-Pr-Version: 3.95

>Number:         57938
>Category:       pkg
>Synopsis:       cad/occt OpenCASCADEFoundationClassesTargets.cmake sets -ldl
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Feb 15 21:20:00 +0000 2024
>Closed-Date:    Tue Feb 27 16:34:58 +0000 2024
>Last-Modified:  Tue Feb 27 16:35:01 +0000 2024
>Originator:     Manuel Bouyer
>Release:        NetBSD 10.0_RC2/pkgsrc 2023Q4
>Organization:
>Environment:
System: NetBSD armandeche.soc.lip6.fr 10.0_RC2 NetBSD 10.0_RC2 (GENERIC_CAN) #12: Wed Jan 10 10:47:49 CET 2024 bouyer@armandeche.soc.lip6.fr:/local/armandeche1/tmp/build/amd64/obj/local/armandeche2/netbsd-10/src/sys/arch/amd64/compile/GENERIC_CAN amd64
Architecture: x86_64
Machine: amd64
>Description:
	cad/occt installs cmake files to be used by other cmake-using package.
	lib/cmake/opencascade/OpenCASCADEFoundationClassesTargets.cmake
	unconditionally sets dl in INTERFACE_LINK_LIBRARIES for the TKernel
	target. This cause softwares including this file to link with the
	TKernel library to try to link with -ldl, which doesn't exists on
	NetBSD.
>How-To-Repeat:
	In a cmakefile:
set(OpenCASCADE_DIR "${CMAKE_PREFIX_PATH}/lib/cmake/occt")
find_package(OpenCASCADE REQUIRED)
target_link_libraries(foo TKernel)

run cmake and see -ldl showing up in link.txt for foo.
>Fix:
	remplacing
INTERFACE_LINK_LIBRARIES "pthread;rt;stdc++;dl"
	with
INTERFACE_LINK_LIBRARIES "pthread;rt;stdc++;${CMAKE_DL_LIBS}"

	works for me but I don't know if it would DTRT on linux.
	An alternative would be to use
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
	to include dl in the INTERFACE_LINK_LIBRARIES list

>Release-Note:

>Audit-Trail:
From: Thomas Klausner <wiz@NetBSD.org>
To: NetBSD bugtracking <gnats-bugs@NetBSD.org>
Cc: 
Subject: Re: pkg/57938: cad/occt OpenCASCADEFoundationClassesTargets.cmake
 sets -ldl
Date: Thu, 15 Feb 2024 22:23:17 +0100

 On Thu, Feb 15, 2024 at 09:20:01PM +0000, Manuel.Bouyer@lip6.fr wrote:
 > 	remplacing
 > INTERFACE_LINK_LIBRARIES "pthread;rt;stdc++;dl"
 > 	with
 > INTERFACE_LINK_LIBRARIES "pthread;rt;stdc++;${CMAKE_DL_LIBS}"
 > 
 > 	works for me but I don't know if it would DTRT on linux.

 This should work, yes. See:
 cmake-3.28.3/Modules/Platform/Linux.cmake:set(CMAKE_DL_LIBS "dl")

 So please add that patch - thanks!
  Thomas

State-Changed-From-To: open->closed
State-Changed-By: bouyer@NetBSD.org
State-Changed-When: Tue, 27 Feb 2024 16:34:58 +0000
State-Changed-Why:
A patch using ${CMAKE_DL_LIBS} has been commited.


From: "Manuel Bouyer" <bouyer@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/57938 CVS commit: pkgsrc/cad/occt
Date: Tue, 27 Feb 2024 16:33:20 +0000

 Module Name:	pkgsrc
 Committed By:	bouyer
 Date:		Tue Feb 27 16:33:20 UTC 2024

 Modified Files:
 	pkgsrc/cad/occt: Makefile distinfo
 Added Files:
 	pkgsrc/cad/occt/patches: patch-adm_cmake_occt_csf.cmake

 Log Message:
 Don't unconditionally set dl in INTERFACE_LINK_LIBRARIES; use ${CMAKE_DL_LIBS}
 Should fix PR pkg/57938. Bump PKGREVISION


 To generate a diff of this commit:
 cvs rdiff -u -r1.2 -r1.3 pkgsrc/cad/occt/Makefile
 cvs rdiff -u -r1.3 -r1.4 pkgsrc/cad/occt/distinfo
 cvs rdiff -u -r0 -r1.1 pkgsrc/cad/occt/patches/patch-adm_cmake_occt_csf.cmake

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2024 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.