LibXtract
LibXtract copied to clipboard
Build error for simpletest calling arc4random_uniform on Ubuntu 12.04
I get an error on Ubuntu 12.04 building "examples/simpletest".
$ ./configure --enable-simpletest
...
$ make
...
make[3]: Entering directory `/home/sim/Downloads/LibXtract/examples/simpletest'
gcc -DHAVE_CONFIG_H -I. -I../.. -I../../src -pedantic -ansi -fno-strict-aliasing -Wall -std=c99 -I/usr/local/include -O3 -MT simpletest.o -MD -MP -MF .deps/simpletest.Tpo -c -o simpletest.o simpletest.c
simpletest.c: In function ‘fill_wavetable’:
simpletest.c:81:17: warning: implicit declaration of function ‘arc4random_uniform’ [-Wimplicit-function-declaration]
mv -f .deps/simpletest.Tpo .deps/simpletest.Po
/bin/bash ../../libtool --tag=CC --mode=link gcc -pedantic -ansi -fno-strict-aliasing -Wall -std=c99 -I/usr/local/include -O3 -lm -o simpletest simpletest.o ../../src/libxtract.la
libtool: link: gcc -pedantic -ansi -fno-strict-aliasing -Wall -std=c99 -I/usr/local/include -O3 -o .libs/simpletest simpletest.o -lm ../../src/.libs/libxtract.so
simpletest.o: In function `fill_wavetable':
simpletest.c:(.text+0x148): undefined reference to `arc4random_uniform'
collect2: ld returned 1 exit status
make[3]: *** [simpletest] Error 1
make[3]: Leaving directory `/home/sim/Downloads/LibXtract/examples/simpletest'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/sim/Downloads/LibXtract/examples'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/sim/Downloads/LibXtract'
make: *** [all] Error 2
It looks like Ubuntu has that in a library called 'libbsd'. But even if I make sure that is installed, it isn't linking to the library.
Ah, good catch! I'll fix tomorrow. For now, to make it work, you should be able to build with make LDFLAGS="-lbsd"
My building skills have gotten a bit rusty so I wasn't sure how to get that going... And your fix does work:
$ LDFLAGS="-lbsd" ./configure --enable-simpletest
And then the build went fine, and simpletest runs.
Thanks, Sim
On Tue, Nov 26, 2013 at 4:04 PM, Jamie Bullock [email protected]:
Ah, good catch! I'll fix tomorrow. For now, to make it work, you should be able to build with make LDFLAGS="-lbsd"
— Reply to this email directly or view it on GitHubhttps://github.com/jamiebullock/LibXtract/issues/42#issuecomment-29333725 .
hi.. i have tried the above mentioned fix and got an error like this -
hari@hari:~/LibXtract$ make LDFLAGS="-lbsd"
make all-recursive
make[1]: Entering directory /home/hari/LibXtract' Making all in src make[2]: Entering directory/home/hari/LibXtract/src'
make[2]: Nothing to be done for all'. make[2]: Leaving directory/home/hari/LibXtract/src'
Making all in xtract
make[2]: Entering directory /home/hari/LibXtract/xtract' make[2]: Nothing to be done forall'.
make[2]: Leaving directory /home/hari/LibXtract/xtract' Making all in examples make[2]: Entering directory/home/hari/LibXtract/examples'
Making all in simpletest
make[3]: Entering directory /home/hari/LibXtract/examples/simpletest' /bin/bash ../../libtool --tag=CC --mode=link gcc -pedantic -ansi -fno-strict-aliasing -Wall -std=c99 -I/usr/local/include -O3 -lbsd -o simpletest simpletest.o ../../src/libxtract.la libtool: link: gcc -pedantic -ansi -fno-strict-aliasing -Wall -std=c99 -I/usr/local/include -O3 -o .libs/simpletest simpletest.o -lbsd ../../src/.libs/libxtract.so /usr/bin/ld: simpletest.o: undefined reference to symbol 'sin@@GLIBC_2.2.5' /lib/x86_64-linux-gnu/libm.so.6: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status make[3]: *** [simpletest] Error 1 make[3]: Leaving directory/home/hari/LibXtract/examples/simpletest'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory /home/hari/LibXtract/examples' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory/home/hari/LibXtract'
make: *** [all] Error 2