benedictpaten/sonLib — Issue #8: Compile error on Ubuntu
Author: pjoz
Created: 2012-01-03 04:43:17+00:00
State: open

Hi,

I've been working to compile this library to use Cactus under Ubuntu 11.10 to no avail. Following issue #5 raised in September by robsymes, I obtained the same error:

>$ make all
>cd externalTools && make all
>make[1]: Entering directory `/home/ber23w/apps/CACTUS_FILES/benedictpaten-sonLib-194abd1/externalTools'
>cd cutest && make all
>make[2]: Entering directory `/home/ber23w/apps/CACTUS_FILES/benedictpaten-sonLib-194abd1/externalTools/cutest'
>gcc -std=c99 -O3 -g -Wall -Werror --pedantic -funroll-loops -lm -fopenmp -c CuTest.c
>ar rc cuTest.a *.o
>ranlib cuTest.a
>rm -f *.o
>mv cuTest.a ../../lib/
>cp CuTest.h ../../lib/
>make[2]: Leaving directory `/home/ber23w/apps/CACTUS_FILES/benedictpaten-sonLib-194abd1/externalTools/cutest'
>make[1]: Leaving directory `/home/ber23w/apps/CACTUS_FILES/benedictpaten-sonLib-194abd1/externalTools'
>cd C && make all
>make[1]: Entering directory `/home/ber23w/apps/CACTUS_FILES/benedictpaten-sonLib-194abd1/C'
>gcc -std=c99 -O3 -g -Wall -Werror --pedantic -funroll-loops -lm -fopenmp -I/usr/include/mysql -DHAVE_MYSQL=1 -I inc -I ../lib/ -c impl/*.c
>impl/stSafeC.c: In function ‘stSafeCErr’:
>impl/stSafeC.c:26:10: error: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Werror=unused-result]
>impl/stSafeC.c:27:10: error: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Werror=unused-result]
>cc1: all warnings being treated as errors
>
>make[1]: *** [../lib/sonLib.a] Error 1
>make[1]: Leaving directory `/home/ber23w/apps/CACTUS_FILES/benedictpaten-sonLib-194abd1/C'
>make: *** [cP] Error 2`

Based on the suggestion made by Glenn Hickey, I removed the -Werror flag and found I obtained the following new error:

>$ make all
>cd externalTools && make all
>make[1]: Entering directory `/home/ber23w/apps/CACTUS_FILES/benedictpaten-sonLib-194abd1/externalTools'
>cd cutest && make all
>make[2]: Entering directory `/home/ber23w/apps/CACTUS_FILES/benedictpaten-sonLib-194abd1/externalTools/cutest'
>make[2]: Nothing to be done for `all'.
>make[2]: Leaving directory `/home/ber23w/apps/CACTUS_FILES/benedictpaten-sonLib-194abd1/externalTools/cutest'
>make[1]: Leaving directory `/home/ber23w/apps/CACTUS_FILES/benedictpaten-sonLib-194abd1/externalTools'
>cd C && make all
>make[1]: Entering directory `/home/ber23w/apps/CACTUS_FILES/benedictpaten-sonLib-194abd1/C'
>gcc -std=c99 -O3 -g -Wall --pedantic -funroll-loops -lm -fopenmp -I/usr/include/mysql -DHAVE_MYSQL=1 -I inc -I ../lib/ -c >impl/*.c
>impl/stSafeC.c: In function ‘stSafeCErr’:
>impl/stSafeC.c:26:10: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
>impl/stSafeC.c:27:10: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
>g++ -g -Wall -funroll-loops -lm -I inc -I ../lib/ -c impl/*.cpp
>ar rc sonLib.a *.o
>ranlib sonLib.a
>rm *.o
>mv sonLib.a ../lib/
>gcc -std=c99 -O3 -g -Wall --pedantic -funroll-loops -lm -fopenmp -I/usr/include/mysql -DHAVE_MYSQL=1 -I inc -I ../lib -o ../bin/sonLibTests.tmp tests/allTests.c tests/sonLib*.c ../lib/sonLib.a ../lib/cuTest.a -Wl,-Bsymbolic-functions -rdynamic -L/usr/lib/mysql -lmysqlclient -lz -Wl,-Bsymbolic-functions -rdynamic -L/usr/lib/mysql -lmysqlclient
>../lib/sonLib.a(hashTableC.o): In function `create_hashtable':
>/home/ber23w/apps/CACTUS_FILES/benedictpaten-sonLib-194abd1/C/impl/hashTableC.c:61: undefined reference to `ceilf'
>../lib/sonLib.a(hashTableC.o): In function `hashtable_expand':
>/home/ber23w/apps/CACTUS_FILES/benedictpaten-sonLib-194abd1/C/impl/hashTableC.c:132: undefined reference to `ceilf'
>collect2: ld returned 1 exit status
>make[1]: *** [../bin/sonLibTests] Error 1
>make[1]: Leaving directory `/home/ber23w/apps/CACTUS_FILES/benedictpaten-sonLib-194abd1/C'
>make: *** [cP] Error 2

I see the development fork was merged back to the head on 21st December, but have still found this issue. Similar to Rob, I'm not sure if I've missed something simple myself, but would appreciate any advice on how I might correct this.

gcc & kernel version:

>$ gcc -v
>Using built-in specs.
>COLLECT_GCC=gcc
>COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.6.1/lto-wrapper
>Target: x86_64-linux-gnu
>Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.6.1-9ubuntu3' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++,go --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-plugin --enable-objc-gc --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
>Thread model: posix
>gcc version 4.6.1 (Ubuntu/Linaro 4.6.1-9ubuntu3)
>
>$ uname -a
>Linux banks 3.0.0-13-generic #22-Ubuntu SMP Wed Nov 2 13:27:26 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux