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

Error while linking CXX shared library libshogun.so #4393

Closed
admanero opened this issue Aug 19, 2018 · 5 comments
Closed

Error while linking CXX shared library libshogun.so #4393

admanero opened this issue Aug 19, 2018 · 5 comments
Labels

Comments

@admanero
Copy link

I pulled shogun from github. In Fedora28

Followed the instruction here http://shogun.ml/install#manual
I used the following cmake command
(14:15 admanero@Yoga2Pro-Fedora28 build) > cmake -DPYTHON_INCLUDE_DIR=/usr/include/python3.6m -DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/python3 -DPYTHON_PACKAGES_PATH=/usr/local/lib/python3.6/site-packages/ -DINTERFACE_PYTHON=ON -DINTERFACE_OCTAVE=ON -DLICENSE_GPL_SHOGUN=OFF -DUSE_SVMLIGHT=OFF -DOpenCV=ON ..

during make there were errors because cmake had not found the correct path to some of the libraries. I manually edited the CMakeCache.txt file to point out to the right location for some of the libraries or modify the *.cmake files (in PERL case) to help the cmake get the right locations for library requirements. And then I've encountered this error which has left me puzzled.
Doing make clean and doing git submodule update --init doesn' t solve this issue. Any indication on how to get pass this hurdle would be much appreciated. Thanks for reading.

(14:17 admanero@Yoga2Pro-Fedora28 shogun) > make -j 4
...
[ 85%] Built target libshogun
[ 85%] Linking CXX shared library libshogun.so
[ 85%] Built target meta_examples
/usr/bin/ld.gold: error: CMakeFiles/libshogun.dir/CMakeFiles/3.11.0/CompilerIdC/CMakeCCompilerId.c.o: multiple definition of 'main'
/usr/bin/ld.gold: CMakeFiles/libshogun.dir/CMakeFiles/3.11.0/CompilerIdCXX/CMakeCXXCompilerId.cpp.o: previous definition here
/usr/bin/ld.gold: error: CMakeFiles/libshogun.dir/CMakeFiles/3.11.0/CompilerIdC/CMakeCCompilerId.c.o: multiple definition of 'info_compiler'
/usr/bin/ld.gold: CMakeFiles/libshogun.dir/CMakeFiles/3.11.0/CompilerIdCXX/CMakeCXXCompilerId.cpp.o: previous definition here
/usr/bin/ld.gold: error: CMakeFiles/libshogun.dir/CMakeFiles/3.11.0/CompilerIdC/CMakeCCompilerId.c.o: multiple definition of 'info_platform'
/usr/bin/ld.gold: CMakeFiles/libshogun.dir/CMakeFiles/3.11.0/CompilerIdCXX/CMakeCXXCompilerId.cpp.o: previous definition here
/usr/bin/ld.gold: error: CMakeFiles/libshogun.dir/CMakeFiles/3.11.0/CompilerIdC/CMakeCCompilerId.c.o: multiple definition of 'info_arch'
/usr/bin/ld.gold: CMakeFiles/libshogun.dir/CMakeFiles/3.11.0/CompilerIdCXX/CMakeCXXCompilerId.cpp.o: previous definition here
/usr/bin/ld.gold: error: CMakeFiles/libshogun.dir/CMakeFiles/3.11.0/CompilerIdC/CMakeCCompilerId.c.o: multiple definition of 'info_language_dialect_default'
/usr/bin/ld.gold: CMakeFiles/libshogun.dir/CMakeFiles/3.11.0/CompilerIdCXX/CMakeCXXCompilerId.cpp.o: previous definition here
/usr/bin/ld.gold: error: CMakeFiles/libshogun.dir/CMakeFiles/feature_tests.c.o: multiple definition of 'main'
/usr/bin/ld.gold: CMakeFiles/libshogun.dir/CMakeFiles/3.11.0/CompilerIdCXX/CMakeCXXCompilerId.cpp.o: previous definition here
/usr/bin/ld.gold: error: CMakeFiles/libshogun.dir/CMakeFiles/hdf5/cmake_hdf5_test.c.o: multiple definition of 'main'
/usr/bin/ld.gold: CMakeFiles/libshogun.dir/CMakeFiles/3.11.0/CompilerIdCXX/CMakeCXXCompilerId.cpp.o: previous definition here
collect2: error: ld returned 1 exit status
make[2]: *** [src/shogun/CMakeFiles/shogun.dir/build.make:1416: src/shogun/libshogun.so.18.0] Error 1
make[1]: *** [CMakeFiles/Makefile2:96: src/shogun/CMakeFiles/shogun.dir/all] Error 2
make: *** [Makefile:152: all] Error 2

@luoagnes
Copy link

I met the same problem, the error info is:

Scanning dependencies of target libshogun
[ 1%] Building CXX object src/shogun/CMakeFiles/libshogun.dir/base/Parallel.cpp.o
In file included from /shogun/src/shogun/lib/common.h:80:0,
from /shogun/src/shogun/base/Parallel.h:13,
from /shogun/src/shogun/base/Parallel.cpp:8:
/shogun/src/shogun/lib/memory.h:106:25: error: ‘std::enable_if_t’ has not been declared
template <class T, std::enable_if_t<!is_sg_referenced::value, T>* = nullptr>
^
/shogun/src/shogun/lib/memory.h:106:36: error: expected ‘>’ before ‘<’ token
template <class T, std::enable_if_t<!is_sg_referenced::value, T>* = nullptr>
^
/shogun/src/shogun/lib/memory.h:112:24: error: ‘std::enable_if_t’ has not been declared
template<class T, std::enable_if_t<is_sg_referenced::value, T>* = nullptr>
^
/shogun/src/shogun/lib/memory.h:112:35: error: expected ‘>’ before ‘<’ token
template<class T, std::enable_if_t<is_sg_referenced::value, T>* = nullptr>
^
/shogun/src/shogun/lib/memory.h:113:4: error: redefinition of ‘template<class T, int > T* shogun::sg_generic_malloc(size_t)’
T* sg_generic_malloc(size_t len)
^
/shogun/src/shogun/lib/memory.h:107:4: error: ‘template<class T, int > T* shogun::sg_generic_malloc(size_t)’ previously declared here
T* sg_generic_malloc(size_t len)
^
/shogun/src/shogun/lib/memory.h:119:24: error: ‘std::enable_if_t’ has not been declared
template<class T, std::enable_if_t<!is_sg_referenced::value, T>* = nullptr>
^
/shogun/src/shogun/lib/memory.h:119:35: error: expected ‘>’ before ‘<’ token
template<class T, std::enable_if_t<!is_sg_referenced::value, T>* = nullptr>
^
/shogun/src/shogun/lib/memory.h:125:24: error: ‘std::enable_if_t’ has not been declared
template<class T, std::enable_if_t<is_sg_referenced::value, T>* = nullptr>
^
/shogun/src/shogun/lib/memory.h:125:35: error: expected ‘>’ before ‘<’ token
template<class T, std::enable_if_t<is_sg_referenced::value, T>* = nullptr>
^
/shogun/src/shogun/lib/memory.h:126:4: error: redefinition of ‘template<class T, int > T* shogun::sg_generic_realloc(T*, size_t, size_t)’
T* sg_generic_realloc(T* ptr, size_t old_len, size_t len)
^
/shogun/src/shogun/lib/memory.h:120:4: error: ‘template<class T, int > T* shogun::sg_generic_realloc(T*, size_t, size_t)’ previously declared here
T* sg_generic_realloc(T* ptr, size_t old_len, size_t len)
^
/shogun/src/shogun/lib/memory.h:139:24: error: ‘std::enable_if_t’ has not been declared
template<class T, std::enable_if_t<!is_sg_referenced::value, T>* = nullptr>
^
/shogun/src/shogun/lib/memory.h:139:35: error: expected ‘>’ before ‘<’ token
template<class T, std::enable_if_t<!is_sg_referenced::value, T>* = nullptr>
^
/shogun/src/shogun/lib/memory.h:145:24: error: ‘std::enable_if_t’ has not been declared
template<class T, std::enable_if_t<is_sg_referenced::value, T>* = nullptr>
^
/shogun/src/shogun/lib/memory.h:145:35: error: expected ‘>’ before ‘<’ token
template<class T, std::enable_if_t<is_sg_referenced::value, T>* = nullptr>
^
/shogun/src/shogun/lib/memory.h:146:4: error: redefinition of ‘template<class T, int > T* shogun::sg_generic_calloc(size_t)’
T* sg_generic_calloc(size_t len)
^
/shogun/src/shogun/lib/memory.h:140:4: error: ‘template<class T, int > T* shogun::sg_generic_calloc(size_t)’ previously declared here
T* sg_generic_calloc(size_t len)
^
/shogun/src/shogun/lib/memory.h:152:24: error: ‘std::enable_if_t’ has not been declared
template<class T, std::enable_if_t<!is_sg_referenced::value, T>* = nullptr>
^
/shogun/src/shogun/lib/memory.h:152:35: error: expected ‘>’ before ‘<’ token
template<class T, std::enable_if_t<!is_sg_referenced::value, T>* = nullptr>
^
/shogun/src/shogun/lib/memory.h:158:24: error: ‘std::enable_if_t’ has not been declared
template<class T, std::enable_if_t<is_sg_referenced::value, T>* = nullptr>
^
/shogun/src/shogun/lib/memory.h:158:35: error: expected ‘>’ before ‘<’ token
template<class T, std::enable_if_t<is_sg_referenced::value, T>* = nullptr>
^
/shogun/src/shogun/lib/memory.h:159:6: error: redefinition of ‘template<class T, int > void shogun::sg_generic_free(T*)’
void sg_generic_free(T* ptr)
^
/shogun/src/shogun/lib/memory.h:153:6: error: ‘template<class T, int > void shogun::sg_generic_free(T*)’ previously declared here
void sg_generic_free(T* ptr)
^
make[2]: *** [src/shogun/CMakeFiles/libshogun.dir/base/Parallel.cpp.o] Error 1
make[1]: *** [src/shogun/CMakeFiles/libshogun.dir/all] Error 2
make: *** [all] Error 2

how to solve it ?

@vinx13
Copy link
Member

vinx13 commented Feb 26, 2019

Hi @luoagnes I think enable_if_t is from c++14, can you try explicitly adding cmake flag -DCMAKE_CXX_FLAGS=-std=c++14

@karlnapf
Copy link
Member

@besser82

@stale
Copy link

stale bot commented Feb 26, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Feb 26, 2020
@stale
Copy link

stale bot commented Mar 4, 2020

This issue is now being closed due to a lack of activity. Feel free to reopen it.

@stale stale bot closed this as completed Mar 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants