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

Build with autotools fails on Ubuntu 16.04 #196

Closed
fidergo-stephane-gourichon opened this issue Jan 11, 2019 · 3 comments
Closed

Build with autotools fails on Ubuntu 16.04 #196

fidergo-stephane-gourichon opened this issue Jan 11, 2019 · 3 comments

Comments

@fidergo-stephane-gourichon

Compilation fails on Ubuntu 16.04 with latest master.

Followed instructions from README.md, including sudo apt-get install autoconf automake libtool libgoogle-glog-dev libgflags-dev libeigen3-dev.

Compilation command line includes -lgtest -lgtest_main but no libgtest.so exists, and no package libgtest.

Error message:

make  all-recursive
make[1]: Entering directory '/somepath'
Making all in src
make[2]: Entering directory '/somepath/src'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/somepath/src'
Making all in tests
make[2]: Entering directory '/somepath/tests'
/bin/bash ../libtool  --tag=CXX   --mode=link clang++ -Wall -Wextra -g -O3  -g -O2 -std=gnu++11 -L../src  -lgtest -lgtest_main  -o simple_test simple-test.o -lcmaes -lm -lglog -lgflags
libtool: link: clang++ -Wall -Wextra -g -O3 -g -O2 -std=gnu++11 -o .libs/simple_test simple-test.o  -L../src -lgtest -lgtest_main /somepath/src/.libs/libcmaes.so -lm -lglog -lgflags
/usr/bin/ld: cannot find -lgtest
/usr/bin/ld: cannot find -lgtest_main
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Makefile:812: recipe for target 'simple_test' failed
make[2]: *** [simple_test] Error 1
/bin/bash ../libtool  --tag=CXX   --mode=link clang++ -Wall -Wextra -g -O3  -g -O2 -std=gnu++11 -L../src  -lgtest -lgtest_main  -o edm edm.o -lcmaes -lm -lglog -lgflags
libtool: link: clang++ -Wall -Wextra -g -O3 -g -O2 -std=gnu++11 -o .libs/edm edm.o  -L../src -lgtest -lgtest_main /somepath/src/.libs/libcmaes.so -lm -lglog -lgflags
/usr/bin/ld: cannot find -lgtest
/usr/bin/ld: cannot find -lgtest_main
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Makefile:808: recipe for target 'edm' failed
make[2]: *** [edm] Error 1
/bin/bash ../libtool  --tag=CXX   --mode=link clang++ -Wall -Wextra -g -O3  -g -O2 -std=gnu++11 -L../src  -lgtest -lgtest_main  -o test_functions test-functions.o -lcmaes -lm -lglog -lgflags
libtool: link: clang++ -Wall -Wextra -g -O3 -g -O2 -std=gnu++11 -o .libs/test_functions test-functions.o  -L../src -lgtest -lgtest_main /somepath/src/.libs/libcmaes.so -lm -lglog -lgflags
/usr/bin/ld: cannot find -lgtest
/usr/bin/ld: cannot find -lgtest_main
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Makefile:820: recipe for target 'test_functions' failed
make[2]: *** [test_functions] Error 1
/bin/bash ../libtool  --tag=CXX   --mode=link clang++ -Wall -Wextra -g -O3  -g -O2 -std=gnu++11 -L../src  -lgtest -lgtest_main  -o tpa_tests tpa-tests.o -lcmaes -lm -lglog -lgflags
libtool: link: clang++ -Wall -Wextra -g -O3 -g -O2 -std=gnu++11 -o .libs/tpa_tests tpa-tests.o  -L../src -lgtest -lgtest_main /somepath/src/.libs/libcmaes.so -lm -lglog -lgflags
/usr/bin/ld: cannot find -lgtest
/usr/bin/ld: cannot find -lgtest_main
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Makefile:824: recipe for target 'tpa_tests' failed
make[2]: *** [tpa_tests] Error 1
/bin/bash ../libtool  --tag=CXX   --mode=link clang++ -Wall -Wextra -g -O3  -g -O2 -std=gnu++11 -L../src  -lgtest -lgtest_main  -o surr_tests surr-tests.o -lcmaes -lm -lglog -lgflags
libtool: link: clang++ -Wall -Wextra -g -O3 -g -O2 -std=gnu++11 -o .libs/surr_tests surr-tests.o  -L../src -lgtest -lgtest_main /somepath/src/.libs/libcmaes.so -lm -lglog -lgflags
/usr/bin/ld: cannot find -lgtest
/usr/bin/ld: cannot find -lgtest_main
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Makefile:816: recipe for target 'surr_tests' failed
make[2]: *** [surr_tests] Error 1
make[2]: Target 'all' not remade because of errors.
make[2]: Leaving directory '/somepath/tests'
Making all in examples
make[2]: Entering directory '/somepath/examples'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/somepath/examples'
make[2]: Entering directory '/somepath'
make[2]: Leaving directory '/somepath'
Makefile:499: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/somepath'
Makefile:387: recipe for target 'all' failed
make: *** [all] Error 2

Commit is

commit 7514782ebe7167c6a889173364c980874ac17b41
Author: Emmanuel Benazera <[email protected]>
Date:   2018-06-25 17:35:51 +0200

    removed default mavx mfma optimisation

Kernel is 4.4.0-139-generic #165-Ubuntu SMP Wed Oct 24 10:58:50 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

@fidergo-stephane-gourichon
Copy link
Author

Complete steps to reproduce:

git clone https://github.com/beniz
cd libcmaes
./autogen.sh
echo "#define CMAES_EXPORT" > cmaes_export.h
./configure
make -k # first time shows error messages and a number of warnings
make -k # second times to only see short list of error messages 

Optionally, add e.g. -j 8 to first make invocation, for quicker build.
Same result.

@beniz
Copy link
Collaborator

beniz commented Jan 11, 2019

Hi, see https://www.eriksmistad.no/getting-started-with-google-test-on-ubuntu/ on installing gtest on Ubuntu. You need to compile and copy the gtest libfiles yourself.

@beniz beniz closed this as completed Jan 11, 2019
@fidergo-stephane-gourichon
Copy link
Author

fidergo-stephane-gourichon commented Jan 11, 2019

Hi, see https://www.eriksmistad.no/getting-started-with-google-test-on-ubuntu/ on installing gtest on Ubuntu. You need to compile and copy the gtest libfiles yourself.

No offense, I did not claim that gtest is magical or had any ludicrous expectation.

Those mentions in README.md:

  • gtest for unit testing (optional);
  • sudo apt-get install autoconf automake libtool libgoogle-glog-dev libgflags-dev libeigen3-dev
  • "Build" instructions
  • "Run examples" instructions

... create the expectation that either gflags/gtest is not needed to run the examples, or the project make the whole process transparent.

I know how to make the process transparent in a CMake setup and can even offer a PR.

Anyway, I only tested the autotools build because the CMake build did not try to build example, see #197.

Perhaps the best thing to do is to fix the README.

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

2 participants