Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing math library when linking gsi #765

Closed
vonbrand opened this issue Aug 30, 2022 · 20 comments
Closed

Missing math library when linking gsi #765

vonbrand opened this issue Aug 30, 2022 · 20 comments

Comments

@vonbrand
Copy link

Fedora 36 x86_64, at e98430b. After running ./config.status, make gives:

gcc -Wno-unused -Wno-write-strings -Wdisabled-optimization -fwrapv -fno-strict-aliasing -fno-trapping-math -fno-math-errno -fschedule-insns2 -foptimize-sibling-calls -fomit-frame-pointer -fPIC -fno-common -mpc64 -Wno-unused -Wno-write-strings -Wdisabled-optimization -fwrapv -fno-strict-aliasing -fno-trapping-math -fno-math-errno -fschedule-insns2 -foptimize-sibling-calls -fomit-frame-pointer -fPIC -fno-common -mpc64 -rdynamic -I"../include" -o gsi _gsi.o gsi.o "../lib/libgambit.so" libgambitgsi.so
/usr/bin/ld: ../lib/libgambit.so: undefined reference to sincos' /usr/bin/ld: ../lib/libgambit.so: undefined reference to asinh'
/usr/bin/ld: ../lib/libgambit.so: undefined reference to floor' /usr/bin/ld: ../lib/libgambit.so: undefined reference to log1p'
/usr/bin/ld: ../lib/libgambit.so: undefined reference to ceil' /usr/bin/ld: ../lib/libgambit.so: undefined reference to cosh'
/usr/bin/ld: ../lib/libgambit.so: undefined reference to tan' /usr/bin/ld: ../lib/libgambit.so: undefined reference to tanh'
/usr/bin/ld: ../lib/libgambit.so: undefined reference to asin' /usr/bin/ld: ../lib/libgambit.so: undefined reference to atanh'
/usr/bin/ld: ../lib/libgambit.so: undefined reference to log' /usr/bin/ld: ../lib/libgambit.so: undefined reference to atan'
/usr/bin/ld: ../lib/libgambit.so: undefined reference to expm1' /usr/bin/ld: ../lib/libgambit.so: undefined reference to sinh'
/usr/bin/ld: ../lib/libgambit.so: undefined reference to acos' /usr/bin/ld: ../lib/libgambit.so: undefined reference to exp'
/usr/bin/ld: ../lib/libgambit.so: undefined reference to sin' /usr/bin/ld: ../lib/libgambit.so: undefined reference to hypot'
/usr/bin/ld: ../lib/libgambit.so: undefined reference to acosh' /usr/bin/ld: ../lib/libgambit.so: undefined reference to pow'
/usr/bin/ld: ../lib/libgambit.so: undefined reference to atan2' /usr/bin/ld: ../lib/libgambit.so: undefined reference to ilogb'
/usr/bin/ld: ../lib/libgambit.so: undefined reference to `cos'
collect2: error: ld returned 1 exit status
make[1]: *** [makefile:207: gsi] Error 1
make[1]: Leaving directory '/home/vonbrand/tmp/SCHEME/gambit/gsi'
make: *** [makefile:543: core-recursive] Error 1

@gambiteer
Copy link
Collaborator

Thank you. Can you tell us the output to

./configure
rm -rf boot gsc-boot
make core

Thanks.
Brad

@gambiteer
Copy link
Collaborator

gambiteer commented Sep 12, 2022

OK, I see the same thing on Ubuntu 22.04:

gcc -O1 -Wno-unused -Wno-write-strings -Wdisabled-optimization -fwrapv -fno-strict-aliasing -fno-trapping-math -fno-math-errno -fschedule-insns2 -foptimize-sibling-calls -fomit-frame-pointer -march=native -fPIC -fno-common -mpc64   -I"../include" -c -o _gsi_.o -I. -DHAVE_CONFIG_H _gsi_.c
gcc -Wno-unused -Wno-write-strings -Wdisabled-optimization -fwrapv -fno-strict-aliasing -fno-trapping-math -fno-math-errno -fschedule-insns2 -foptimize-sibling-calls -fomit-frame-pointer -march=native -fPIC -fno-common -mpc64    -Wno-unused -Wno-write-strings -Wdisabled-optimization -fwrapv -fno-strict-aliasing -fno-trapping-math -fno-math-errno -fschedule-insns2 -foptimize-sibling-calls -fomit-frame-pointer -march=native -fPIC -fno-common -mpc64   -rdynamic  -I"../include"  -o gsi    _gsi.o _gsi_.o "../lib/libgambit.so"  libgambitgsi.so
/usr/bin/ld: ../lib/libgambit.so: undefined reference to `sincos'
/usr/bin/ld: ../lib/libgambit.so: undefined reference to `asinh'
/usr/bin/ld: ../lib/libgambit.so: undefined reference to `log1p'
/usr/bin/ld: ../lib/libgambit.so: undefined reference to `cosh'
/usr/bin/ld: ../lib/libgambit.so: undefined reference to `tan'
/usr/bin/ld: ../lib/libgambit.so: undefined reference to `tanh'
/usr/bin/ld: ../lib/libgambit.so: undefined reference to `asin'
/usr/bin/ld: ../lib/libgambit.so: undefined reference to `atanh'
/usr/bin/ld: ../lib/libgambit.so: undefined reference to `log'
/usr/bin/ld: ../lib/libgambit.so: undefined reference to `atan'
/usr/bin/ld: ../lib/libgambit.so: undefined reference to `expm1'
/usr/bin/ld: ../lib/libgambit.so: undefined reference to `sinh'
/usr/bin/ld: ../lib/libgambit.so: undefined reference to `acos'
/usr/bin/ld: ../lib/libgambit.so: undefined reference to `exp'
/usr/bin/ld: ../lib/libgambit.so: undefined reference to `sin'
/usr/bin/ld: ../lib/libgambit.so: undefined reference to `hypot'
/usr/bin/ld: ../lib/libgambit.so: undefined reference to `acosh'
/usr/bin/ld: ../lib/libgambit.so: undefined reference to `pow'
/usr/bin/ld: ../lib/libgambit.so: undefined reference to `atan2'
/usr/bin/ld: ../lib/libgambit.so: undefined reference to `ilogb'
/usr/bin/ld: ../lib/libgambit.so: undefined reference to `cos'
collect2: error: ld returned 1 exit status
make[1]: *** [makefile:207: gsi] Error 1
make[1]: Leaving directory '/home/lucier/programs/gambit/gambit/gsi'
make: *** [makefile:543: core-recursive] Error 1

I'll look into things some more later.
Edit: adding -lm to the end of the command line erases this failure.

@gambiteer
Copy link
Collaborator

OK, I just did

    13	11:31	./configure
    14	11:31	rm -rf boot gsc-boot
    15	11:31	make core

and it failed earler:

gcc -Wno-unused -Wno-write-strings -Wdisabled-optimization -fwrapv -fno-strict-aliasing -fno-trapping-math -fno-math-errno -fschedule-insns2 -foptimize-sibling-calls -fomit-frame-pointer -fPIC -fno-common -mpc64    -Wno-unused -Wno-write-strings -Wdisabled-optimization -fwrapv -fno-strict-aliasing -fno-trapping-math -fno-math-errno -fschedule-insns2 -foptimize-sibling-calls -fomit-frame-pointer -fPIC -fno-common -mpc64   -rdynamic  -I"../include"  -o gsi    _gsi.o _gsi_.o "../lib/libgambit.a"  libgambitgsi.a
/usr/bin/ld: ../lib/libgambit.a(setup.o): in function `___setup':
setup.c:(.text+0x423a): undefined reference to `fabs'
/usr/bin/ld: setup.c:(.text+0x4243): undefined reference to `ceil'
/usr/bin/ld: setup.c:(.text+0x424c): undefined reference to `ilogb'
/usr/bin/ld: setup.c:(.text+0x4266): undefined reference to `floor'
/usr/bin/ld: setup.c:(.text+0x4280): undefined reference to `expm1'
/usr/bin/ld: setup.c:(.text+0x4288): undefined reference to `exp'
/usr/bin/ld: setup.c:(.text+0x4291): undefined reference to `log1p'
/usr/bin/ld: setup.c:(.text+0x42a3): undefined reference to `cos'
/usr/bin/ld: setup.c:(.text+0x42c5): undefined reference to `asin'
/usr/bin/ld: setup.c:(.text+0x42cd): undefined reference to `sin'
/usr/bin/ld: setup.c:(.text+0x42d5): undefined reference to `tan'
/usr/bin/ld: setup.c:(.text+0x42e7): undefined reference to `atan'
/usr/bin/ld: setup.c:(.text+0x42ef): undefined reference to `acos'
/usr/bin/ld: setup.c:(.text+0x42f7): undefined reference to `log'
/usr/bin/ld: setup.c:(.text+0x4308): undefined reference to `sinh'
/usr/bin/ld: setup.c:(.text+0x4347): undefined reference to `cosh'
/usr/bin/ld: setup.c:(.text+0x4350): undefined reference to `asinh'
/usr/bin/ld: setup.c:(.text+0x4358): undefined reference to `atanh'
/usr/bin/ld: setup.c:(.text+0x4360): undefined reference to `pow'
/usr/bin/ld: setup.c:(.text+0x4378): undefined reference to `tanh'
/usr/bin/ld: setup.c:(.text+0x4380): undefined reference to `acosh'
/usr/bin/ld: setup.c:(.text+0x438f): undefined reference to `atan2'
/usr/bin/ld: setup.c:(.text+0x439e): undefined reference to `sqrt'
/usr/bin/ld: ../lib/libgambit.a(_num.o): in function `___H__23__23_divide':
_num.c:(.text+0x6bae0): undefined reference to `floor'
/usr/bin/ld: ../lib/libgambit.a(_num.o): in function `___H__23__23_flonum_2d_expt2':
_num.c:(.text+0x768b5): undefined reference to `pow'
/usr/bin/ld: ../lib/libgambit.a(_num.o): in function `___H_flexpt':
_num.c:(.text+0x76b72): undefined reference to `pow'
/usr/bin/ld: ../lib/libgambit.a(_num.o): in function `___H__23__23_flexpt':
_num.c:(.text+0x76c9a): undefined reference to `pow'
/usr/bin/ld: ../lib/libgambit.a(_num.o): in function `___H__23__23_expt':
_num.c:(.text+0x774f8): undefined reference to `pow'
/usr/bin/ld: _num.c:(.text+0x77cf9): undefined reference to `floor'
/usr/bin/ld: _num.c:(.text+0x77f12): undefined reference to `pow'
/usr/bin/ld: _num.c:(.text+0x77fb4): undefined reference to `floor'
/usr/bin/ld: _num.c:(.text+0x78024): undefined reference to `pow'
/usr/bin/ld: _num.c:(.text+0x780b6): undefined reference to `floor'
/usr/bin/ld: _num.c:(.text+0x78266): undefined reference to `pow'
/usr/bin/ld: _num.c:(.text+0x78329): undefined reference to `floor'
/usr/bin/ld: _num.c:(.text+0x784d9): undefined reference to `pow'
/usr/bin/ld: _num.c:(.text+0x788d1): undefined reference to `pow'
/usr/bin/ld: _num.c:(.text+0x789d1): undefined reference to `pow'
/usr/bin/ld: _num.c:(.text+0x79d18): undefined reference to `pow'
/usr/bin/ld: _num.c:(.text+0x79db4): undefined reference to `pow'
/usr/bin/ld: ../lib/libgambit.a(_num.o):_num.c:(.text+0x79ec5): more undefined references to `pow' follow
/usr/bin/ld: ../lib/libgambit.a(_num.o): in function `___H_flhypot':
_num.c:(.text+0x7a77c): undefined reference to `hypot'
/usr/bin/ld: ../lib/libgambit.a(_num.o): in function `___H__23__23_flhypot':
_num.c:(.text+0x7a8a4): undefined reference to `hypot'
/usr/bin/ld: ../lib/libgambit.a(_num.o): in function `___H__23__23_magnitude':
_num.c:(.text+0x7adfb): undefined reference to `hypot'
/usr/bin/ld: ../lib/libgambit.a(_num.o): in function `___H_flatanh':
_num.c:(.text+0x7dd18): undefined reference to `atanh'
/usr/bin/ld: ../lib/libgambit.a(_num.o): in function `___H__23__23_flatanh':
_num.c:(.text+0x7de31): undefined reference to `atanh'
/usr/bin/ld: ../lib/libgambit.a(_num.o): in function `___H_flacosh':
_num.c:(.text+0x7e085): undefined reference to `acosh'
/usr/bin/ld: ../lib/libgambit.a(_num.o): in function `___H__23__23_flacosh':
_num.c:(.text+0x7e19e): undefined reference to `acosh'
/usr/bin/ld: ../lib/libgambit.a(_num.o): in function `___H__23__23_acosh':
_num.c:(.text+0x7e676): undefined reference to `acosh'
/usr/bin/ld: ../lib/libgambit.a(_num.o): in function `___H_flasinh':
_num.c:(.text+0x7e8ab): undefined reference to `asinh'
/usr/bin/ld: ../lib/libgambit.a(_num.o): in function `___H__23__23_flasinh':
_num.c:(.text+0x7e9c4): undefined reference to `asinh'
/usr/bin/ld: ../lib/libgambit.a(_num.o): in function `___H__23__23_asinh':
_num.c:(.text+0x7eb7e): undefined reference to `asinh'
/usr/bin/ld: _num.c:(.text+0x7eca7): undefined reference to `asinh'
/usr/bin/ld: _num.c:(.text+0x7ed29): undefined reference to `asinh'
/usr/bin/ld: ../lib/libgambit.a(_num.o): in function `___H_fltanh':
_num.c:(.text+0x7f04f): undefined reference to `tanh'
/usr/bin/ld: ../lib/libgambit.a(_num.o): in function `___H__23__23_fltanh':
_num.c:(.text+0x7f168): undefined reference to `tanh'
/usr/bin/ld: ../lib/libgambit.a(_num.o): in function `___H__23__23_tanh':
_num.c:(.text+0x7f33b): undefined reference to `tanh'
/usr/bin/ld: _num.c:(.text+0x7f4d5): undefined reference to `tanh'
/usr/bin/ld: _num.c:(.text+0x7f55f): undefined reference to `tanh'
/usr/bin/ld: ../lib/libgambit.a(_num.o): in function `___H_flcosh':
_num.c:(.text+0x7f8c8): undefined reference to `cosh'
/usr/bin/ld: ../lib/libgambit.a(_num.o): in function `___H__23__23_flcosh':
_num.c:(.text+0x7f9e1): undefined reference to `cosh'
/usr/bin/ld: ../lib/libgambit.a(_num.o): in function `___H_flsinh':
_num.c:(.text+0x7fc35): undefined reference to `sinh'
/usr/bin/ld: ../lib/libgambit.a(_num.o): in function `___H__23__23_flsinh':
_num.c:(.text+0x7fd4e): undefined reference to `sinh'
/usr/bin/ld: ../lib/libgambit.a(_num.o): in function `___H__23__23_atan':
_num.c:(.text+0x7ff2b): undefined reference to `atan'
/usr/bin/ld: _num.c:(.text+0x800c4): undefined reference to `atan'
/usr/bin/ld: _num.c:(.text+0x80160): undefined reference to `atan'
/usr/bin/ld: ../lib/libgambit.a(_num.o): in function `___H_flatan':
_num.c:(.text+0x8056b): undefined reference to `atan'
/usr/bin/ld: _num.c:(.text+0x805d5): undefined reference to `atan2'
/usr/bin/ld: ../lib/libgambit.a(_num.o): in function `___H__23__23_flatan':
_num.c:(.text+0x807f1): undefined reference to `atan'
/usr/bin/ld: _num.c:(.text+0x80834): undefined reference to `atan2'
/usr/bin/ld: ../lib/libgambit.a(_num.o): in function `___H__23__23_atan2':
_num.c:(.text+0x81224): undefined reference to `atan2'
/usr/bin/ld: ../lib/libgambit.a(_num.o): in function `___H_flacos':
_num.c:(.text+0x81a6d): undefined reference to `acos'
/usr/bin/ld: ../lib/libgambit.a(_num.o): in function `___H__23__23_flacos':
_num.c:(.text+0x81b86): undefined reference to `acos'
/usr/bin/ld: ../lib/libgambit.a(_num.o): in function `___H__23__23_acos':
_num.c:(.text+0x81f94): undefined reference to `acos'
/usr/bin/ld: ../lib/libgambit.a(_num.o): in function `___H_flasin':
_num.c:(.text+0x822e4): undefined reference to `asin'
/usr/bin/ld: ../lib/libgambit.a(_num.o): in function `___H__23__23_flasin':
_num.c:(.text+0x823fd): undefined reference to `asin'
/usr/bin/ld: ../lib/libgambit.a(_num.o): in function `___H__23__23_asin':
_num.c:(.text+0x827e2): undefined reference to `asin'
/usr/bin/ld: ../lib/libgambit.a(_num.o): in function `___H_fltan':
_num.c:(.text+0x82b5a): undefined reference to `tan'
/usr/bin/ld: ../lib/libgambit.a(_num.o): in function `___H__23__23_fltan':
_num.c:(.text+0x82c73): undefined reference to `tan'
/usr/bin/ld: ../lib/libgambit.a(_num.o): in function `___H__23__23_tan':
_num.c:(.text+0x82e3c): undefined reference to `tan'
/usr/bin/ld: _num.c:(.text+0x82f64): undefined reference to `tan'
/usr/bin/ld: _num.c:(.text+0x82ffe): undefined reference to `tan'
/usr/bin/ld: ../lib/libgambit.a(_num.o): in function `___H_flcos':
_num.c:(.text+0x8338d): undefined reference to `cos'
/usr/bin/ld: ../lib/libgambit.a(_num.o): in function `___H__23__23_flcos':
_num.c:(.text+0x834a6): undefined reference to `cos'
/usr/bin/ld: ../lib/libgambit.a(_num.o): in function `___H_flsin':
_num.c:(.text+0x836fa): undefined reference to `sin'
/usr/bin/ld: ../lib/libgambit.a(_num.o): in function `___H__23__23_flsin':
_num.c:(.text+0x83813): undefined reference to `sin'
/usr/bin/ld: ../lib/libgambit.a(_num.o): in function `___H__23__23_make_2d_polar':
_num.c:(.text+0x83b30): undefined reference to `sin'
/usr/bin/ld: _num.c:(.text+0x84020): undefined reference to `cos'
/usr/bin/ld: ../lib/libgambit.a(_num.o): in function `___H__23__23_cosh':
_num.c:(.text+0x8434f): undefined reference to `cosh'
/usr/bin/ld: _num.c:(.text+0x84482): undefined reference to `cosh'
/usr/bin/ld: _num.c:(.text+0x8451d): undefined reference to `cosh'
/usr/bin/ld: _num.c:(.text+0x8465d): undefined reference to `sincos'
/usr/bin/ld: _num.c:(.text+0x84683): undefined reference to `sinh'
/usr/bin/ld: _num.c:(.text+0x84693): undefined reference to `cosh'
/usr/bin/ld: ../lib/libgambit.a(_num.o): in function `___H__23__23_sinh':
_num.c:(.text+0x84bc3): undefined reference to `sinh'
/usr/bin/ld: _num.c:(.text+0x84cf6): undefined reference to `sinh'
/usr/bin/ld: _num.c:(.text+0x84d91): undefined reference to `sinh'
/usr/bin/ld: _num.c:(.text+0x84ed1): undefined reference to `sincos'
/usr/bin/ld: _num.c:(.text+0x84ef7): undefined reference to `cosh'
/usr/bin/ld: _num.c:(.text+0x84f07): undefined reference to `sinh'
/usr/bin/ld: ../lib/libgambit.a(_num.o): in function `___H__23__23_cos':
_num.c:(.text+0x8541d): undefined reference to `cos'
/usr/bin/ld: _num.c:(.text+0x85560): undefined reference to `cos'
/usr/bin/ld: _num.c:(.text+0x855f3): undefined reference to `cos'
/usr/bin/ld: _num.c:(.text+0x8572a): undefined reference to `sinh'
/usr/bin/ld: _num.c:(.text+0x85745): undefined reference to `sincos'
/usr/bin/ld: _num.c:(.text+0x85761): undefined reference to `cosh'
/usr/bin/ld: ../lib/libgambit.a(_num.o): in function `___H__23__23_sin':
_num.c:(.text+0x85cfd): undefined reference to `sin'
/usr/bin/ld: _num.c:(.text+0x85e3f): undefined reference to `sin'
/usr/bin/ld: _num.c:(.text+0x85ed4): undefined reference to `sin'
/usr/bin/ld: _num.c:(.text+0x8600f): undefined reference to `sinh'
/usr/bin/ld: _num.c:(.text+0x8602a): undefined reference to `sincos'
/usr/bin/ld: _num.c:(.text+0x86046): undefined reference to `cosh'
/usr/bin/ld: ../lib/libgambit.a(_num.o): in function `___H_fllog1p':
_num.c:(.text+0x865f4): undefined reference to `log1p'
/usr/bin/ld: ../lib/libgambit.a(_num.o): in function `___H__23__23_fllog1p':
_num.c:(.text+0x8670d): undefined reference to `log1p'
/usr/bin/ld: ../lib/libgambit.a(_num.o): in function `___H__23__23_atanh':
_num.c:(.text+0x86d9d): undefined reference to `log1p'
/usr/bin/ld: _num.c:(.text+0x86fd9): undefined reference to `atanh'
/usr/bin/ld: ../lib/libgambit.a(_num.o): in function `___H_fllog':
_num.c:(.text+0x87307): undefined reference to `log'
/usr/bin/ld: _num.c:(.text+0x87367): undefined reference to `log'
/usr/bin/ld: _num.c:(.text+0x8737b): undefined reference to `log'
/usr/bin/ld: ../lib/libgambit.a(_num.o): in function `___H__23__23_fllog':
_num.c:(.text+0x875a1): undefined reference to `log'
/usr/bin/ld: _num.c:(.text+0x875e2): undefined reference to `log'
/usr/bin/ld: ../lib/libgambit.a(_num.o):_num.c:(.text+0x875f3): more undefined references to `log' follow
/usr/bin/ld: ../lib/libgambit.a(_num.o): in function `___H__23__23_log':
_num.c:(.text+0x87e7b): undefined reference to `log1p'
/usr/bin/ld: _num.c:(.text+0x87f22): undefined reference to `log'
/usr/bin/ld: _num.c:(.text+0x8813a): undefined reference to `log'
/usr/bin/ld: _num.c:(.text+0x882f1): undefined reference to `log'
/usr/bin/ld: ../lib/libgambit.a(_num.o): in function `___H__23__23_catanh':
_num.c:(.text+0x89c57): undefined reference to `log1p'
/usr/bin/ld: _num.c:(.text+0x89d8f): undefined reference to `atan'
/usr/bin/ld: _num.c:(.text+0x8a62b): undefined reference to `log'
/usr/bin/ld: ../lib/libgambit.a(_num.o): in function `___H_flexpm1':
_num.c:(.text+0x8a9e9): undefined reference to `expm1'
/usr/bin/ld: ../lib/libgambit.a(_num.o): in function `___H__23__23_flexpm1':
_num.c:(.text+0x8ab02): undefined reference to `expm1'
/usr/bin/ld: ../lib/libgambit.a(_num.o): in function `___H_flexp':
_num.c:(.text+0x8ad56): undefined reference to `exp'
/usr/bin/ld: ../lib/libgambit.a(_num.o): in function `___H__23__23_flexp':
_num.c:(.text+0x8ae6f): undefined reference to `exp'
/usr/bin/ld: ../lib/libgambit.a(_num.o): in function `___H__23__23_exp':
_num.c:(.text+0x8b026): undefined reference to `exp'
/usr/bin/ld: _num.c:(.text+0x8b151): undefined reference to `exp'
/usr/bin/ld: _num.c:(.text+0x8b1eb): undefined reference to `exp'
/usr/bin/ld: ../lib/libgambit.a(_num.o): in function `___H_flilogb':
_num.c:(.text+0x8b548): undefined reference to `ilogb'
/usr/bin/ld: ../lib/libgambit.a(_num.o): in function `___H__23__23_flilogb':
_num.c:(.text+0x8b5e3): undefined reference to `ilogb'
/usr/bin/ld: ../lib/libgambit.a(_num.o): in function `___H__23__23_cssqs':
_num.c:(.text+0x8c1c6): undefined reference to `ilogb'
/usr/bin/ld: ../lib/libgambit.a(_num.o): in function `___H__23__23_flonum_2d_printout':
_num.c:(.text+0x8d963): undefined reference to `log'
/usr/bin/ld: ../lib/libgambit.a(_num.o): in function `___H__23__23_gcd2':
_num.c:(.text+0x95493): undefined reference to `floor'
/usr/bin/ld: _num.c:(.text+0x95d24): undefined reference to `floor'
/usr/bin/ld: _num.c:(.text+0x9d83e): undefined reference to `floor'
collect2: error: ld returned 1 exit status
make[1]: *** [makefile:207: gsi] Error 1
make[1]: Leaving directory '/home/lucier/programs/gambit/gambit/gsi'
make: *** [makefile:543: core-recursive] Error 1

Marc: Do we need to run autoconfig again?

@feeley
Copy link
Member

feeley commented Sep 12, 2022

I haven't yet had time to look into this in depth. My understanding is that the configure script thinks that the -lm C compiler option is not required to compile programs that need the math library. However, it seems that on some linux systems it is (now) required.

The immediate solution is to configure Gambit by explicitly using this flag, for example

configure --enable-single-host CC="gcc -lm"

@gambiteer
Copy link
Collaborator

No, that doesn't work:

gcc -lm -Wno-unused -Wno-write-strings -Wdisabled-optimization -fwrapv -fno-strict-aliasing -fno-trapping-math -fno-math-errno -fschedule-insns2 -foptimize-sibling-calls -fomit-frame-pointer -march=native -fPIC -fno-common -mpc64    -Wno-unused -Wno-write-strings -Wdisabled-optimization -fwrapv -fno-strict-aliasing -fno-trapping-math -fno-math-errno -fschedule-insns2 -foptimize-sibling-calls -fomit-frame-pointer -march=native -fPIC -fno-common -mpc64   -rdynamic  -I"../include"  -o gsi    _gsi.o _gsi_.o "../lib/libgambit.so"  libgambitgsi.so
/usr/bin/ld: ../lib/libgambit.so: undefined reference to `sincos'
/usr/bin/ld: ../lib/libgambit.so: undefined reference to `asinh'
/usr/bin/ld: ../lib/libgambit.so: undefined reference to `log1p'
/usr/bin/ld: ../lib/libgambit.so: undefined reference to `cosh'
/usr/bin/ld: ../lib/libgambit.so: undefined reference to `tan'
/usr/bin/ld: ../lib/libgambit.so: undefined reference to `tanh'
/usr/bin/ld: ../lib/libgambit.so: undefined reference to `asin'
/usr/bin/ld: ../lib/libgambit.so: undefined reference to `atanh'
/usr/bin/ld: ../lib/libgambit.so: undefined reference to `log'
/usr/bin/ld: ../lib/libgambit.so: undefined reference to `atan'
/usr/bin/ld: ../lib/libgambit.so: undefined reference to `expm1'
/usr/bin/ld: ../lib/libgambit.so: undefined reference to `sinh'
/usr/bin/ld: ../lib/libgambit.so: undefined reference to `acos'
/usr/bin/ld: ../lib/libgambit.so: undefined reference to `exp'
/usr/bin/ld: ../lib/libgambit.so: undefined reference to `sin'
/usr/bin/ld: ../lib/libgambit.so: undefined reference to `hypot'
/usr/bin/ld: ../lib/libgambit.so: undefined reference to `acosh'
/usr/bin/ld: ../lib/libgambit.so: undefined reference to `pow'
/usr/bin/ld: ../lib/libgambit.so: undefined reference to `atan2'
/usr/bin/ld: ../lib/libgambit.so: undefined reference to `ilogb'
/usr/bin/ld: ../lib/libgambit.so: undefined reference to `cos'
collect2: error: ld returned 1 exit status
make[1]: *** [makefile:207: gsi] Error 1
make[1]: Leaving directory '/home/lucier/programs/gambit/gambit/gsi'
make: *** [makefile:543: core-recursive] Error 1

But I really have to idea what's going on: Configuring with

./configure LDFLAGS='-lm' '--enable-march=native' '--enable-dynamic-clib' '--enable-single-host' '--enable-multiple-versions' '--enable-shared'

leads to:

gcc -lm    -Wno-unused -Wno-write-strings -Wdisabled-optimization -fwrapv -fno-strict-aliasing -fno-trapping-math -fno-math-errno -fschedule-insns2 -foptimize-sibling-calls -fomit-frame-pointer -march=native -fPIC -fno-common -mpc64    -Wno-unused -Wno-write-strings -Wdisabled-optimization -fwrapv -fno-strict-aliasing -fno-trapping-math -fno-math-errno -fschedule-insns2 -foptimize-sibling-calls -fomit-frame-pointer -march=native -fPIC -fno-common -mpc64   -rdynamic  -I"../include"  -o gsi    _gsi.o _gsi_.o "../lib/libgambit.so"  libgambitgsi.so
/usr/bin/ld: ../lib/libgambit.so: undefined reference to `sincos'
/usr/bin/ld: ../lib/libgambit.so: undefined reference to `asinh'
/usr/bin/ld: ../lib/libgambit.so: undefined reference to `log1p'
/usr/bin/ld: ../lib/libgambit.so: undefined reference to `cosh'
/usr/bin/ld: ../lib/libgambit.so: undefined reference to `tan'
/usr/bin/ld: ../lib/libgambit.so: undefined reference to `tanh'
/usr/bin/ld: ../lib/libgambit.so: undefined reference to `asin'
/usr/bin/ld: ../lib/libgambit.so: undefined reference to `atanh'
/usr/bin/ld: ../lib/libgambit.so: undefined reference to `log'
/usr/bin/ld: ../lib/libgambit.so: undefined reference to `atan'
/usr/bin/ld: ../lib/libgambit.so: undefined reference to `expm1'
/usr/bin/ld: ../lib/libgambit.so: undefined reference to `sinh'
/usr/bin/ld: ../lib/libgambit.so: undefined reference to `acos'
/usr/bin/ld: ../lib/libgambit.so: undefined reference to `exp'
/usr/bin/ld: ../lib/libgambit.so: undefined reference to `sin'
/usr/bin/ld: ../lib/libgambit.so: undefined reference to `hypot'
/usr/bin/ld: ../lib/libgambit.so: undefined reference to `acosh'
/usr/bin/ld: ../lib/libgambit.so: undefined reference to `pow'
/usr/bin/ld: ../lib/libgambit.so: undefined reference to `atan2'
/usr/bin/ld: ../lib/libgambit.so: undefined reference to `ilogb'
/usr/bin/ld: ../lib/libgambit.so: undefined reference to `cos'
collect2: error: ld returned 1 exit status
make[1]: *** [makefile:207: gsi] Error 1
make[1]: Leaving directory '/home/lucier/programs/gambit/gambit/gsi'
make: *** [makefile:543: core-recursive] Error 1

The internets say that the -lm needs to go at the end.

@gambiteer
Copy link
Collaborator

make check fails in a similar way with

LD_LIBRARY_PATH=../lib:../gsi:../gsc:/usr/local/libimobiledevice/lib:/usr/local/Gambit/current/lib:/usr/local/netpbm10/lib: ../gsc/gsc -:~~bin=../bin,~~lib=../lib,~~include=../include -f -warnings -exe -cc-options "-D___LIBRARY" -o client client.c server.scm
/usr/bin/ld: /home/lucier/programs/gambit/gambit/lib/libgambit.so: undefined reference to `sincos'
/usr/bin/ld: /home/lucier/programs/gambit/gambit/lib/libgambit.so: undefined reference to `asinh'
/usr/bin/ld: /home/lucier/programs/gambit/gambit/lib/libgambit.so: undefined reference to `log1p'
/usr/bin/ld: /home/lucier/programs/gambit/gambit/lib/libgambit.so: undefined reference to `cosh'
/usr/bin/ld: /home/lucier/programs/gambit/gambit/lib/libgambit.so: undefined reference to `tan'
/usr/bin/ld: /home/lucier/programs/gambit/gambit/lib/libgambit.so: undefined reference to `tanh'
/usr/bin/ld: /home/lucier/programs/gambit/gambit/lib/libgambit.so: undefined reference to `asin'
/usr/bin/ld: /home/lucier/programs/gambit/gambit/lib/libgambit.so: undefined reference to `atanh'
/usr/bin/ld: /home/lucier/programs/gambit/gambit/lib/libgambit.so: undefined reference to `log'
/usr/bin/ld: /home/lucier/programs/gambit/gambit/lib/libgambit.so: undefined reference to `atan'
/usr/bin/ld: /home/lucier/programs/gambit/gambit/lib/libgambit.so: undefined reference to `expm1'
/usr/bin/ld: /home/lucier/programs/gambit/gambit/lib/libgambit.so: undefined reference to `sinh'
/usr/bin/ld: /home/lucier/programs/gambit/gambit/lib/libgambit.so: undefined reference to `acos'
/usr/bin/ld: /home/lucier/programs/gambit/gambit/lib/libgambit.so: undefined reference to `exp'
/usr/bin/ld: /home/lucier/programs/gambit/gambit/lib/libgambit.so: undefined reference to `sin'
/usr/bin/ld: /home/lucier/programs/gambit/gambit/lib/libgambit.so: undefined reference to `hypot'
/usr/bin/ld: /home/lucier/programs/gambit/gambit/lib/libgambit.so: undefined reference to `acosh'
/usr/bin/ld: /home/lucier/programs/gambit/gambit/lib/libgambit.so: undefined reference to `pow'
/usr/bin/ld: /home/lucier/programs/gambit/gambit/lib/libgambit.so: undefined reference to `atan2'
/usr/bin/ld: /home/lucier/programs/gambit/gambit/lib/libgambit.so: undefined reference to `ilogb'
/usr/bin/ld: /home/lucier/programs/gambit/gambit/lib/libgambit.so: undefined reference to `cos'
collect2: error: ld returned 1 exit status
*** ERROR IN ##main -- target link failed while linking "/home/lucier/programs/gambit/gambit/tests/server_.o" "/home/lucier/programs/gambit/gambit/tests/client.o" "/home/lucier/programs/gambit/gambit/tests/server.o"

The script that's invoked with gsc -exe will need to be updated, too.

@gambiteer
Copy link
Collaborator

This is a workaround:

./configure LIBS='-lm' '--enable-march=native' '--enable-dynamic-clib' '--enable-single-host' '--enable-multiple-versions' '--enable-shared'

@bheesham
Copy link
Contributor

bheesham commented Feb 5, 2023

Potentially related: I ran into a similar thing here. I documented some steps to reproduce here: https://gist.github.com/bheesham/3235211d11935c94be09d31810350593

@feeley
Copy link
Member

feeley commented Jul 24, 2023

I believe this issue is due to a problem with recent versions of autoconf, and that autoconf 2.69 solves the issue. Please check 9abb138.

Could someone check if this solves the issue?

@gambiteer
Copy link
Collaborator

Yes, it's fixed.

@thchha
Copy link

thchha commented Oct 8, 2023

Beeing on: 342399c7 (HEAD -> master, origin/master, origin/HEAD) SRFI 231: Improve testing.
Running: 6.5.0-1-arm64 #1 SMP Debian 6.5.3-1 (2023-09-13) aarch64 GNU/Linux
GCC: 13.2.0

I encountered the same error.
The workaround had still to be employed:

$ rm -rf boot/ gsc-boot/
$ ./configure LIBS='-lm' --prefix=/home/tomes/runenv/gambit --enable-single-host --enable-targets= --enable-bignum --enable-ratnum --enable-poll
$ make bootstrap; make bootclean; make -j8; make check; make modules; make install

The issue appears to persist.
Apparently the debian maintainers did the following to resolve the issue; Maybe this is of interest:
https://sources.debian.org/patches/gambc/4.9.3-1.2/autoconf2.71.patch/

@gambiteer
Copy link
Collaborator

I don't know much about configure, but the Debian patch:

 
 if test "$ENABLE_CPLUSPLUS" = yes; then
 
-  AC_LANG(C++)
+  #AC_LANG(C++)
   AC_PROG_CXX
   AC_PROG_CXXCPP
   C_COMPILER=$CXX

appears to kick in only when --enable-cplusplus is part of the configure command, and that doesn't seem to be the case in your configuration command.
Am I missing something?
And, I'm curious, was that patch applied across several (or many) packages? I can't imagine that this problem is unique to Gambit.

@thchha
Copy link

thchha commented Oct 8, 2023

Sorry, You are absolutely right. I did not carefully read about the patch and referred to something not carefully inspected. I am not able to say if this patch was applied across different packages. It makes sense that this would be a problem across multiple programs linking to the math library.
May I be of assistance?

I just build and installed gambit on a new system and made sure I am on a commit which incorporates the linked fix. The error is relevant to me and the workaround was still required.

I am unable to interpret the changes on the file ./configure. Sorry.

@gambiteer
Copy link
Collaborator

Well, I have to apologize, I should have tried it before commenting, because it does fix the problem, but I have no understanding why.

Marc, do you want to put this in, maybe without fully understanding it?

@gambiteer
Copy link
Collaborator

I just tested the debian "fix" with --enable-cplusplus, and it works.
So it works with and without --enable-cplusplus.

@gambiteer gambiteer reopened this Oct 11, 2023
@gambiteer
Copy link
Collaborator

I'm going to install the Debian patch soon unless I hear otherwise.

@thchha
Copy link

thchha commented Oct 17, 2023

I compared the ./configures with/-out --LIBS='lm' but I couldn't make sense of it so I omitted a reply.
The left side shows the file when the workaround-argument is supplied. The right side appears to me as a hobby enthusiast to be c++ reliant.

  if test "$ENABLE_CPLUSPLUS" = yes; then                                                      |  if test "$ENABLE_CPLUSPLUS" = yes; then
                                                                                               |
    #AC_LANG(C++)                                                                              |    ac_ext=cpp
  ---------------------------------------------------------------------------------------------|  ac_cpp='$CXXCPP $CPPFLAGS'
  ---------------------------------------------------------------------------------------------|  ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
  ---------------------------------------------------------------------------------------------|  ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
  ---------------------------------------------------------------------------------------------|  ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
  ---------------------------------------------------------------------------------------------|

Further down the file, I found just one reference to a missing reference: asin

  /* Override any GCC internal prototype to avoid an error.                                  |  namespace conftest {
     Use char because int might match the return type of a GCC                               |    extern "C" int asin ();
     builtin and then its argument prototype would still apply.  */                          |  }
  char asin ();                                                                              |  -----------------------------------------------------------------------------------------------
  int                                                                                        |  int
  main (void)                                                                                |  main (void)
  {                                                                                          |  {
  return asin ();                                                                            |  return conftest::asin ();
    ;                                                                                        |    ;
    return 0;                                                                                |    return 0;
  }                                                                                          |  }
  _ACEOF                                                                                     |  _ACEOF

If I can assist, let me know.

@gambiteer
Copy link
Collaborator

gambiteer commented Oct 17, 2023

I compared the ./configures with/-out --LIBS='lm' but I couldn't make sense of it so I omitted a reply. The left side shows the file when the workaround-argument is supplied. The right side appears to me as a hobby enthusiast to be c++ reliant.

What do you mean "when the workaround-argument is supplied"? What's the "workaround-argument"?

  if test "$ENABLE_CPLUSPLUS" = yes; then                                                      |  if test "$ENABLE_CPLUSPLUS" = yes; then
                                                                                               |
    #AC_LANG(C++)                                                                              |    ac_ext=cpp
  ---------------------------------------------------------------------------------------------|  ac_cpp='$CXXCPP $CPPFLAGS'
  ---------------------------------------------------------------------------------------------|  ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
  ---------------------------------------------------------------------------------------------|  ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
  ---------------------------------------------------------------------------------------------|  ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
  ---------------------------------------------------------------------------------------------|

Where did the lines on the right come from? Did you compose them? or get them from somewhere?
Are you saying that that the stuff on the right should be needed in configure.ac if AC_LANG(C++) is removed?

Further down the file, I found just one reference to a missing reference: asin

  /* Override any GCC internal prototype to avoid an error.                                  |  namespace conftest {
     Use char because int might match the return type of a GCC                               |    extern "C" int asin ();
     builtin and then its argument prototype would still apply.  */                          |  }
  char asin ();                                                                              |  -----------------------------------------------------------------------------------------------
  int                                                                                        |  int
  main (void)                                                                                |  main (void)
  {                                                                                          |  {
  return asin ();                                                                            |  return conftest::asin ();
    ;                                                                                        |    ;
    return 0;                                                                                |    return 0;
  }                                                                                          |  }
  _ACEOF                                                                                     |  _ACEOF

If I can assist, let me know.

I don't understand this either. Why is asin declared as char asin() on the left?

After removing AC_LANG(C++) from configure.ac, running autoconf to rebuild configure, and everything worked fine with and without --enable-cplusplus.

@thchha
Copy link

thchha commented Oct 18, 2023

I compared the ./configures with/-out --LIBS='lm' but I couldn't make sense of it so I omitted a reply. The left side shows the file when the workaround-argument is supplied. The right side appears to me as a hobby enthusiast to be c++ reliant.

What do you mean "when the workaround-argument is supplied"? What's the "workaround-argument"?

$ rm -rf boot/ gsc-boot
$ ./configure LIBS='-lm' --prefix=/home/tomes/runenv/gambit --enable-single-host --enable-targets= --enable-bignum --enable-ratnum --enable-poll

After running this my configure looks like the left side.
Omitting LIBS='-lm' results in the right side.
By configure, i mean the literal file within the root of the project.

  if test "$ENABLE_CPLUSPLUS" = yes; then                                                      |  if test "$ENABLE_CPLUSPLUS" = yes; then
                                                                                               |
    #AC_LANG(C++)                                                                              |    ac_ext=cpp
  ---------------------------------------------------------------------------------------------|  ac_cpp='$CXXCPP $CPPFLAGS'
  ---------------------------------------------------------------------------------------------|  ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
  ---------------------------------------------------------------------------------------------|  ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
  ---------------------------------------------------------------------------------------------|  ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
  ---------------------------------------------------------------------------------------------|

Where did the lines on the right come from? Did you compose them? or get them from somewhere? Are you saying that that the stuff on the right should be needed in configure.ac if AC_LANG(C++) is removed?

I did not want to imply anything. I just noted that without supplying the LIBS=...-argument, my ./configure (after deleting the directories beforehand) look like the right side.

Further down the file, I found just one reference to a missing reference: asin

  /* Override any GCC internal prototype to avoid an error.                                  |  namespace conftest {
     Use char because int might match the return type of a GCC                               |    extern "C" int asin ();
     builtin and then its argument prototype would still apply.  */                          |  }
  char asin ();                                                                              |  -----------------------------------------------------------------------------------------------
  int                                                                                        |  int
  main (void)                                                                                |  main (void)
  {                                                                                          |  {
  return asin ();                                                                            |  return conftest::asin ();
    ;                                                                                        |    ;
    return 0;                                                                                |    return 0;
  }                                                                                          |  }
  _ACEOF                                                                                     |  _ACEOF

If I can assist, let me know.

I don't understand this either. Why is asin declared as char asin() on the left?

I am unable to make sense of it either. I just wanted to leave my last attempt so that maybe someone has an idea.

After removing AC_LANG(C++) from configure.ac, running autoconf to rebuild configure, and everything worked fine with and without --enable-cplusplus.

As long as it works across the supported operating systems it should be fine then.

gambiteer added a commit that referenced this issue Oct 28, 2023
I tested it both with and without --enable-cplusplus.
@gambiteer
Copy link
Collaborator

Hopefully fixed with 79e5c51

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants