Error when linking on MacOS
Closed this issue · 6 comments
We have a linking problem on MacOS as the compiler tries to link with the (deprecated) rt library (see attached complete log)
flandrs@umr5558-c02xk0ztjgh7 kalign-master % make
Making all in src
/Library/Developer/CommandLineTools/usr/bin/make all-am
gcc -DHAVE_CONFIG_H -I. -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -maes -mavx -mfma -mavx2 -O3 -std=gnu11 -D_FORTIFY_SOURCE=2 -ffunction-sections -fdata-sections -MT tldevel.o -MD -MP -MF .deps/tldevel.Tpo -c -o tldevel.o tldevel.c
mv -f .deps/tldevel.Tpo .deps/tldevel.Po
gcc -DHAVE_CONFIG_H -I. -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -maes -mavx -mfma -mavx2 -O3 -std=gnu11 -D_FORTIFY_SOURCE=2 -ffunction-sections -fdata-sections -MT time_and_score_aln.o -MD -MP -MF .deps/time_and_score_aln.Tpo -c -o time_and_score_aln.o time_and_score_aln.c
mv -f .deps/time_and_score_aln.Tpo .deps/time_and_score_aln.Po
gcc -DHAVE_CONFIG_H -I. -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -maes -mavx -mfma -mavx2 -O3 -std=gnu11 -D_FORTIFY_SOURCE=2 -ffunction-sections -fdata-sections -MT parameters.o -MD -MP -MF .deps/parameters.Tpo -c -o parameters.o parameters.c
mv -f .deps/parameters.Tpo .deps/parameters.Po
gcc -DHAVE_CONFIG_H -I. -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -maes -mavx -mfma -mavx2 -O3 -std=gnu11 -D_FORTIFY_SOURCE=2 -ffunction-sections -fdata-sections -MT alphabet.o -MD -MP -MF .deps/alphabet.Tpo -c -o alphabet.o alphabet.c
mv -f .deps/alphabet.Tpo .deps/alphabet.Po
gcc -DHAVE_CONFIG_H -I. -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -maes -mavx -mfma -mavx2 -O3 -std=gnu11 -D_FORTIFY_SOURCE=2 -ffunction-sections -fdata-sections -MT rwalign.o -MD -MP -MF .deps/rwalign.Tpo -c -o rwalign.o rwalign.c
mv -f .deps/rwalign.Tpo .deps/rwalign.Po
gcc -DHAVE_CONFIG_H -I. -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -maes -mavx -mfma -mavx2 -O3 -std=gnu11 -D_FORTIFY_SOURCE=2 -ffunction-sections -fdata-sections -MT misc.o -MD -MP -MF .deps/misc.Tpo -c -o misc.o misc.c
mv -f .deps/misc.Tpo .deps/misc.Po
/bin/sh ../libtool --tag=CC --mode=link gcc -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -maes -mavx -mfma -mavx2 -O3 -std=gnu11 -D_FORTIFY_SOURCE=2 -ffunction-sections -fdata-sections -Wl,-dead_strip -Wno-undef -o timescorealn tldevel.o time_and_score_aln.o parameters.o alphabet.o rwalign.o misc.o -lpthread -lm -lrt
libtool: link: gcc -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -maes -mavx -mfma -mavx2 -O3 -std=gnu11 -D_FORTIFY_SOURCE=2 -ffunction-sections -fdata-sections -Wl,-dead_strip -Wno-undef -o timescorealn tldevel.o time_and_score_aln.o parameters.o alphabet.o rwalign.o misc.o -lpthread -lm -lrt
ld: library not found for -lrt <<<<————————————— !!!!
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [timescorealn] Error 1
make[1]: *** [all] Error 2
make: *** [all-recursive] Error 1
I apologise for the lack of information
We have tried to compile version 3.2.0 and here we got the "ld: library not found for -lrt during the linking phase." error.
However I just tried the 3.1.1 version and it compiles well, either with gcc-9 or Apple clang version 11.0.0
So the problem occurs with the master version
Thanks for reporting.
I removed the -lrt flag and instead added the corresponding test to configure.ac.
Could you check out the master branch and see if the problem is still there? Unfortunately I don't have a machine running MacOS...
Thank you for your work !
Compiling works without any warning
unfortunately I obtain an error during "make check"
Making check in dev
/Applications/Xcode.app/Contents/Developer/usr/bin/make check-TESTS
Running kalign basic io test:
a2m.good.1
read/writea2m.good.1 FAILED
with ERROR 139 and Message:
[2020-02-22 07:12:30] : LOG : Start io tests.
[2020-02-22 07:12:30] : LOG : reading: ../dev/data//a2m.good.1
[2020-02-22 07:12:30] : LOG : Detected protein sequences.
[2020-02-22 07:12:30] : LOG : Done reading input sequences in 0.001159 seconds.
[2020-02-22 07:12:30] : LOG : Writing in Clustal format
[2020-02-22 07:12:30] : LOG : 153
FAIL: run_io_test.sh
1 of 1 test failed
make[2]: *** [check-TESTS] Error 1
make[1]: *** [check-am] Error 2
make: *** [check-recursive] Error 1
BUT ... it works
I tested it like this
src/kalign -i ../UL3_prot_nonparalog_Myco.fst -o ../UL3_prot_nonparalog_Myco.aln
and alignment is correct (8245 sequences of length ~300 AA positions)
Thanks for spotting this! The error was in one of the test drivers not the actual kalign code. I fixed this now (v3.2.2) and added another test.
Great - thanks for getting back to me and I'll keep your offer to test future versions in mind.