Created attachment 213939 [details] Test case to reproduce the error: conftest.c math/giacxcas is built with Gcc, and a comment says: # Warning: don't remove the USE_GCC without a runtime test *after* make install USE_GCC= yes But this causes segfault when libgiac is mixed with other libraries, e.g. libmpfi. How to reproduce: - take the attached conftest.c and compile it with or without linking with -lgiac - both build fine - run the resulting conftest: the one linked with -lgiac will segfaut. E.g. on FreeBSD-12.1 / amd64: $ cc -o conftest conftest.c -isystem /usr/local/include -Wl,-rpath=/usr/local/lib/gcc9 -L/usr/local/lib/gcc9 -B/usr/local/bin -L/usr/local/lib -lgmp -lmpfr -lmpfi -lflint $ ./conftest 1.5.4 $ cc -o conftest conftest.c -isystem /usr/local/include -Wl,-rpath=/usr/local/lib/gcc9 -L/usr/local/lib/gcc9 -B/usr/local/bin -L/usr/local/lib -lgiac -lgmp -lmpfr -lmpfi -lflint $ ./conftest zsh: segmentation fault (core dumped) ./conftest $ lldb ./conftest (lldb) target create "./conftest" Current executable set to './conftest' (x86_64). (lldb) b main Breakpoint 1: where = conftest`main + 15 at conftest.c:6:3, address = 0x00000000004007cf (lldb) r Process 54933 launching Process 54933 launched: '/usr/ports/math/sage/work/sage-9.1.rc1/conftest' (x86_64) Process 54933 stopped * thread #1, name = 'conftest', stop reason = signal SIGSEGV: address access protected (fault address: 0x803d72a18) frame #0: 0x0000000803d72a18 -> 0x803d72a18: xorb %cl, %cl 0x803d72a1a: rep addb $0x8, %al 0x803d72a1d: addb %al, (%rax) 0x803d72a1f: addb %al, (%rax)
Created attachment 214503 [details] Various fixes for math/giacxcas The attached patch fixes the reported problem, and also brings several other fixes and improvments for math/giacxcas: - do not link cocoalib with the static libgmp (other binaries are linked against the dynamic one) - fixes Fl::set_fonts for some badly registered fonts - remove USE_GCC: a runtime has been done and it seems OK - add USES=localbase to simplify the flags - add 2 missing libraries (libecm and libmpf): unless explicitely disabled they are used - Makefiles have been patched to install the in-line docs under $docdir => make programs and files coherent with that - add a TEST_TARGET: all tests but 2 pass - add USE_PERL5=run, because pgiac is a Perl script
Created attachment 214504 [details] Poudriere log.
Sorry for the delay, Thierry. Go ahead and commit the patch. Thank you, Yuri
Committed, thanks!
A commit references this bug: Author: thierry Date: Fri May 15 10:19:26 UTC 2020 New revision: 535281 URL: https://svnweb.freebsd.org/changeset/ports/535281 Log: - Fix an initial problem encountered with libgiac: it could not be linked with other libraries. + several other fixes and improvments for math/giacxcas: - do not link cocoalib with the static libgmp (other binaries are linked against the dynamic one) - fixes Fl::set_fonts for some badly registered fonts - remove USE_GCC: a runtime has been done and it seems OK - add USES=localbase to simplify the flags - add 2 missing libraries (libecm and libmpf): unless explicitely disabled they are used - Makefiles had been patched to install the in-line docs under $docdir => make programs and files coherent with that - add a TEST_TARGET: all tests but 2 pass - add USE_PERL5=run, because pgiac is a Perl script. PR: 246049 Submitted by: /me Approved by: yuri@ (maintainer) Changes: head/math/giacxcas/Makefile