Bug 242154 - cad/netgen: Fails to link: libinterface.so: undefined reference to pthread_create
Summary: cad/netgen: Fails to link: libinterface.so: undefined reference to pthread_cr...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Stephen Montgomery-Smith
URL:
Keywords: needs-patch, needs-qa
Depends on:
Blocks:
 
Reported: 2019-11-22 11:18 UTC by smars
Modified: 2019-11-24 13:32 UTC (History)
0 users

See Also:
bugzilla: maintainer-feedback? (stephen)
koobs: merge-quarterly?


Attachments
make.conf (180 bytes, text/plain)
2019-11-22 13:57 UTC, smars
no flags Details
dmesg.boot (9.43 KB, text/plain)
2019-11-22 13:59 UTC, smars
no flags Details
pkg version -v output (94.41 KB, text/plain)
2019-11-22 14:11 UTC, smars
no flags Details
cd /usr/ports/cad/netgen && make | tee log (157.26 KB, text/plain)
2019-11-22 14:17 UTC, smars
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description smars 2019-11-22 11:18:49 UTC
LINKER ERROR

libtool: link: c++ -O2 -pipe -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing -isystem /usr/local/include -fopenmp -fstack-protector-strong -o .libs/netgen demoview.o ngappinit.o onetcl.o parallelfunc.o ngpkg.o -Wl,--export-dynamic  ../libsrc/visualization/.libs/libvisual.a -L/usr/local/lib ../libsrc/csg/.libs/libcsgvis.so ../libsrc/csg/.libs/libcsg.so ../libsrc/interface/.libs/libinterface.so ../libsrc/meshing/.libs/libmesh.so -ltogl -lGLU -ltk86 -ltcl86 -ljpeg -lGL -lXmu -lX11 -fopenmp -Wl,-rpath -Wl,/usr/local/lib
ld: error: ../libsrc/interface/.libs/libinterface.so: undefined reference to pthread_create
c++: error: linker command failed with exit code 1 (use -v to see invocation)
gmake[3]: *** [Makefile:415: netgen] Error 1
gmake[3]: Leaving directory '/wrkdirs/usr/ports/cad/netgen/work/netgen-5.3.1/ng'
gmake[2]: *** [Makefile:354: all-recursive] Error 1
gmake[2]: Leaving directory '/wrkdirs/usr/ports/cad/netgen/work/netgen-5.3.1'
gmake[1]: *** [Makefile:285: all] Error 2
gmake[1]: Leaving directory '/wrkdirs/usr/ports/cad/netgen/work/netgen-5.3.1'
*** Error code 1

Stop.
make: stopped in /usr/ports/cad/netgen
=>> Cleaning up wrkdir
===>  Cleaning for netgen-5.3.1_10
build of cad/netgen | netgen-5.3.1_10 ended at Fri Nov 22 08:07:47 CST 2019
build time: 00:07:19
!!! build failure encountered !!!

PATCH:
--- work/netgen-5.3.1/configure.ac.orig	2019-11-22 19:12:55.362850000 +0800
+++ work/netgen-5.3.1/configure.ac	2019-11-22 19:13:44.566282000 +0800
@@ -180,7 +180,7 @@
 		;;
 	x11)
 		AC_SUBST(TOGL_WINDOWINGSYSTEM,TOGL_X11)
-		TEA_ADD_LIBS([-lGL -lXmu -lX11])
+		TEA_ADD_LIBS([-lGL -lXmu -lX11 -lpthread])
 		LIBGLU=-lGLU
 		;;
 	win32)
Comment 1 Kubilay Kocak freebsd_committer freebsd_triage 2019-11-22 11:31:11 UTC
@Reporter, Could you please:

1) Provide additional information, including:

- Exact FreeBSD versions (uname -a output)
- /var/run/dmesg.boot output (as an attachment)
- /etc/make.conf contents (if not empty, as an attachment)
- pkg version -v output (as an attachment)
- Full build log (as an attachment

2) Attach your proposed patch as an attachment

Note: It may be worth attempting to modify the configure build at configure time, rather than patching configure.ac, which would additionally require running autoreconf to rebuild the configure file. ./configure --help output may provide the specific details on how to add libraries to that component/variable.

Thanks!
Comment 2 smars 2019-11-22 13:57:33 UTC
Created attachment 209342 [details]
make.conf
Comment 3 smars 2019-11-22 13:59:40 UTC
Created attachment 209343 [details]
dmesg.boot
Comment 4 smars 2019-11-22 14:11:50 UTC
Created attachment 209344 [details]
pkg version -v output
Comment 5 smars 2019-11-22 14:17:17 UTC
Created attachment 209345 [details]
cd /usr/ports/cad/netgen && make | tee log
Comment 6 smars 2019-11-22 14:27:48 UTC
FreeBSD *** 12.1-RELEASE-p1 FreeBSD 12.1-RELEASE-p1 r354703 GENERIC  amd64

For the patch, sorry... I am not quite sure how to do with the 'configure built': I am using cmake for my projects.
To make it work, I modified the Makefile and added the thread library link.

(I use poudriere on another computer to build my packages; the files in attachment are reproducing the problem on my desktop)
Comment 7 commit-hook freebsd_committer freebsd_triage 2019-11-24 02:37:16 UTC
A commit references this bug:

Author: stephen
Date: Sun Nov 24 02:36:45 UTC 2019
New revision: 518291
URL: https://svnweb.freebsd.org/changeset/ports/518291

Log:
  - Add patch so that -pthreads is included in libraries.
  - Mild corrections to pkg-plist.
  - Bump portrevision.

  PR:		242154
  Submitted by:	smars@yuntech.edu.tw

Changes:
  head/cad/netgen/Makefile
  head/cad/netgen/files/patch-configure.ac
  head/cad/netgen/pkg-plist
Comment 8 Stephen Montgomery-Smith freebsd_committer freebsd_triage 2019-11-24 02:38:43 UTC
I was able to reproduce the problem.  I committed the patch.  Thank you.  Let's hope it doesn't mess up netgen for other versions of FreeBSD.
Comment 9 smars 2019-11-24 13:32:02 UTC
(In reply to Stephen Montgomery-Smith from comment #8)
Thanks!