BUStools / bustools

Tools for working with BUS files
https://bustools.github.io/
BSD 2-Clause "Simplified" License
92 stars 23 forks source link

Make sure `CC` and `CXX` are defined and exported #2

Closed kevinrue closed 5 years ago

kevinrue commented 5 years ago

An open-and-close issue, just to document it.

Following the instruction to install bustools, I ran into the following error:

$ make
[ 20%] Building CXX object src/CMakeFiles/bustools_core.dir/BUSData.cpp.o
cc1plus: error: unrecognized command line option "-std=c++11"
make[2]: *** [src/CMakeFiles/bustools_core.dir/BUSData.cpp.o] Error 1
make[1]: *** [src/CMakeFiles/bustools_core.dir/all] Error 2

which is a fairly frequently reported error associated with out-of-date gcc (e.g. https://stackoverflow.com/questions/14674597/cc1plus-error-unrecognized-command-line-option-std-c11-with-g).

In my case, cmake was simply picking up the old version of compilers at /usr/bin/cc and /usr/bin/c++ during the cmake .. step of the installation procedure. The solution was to define and export the CC and CXX environment variables as follows

export CC=$(which gcc)
export CC=$(which g++)
# continue installation procedure
cmake ..
make
make install

I hope that helps future users. Thanks for bustools!