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

multiple compiler issue #96

Closed
kemin711 opened this issue May 28, 2014 · 2 comments
Closed

multiple compiler issue #96

kemin711 opened this issue May 28, 2014 · 2 comments

Comments

@kemin711
Copy link

When I have multiple compilers, the make step fails.
It seems that cmake finds the compiler in /usr/bin

I configured my computer to have /usr/local/bin before /usr/bin in the PATH environment variable.

[~/Downloads/bamtools-master/build]$ cmake ..
-- The C compiler identification is GNU 4.4.7
-- The CXX compiler identification is GNU 4.4.7
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/zhouke/Downloads/bamtools-master/build

But the make process is using the newer version of gcc 4.8.1 and is having trouble.

[~/Downloads/bamtools-master/build]$ make
Scanning dependencies of target SharedHeaders
[ 1%] Exporting SharedHeaders
[ 1%] Built target SharedHeaders
Scanning dependencies of target APIHeaders
[ 2%] Exporting APIHeaders
[ 2%] Built target APIHeaders
Scanning dependencies of target AlgorithmsHeaders
[ 3%] Exporting AlgorithmsHeaders
[ 3%] Built target AlgorithmsHeaders
Scanning dependencies of target BamTools
[ 4%] Building CXX object src/api/CMakeFiles/BamTools.dir/BamAlignment.cpp.o
In file included from /home/zhouke/Downloads/bamtools-master/src/api/BamAux.h:14,
from /home/zhouke/Downloads/bamtools-master/src/api/BamAlignment.h:14,
from /home/zhouke/Downloads/bamtools-master/src/api/BamAlignment.cpp:10:
/usr/local/include/c++/4.8.1/cstring:71: error: expected ‘{’ before ‘_GLIBCXX_VISIBILITY’
/usr/local/include/c++/4.8.1/cstring:71: error: expected constructor, destructor, or type conversion before ‘(’ token
In file included from /usr/local/include/c++/4.8.1/bits/stringfwd.h:40,
from /usr/local/include/c++/4.8.1/iosfwd:39,
from /usr/local/include/c++/4.8.1/ios:38,
from /usr/local/include/c++/4.8.1/istream:38,
from /usr/local/include/c++/4.8.1/fstream:38,
from /home/zhouke/Downloads/bamtools-master/src/api/BamAux.h:15,
from /home/zhouke/Downloads/bamtools-master/src/api/BamAlignment.h:14,
from /home/zhouke/Downloads/bamtools-master/src/api/BamAlignment.cpp:10:
/usr/local/include/c++/4.8.1/bits/memoryfwd.h:50: error: expected ‘{’ before ‘_GLIBCXX_VISIBILITY’
/usr/local/include/c++/4.8.1/bits/memoryfwd.h:50: error: expected constructor, destructor, or type conversion before ‘(’ token
In file included from /usr/local/include/c++/4.8.1/iosfwd:39,
from /usr/local/include/c++/4.8.1/ios:38,
from /usr/local/include/c++/4.8.1/istream:38,
from /usr/local/include/c++/4.8.1/fstream:38,
from /home/zhouke/Downloads/bamtools-master/src/api/BamAux.h:15,
from /home/zhouke/Downloads/bamtools-master/src/api/BamAlignment.h:14,
from /home/zhouke/Downloads/bamtools-master/src/api/BamAlignment.cpp:10:
/usr/local/include/c++/4.8.1/bits/stringfwd.h:42: error: expected ‘{’ before ‘_GLIBCXX_VISIBILITY’
/usr/local/include/c++/4.8.1/bits/stringfwd.h:42: error: expected constructor, destructor, or type conversion before ‘(’ token
In file included from /usr/local/include/c++/4.8.1/bits/postypes.h:40,
from /usr/local/include/c++/4.8.1/iosfwd:40,
from /usr/local/include/c++/4.8.1/ios:38,
from /usr/local/include/c++/4.8.1/istream:38,
from /usr/local/include/c++/4.8.1/fstream:38,
from /home/zhouke/Downloads/bamtools-master/src/api/BamAux.h:15,
from /home/zhouke/Downloads/bamtools-master/src/api/BamAlignment.h:14,
from /home/zhouke/Downloads/bamtools-master/src/api/BamAlignment.cpp:10:
/usr/local/include/c++/4.8.1/cwchar:64: error: ‘::mbstate_t’ has not been declared
/usr/local/include/c++/4.8.1/cwchar:135: error: expected ‘{’ before ‘_GLIBCXX_VISIBILITY’
/usr/local/include/c++/4.8.1/cwchar:135: error: expected constructor, destructor, or type conversion before ‘(’ token
/usr/local/include/c++/4.8.1/cwchar:248: error: ‘::wcstold’ has not been declared
/usr/local/include/c++/4.8.1/cwchar:257: error: ‘::wcstoll’ has not been declared
/usr/local/include/c++/4.8.1/cwchar:258: error: ‘::wcstoull’ has not been declared
/usr/local/include/c++/4.8.1/cwchar:264: error: ‘::__gnu_cxx’ has not been declared
/usr/local/include/c++/4.8.1/cwchar:265: error: ‘::__gnu_cxx’ has not been declared
/usr/local/include/c++/4.8.1/cwchar:266: error: ‘::__gnu_cxx’ has not been declared
In file included from /usr/local/include/c++/4.8.1/iosfwd:40,
from /usr/local/include/c++/4.8.1/ios:38,
from /usr/local/include/c++/4.8.1/istream:38,
from /usr/local/include/c++/4.8.1/fstream:38,
from /home/zhouke/Downloads/bamtools-master/src/api/BamAux.h:15,
from /home/zhouke/Downloads/bamtools-master/src/api/BamAlignment.h:14,
from /home/zhouke/Downloads/bamtools-master/src/api/BamAlignment.cpp:10:
/usr/local/include/c++/4.8.1/bits/postypes.h:68: error: expected ‘{’ before ‘_GLIBCXX_VISIBILITY’
/usr/local/include/c++/4.8.1/bits/postypes.h:68: error: expected constructor, destructor, or type conversion before ‘(’ token
In file included from /usr/local/include/c++/4.8.1/ios:39,
from /usr/local/include/c++/4.8.1/istream:38,
from /usr/local/include/c++/4.8.1/fstream:38,
from /home/zhouke/Downloads/bamtools-master/src/api/BamAux.h:15,
from /home/zhouke/Downloads/bamtools-master/src/api/BamAlignment.h:14,
from /home/zhouke/Downloads/bamtools-master/src/api/BamAlignment.cpp:10:
/usr/local/include/c++/4.8.1/exception:35: error: expected ‘}’ before end of line
/usr/local/include/c++/4.8.1/exception:35: error: expected ‘}’ before end of line
/usr/local/include/c++/4.8.1/exception:35: error: expected ‘}’ before end of line
/usr/local/include/c++/4.8.1/exception:35: error: expected ‘}’ before end of line
/usr/local/include/c++/4.8.1/exception:35: error: expected ‘}’ before end of line
/usr/local/include/c++/4.8.1/exception:35: error: expected declaration before end of line
make[2]: *** [src/api/CMakeFiles/BamTools.dir/BamAlignment.cpp.o] Error 1
make[1]: *** [src/api/CMakeFiles/BamTools.dir/all] Error 2
make: *** [all] Error 2

I am not sure these errors are caused by the source code of bamtools not compatible with the newer versions of GCC or what. I am not an expert in cmake. Any one can help here?

@leecbaker
Copy link
Contributor

CMake defaults to using the compiler at /usr/bin/c++. To select a different compiler, you'll want to set environment variables when calling CMake. Something like this should work:

 CC=/usr/local/bin/gcc CXX=/usr/local/bin/g++ cmake ..

Substitute in the path for the compiler you want to actually use. The CC variable specifies the C compiler, while the CXX variable specifies the C++ compiler.

@kemin711
Copy link
Author

kemin711 commented Nov 8, 2015

Multi compiler does pose a big problem. This is not particular to bamtools. It is related to cmake. I had a situation when bamtools is made with compiler GCC 4.8. when I compile and link with GCC 5.2 I got linking errors:
-L/usr/local/lib/bamtools -lbamtools The LDFLAGS are set properly, and this used to work fine.
So the above posting is very useful to relieve this problem.

@SoapZA SoapZA closed this as completed in 801f2d1 Oct 23, 2017
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