Skip to content

Cygwin: Fix cliquer, giac, meataxe, rw, libbraiding to build shared libraries, using AM_LDFLAGS=-no-undefined #29152

@embray

Description

@embray

Follow-up from #30396, where libtool's fallback to static library build for giac caused linker errors while building sagelib.

This is fixed by passing -no-undefined to the libtool linking flags, by setting AM_LDFLAGS=-no-undefined.

Affected packages can be found as follows:

$ grep "undefined symbols not allowed" logs/pkgs/*
cliquer-1.21.p4.log:libtool: link: warning: undefined symbols not allowed in x86_64-unknown-cygwin shared libraries
giac-1.5.0.87p0.log:libtool: warning: undefined symbols not allowed in x86_64-pc-cygwin shared libraries; building static only
libbraiding-1.0.p0.log:libtool: warning: undefined symbols not allowed in x86_64-unknown-cygwin shared libraries; building static only
rw-0.7.p0.log:libtool: link: warning: undefined symbols not allowed in x86_64-unknown-cygwin shared libraries
singular-4.1.1p2.p0.log:libtool: warning: undefined symbols not allowed in x86_64-unknown-cygwin shared libraries; building static only

In singular, only the gitfan.la library (module) is affected:

Making all in gitfan
...
/usr/bin/bash ../../../libtool  --tag=CXX   --mode=link g++ -std=gnu++11  -O2 -g  -pipe -fno-common -g0 -O3 -Wno-unused-function -Wno-trigraphs -Wno-unused-parameter -Wunknown-pragmas -Wno-unused-variable -fomit-frame-pointer -fwrapv -fvisibility=default -finline-functions -fno-exceptions -fno-threadsafe-statics -fno-enforce-eh-specs -fconserve-space -funroll-loops -fno-delete-null-pointer-checks -fno-rtti -module -export-dynamic -avoid-version -flat_namespace -weak_reference_mismatches weak -undefined dynamic_lookup -L/cygdrive/d/a/sage/sage/local/lib -Wl,-rpath,/cygdrive/d/a/sage/sage/local/lib  -pipe -fno-common -g0 -O3 -Wno-unused-function -Wno-trigraphs -Wno-unused-parameter -Wunknown-pragmas -Wno-unused-variable -fomit-frame-pointer -fwrapv -fvisibility=default -finline-functions -fno-exceptions -fconserve-space -funroll-loops -fno-delete-null-pointer-checks  -Wl,-Bdynamic -o gitfan.la -rpath /cygdrive/d/a/sage/sage/local/libexec/singular/MOD gitfan_la-gitfan.lo  -lreadline -lncurses -lmpfr -lrt
libtool: warning: undefined symbols not allowed in x86_64-unknown-cygwin shared libraries; building static only
libtool: link: ar cru .libs/gitfan.a  gitfan_la-gitfan.o
libtool: link: ranlib .libs/gitfan.a
libtool: link: ( cd ".libs" && rm -f "gitfan.la" && ln -s "../gitfan.la" "gitfan.la" )

The issue also affects the optional package meataxe.

[meataxe-1.0.p0] /usr/bin/bash ../libtool  --tag=CC   --mode=link gcc  -g -O2  -L/opt/sagemath-9.0/local/lib -Wl,-rpath,/opt/sagemath-9.0/local/lib  -o libmtx.la -rpath /opt/sagemath-9.0/local/lib args.lo berlekmp.lo bsand.lo bscore.lo bsdup.lo bsissub.lo bsmatch.lo bsminus.lo bsop.lo bsor.lo bsprint.lo bsread.lo bswrite.lo cfinfo.lo charpol.lo chbasis.lo error.lo ffio.lo fpcore.lo fpdup.lo fpmul.lo fpmul2.lo fpprint.lo gcd.lo genseed.lo grmaprow.lo grmatcore.lo grtable.lo homcomp.lo imatcore.lo imatread.lo imatwrite.lo init.lo intio.lo issub.lo isisom.lo kernel-0.lo ldiag.lo maddmul.lo mat2vec.lo matadd.lo matclean.lo matcmp.lo maketabF.lo matcopy.lo matcore.lo matcut.lo matdup.lo matech.lo matid.lo matins.lo matinv.lo matmul.lo matnull.lo matorder.lo matpivot.lo matprint.lo matpwr.lo matread.lo mattr.lo mattrace.lo matwrite.lo message.lo mfcore.lo mfread.lo mfreadlong.lo mfwrite.lo mfwritelong.lo minpol.lo mkendo.lo mmulscal.lo mraddgen.lo mrcore.lo mrread.lo mrtranspose.lo mrwrite.lo msclean.lo mscore.lo mtensor.lo mtxobj.lo os.lo permcmp.lo permcore.lo permdup.lo perminv.lo permmul.lo permorder.lo permprint.lo permpwr.lo permread.lo permwrite.lo poladd.lo polcmp.lo polcore.lo polderive.lo poldiv.lo poldup.lo polgcd.lo polmul.lo polprint.lo polread.lo polwrite.lo quotient.lo random.lo rdcfgen.lo saction.lo setcore.lo setinsert.lo settest.lo spinup.lo spinup2.lo split.lo stabpwr.lo stfcore.lo stfread.lo stfwrite.lo string.lo sumint.lo temap.lo tkinfo.lo vec2mat.lo wgen.lo window.lo zcleanrow.lo zcmprow.lo zgap.lo zpermrow.lo zzz2.lo
[meataxe-1.0.p0] libtool:   error: can't build x86_64-unknown-cygwin shared library unless -no-undefined is specified

This is a common issue especially when using libtool to link Windows DLLs and should hopefully be straightforward to fix.

See also:

Depends on #31064

Upstream: Reported upstream. No feedback yet.

CC: @simon-king-jena @miguelmarco @dimpase @orlitzky @antonio-rojas @kiwifb @slel @jhpalmieri @vbraun

Component: porting: Cygwin

Author: Matthias Koeppe, Miguel Marco, Simon King

Branch/Commit: 6b6ee5c

Reviewer: Matthias Koeppe, Dima Pasechnik

Issue created by migration from https://trac.sagemath.org/ticket/29152

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions