0

Trying to use g++-7 with cmake, however, when compiling my g++-7 install is trying to use anaconda's make

base) annaleigh-MacBook-Pro:build annaleigh$ brew reinstall gcc@7
==> Reinstalling gcc@7 
==> Downloading https://homebrew.bintray.com/bottles/gcc@7-7.5.0_1.mojave.bottle.tar.gz
Already downloaded: /Users/annaleigh/Library/Caches/Homebrew/downloads/41befd66234ffc03ad4373f51e4c4f87348872de396ac16a79f0a111966ad857--gcc@7-7.5.0_1.mojave.bottle.tar.gz
==> Pouring gcc@7-7.5.0_1.mojave.bottle.tar.gz
  /usr/local/Cellar/gcc@7/7.5.0_1: 1,402 files, 254.7MB
(base) annaleigh-MacBook-Pro:build annaleigh$ cmake ../source -DCMAKE_CXX_COMPILER=/usr/local/bin/g++-7 
-- The CXX compiler identification is GNU 7.5.0
-- Checking whether CXX compiler has -isysroot
-- Checking whether CXX compiler has -isysroot - yes
-- Checking whether CXX compiler supports OSX deployment target flag
-- Checking whether CXX compiler supports OSX deployment target flag - yes
-- Check for working CXX compiler: /usr/local/bin/g++-7
-- Check for working CXX compiler: /usr/local/bin/g++-7 -- broken
CMake Error at /usr/local/Cellar/cmake/3.16.4/share/cmake/Modules/CMakeTestCXXCompiler.cmake:53 (message):
  The C++ compiler

    "/usr/local/bin/g++-7"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /Users/annaleigh/Documents/GitHub/delabel/tutorial/build/CMakeFiles/CMakeTmp

    Run Build Command(s):/usr/bin/make cmTC_5cede/fast && /Library/Developer/CommandLineTools/usr/bin/make -f CMakeFiles/cmTC_5cede.dir/build.make CMakeFiles/cmTC_5cede.dir/build
    Building CXX object CMakeFiles/cmTC_5cede.dir/testCXXCompiler.cxx.o
    /usr/local/bin/g++-7    -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -stdlib=libc++ -fvisibility-inlines-hidden -std=c++14 -fmessage-length=0    -o CMakeFiles/cmTC_5cede.dir/testCXXCompiler.cxx.o -c /Users/annaleigh/Documents/GitHub/delabel/tutorial/build/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
    g++-7: error: unrecognized command line option '-stdlib=libc++'
    make[1]: *** [CMakeFiles/cmTC_5cede.dir/testCXXCompiler.cxx.o] Error 1
    make: *** [cmTC_5cede/fast] Error 2

I've installed g++7 with brew brew reinstall gcc@7

How can I get my g++7 to use the correct make?

Al Bro
  • 383
  • 5
  • 15
  • Does this answer your question? [unrecognized command line option '-stdlib=libc++' gcc (Homebrew gcc 5.3.0) 5.3.0](https://stackoverflow.com/questions/34654682/unrecognized-command-line-option-stdlib-libc-gcc-homebrew-gcc-5-3-0-5-3-0) – Kevin Feb 25 '20 at 18:31
  • You might try setting your C++ compiler to clang before running the command: `CXX=clang++ brew reinstall gcc@7` – Kevin Feb 25 '20 at 18:35
  • You might need g++-7-multilib – JoeManiaci Feb 25 '20 at 19:47
  • @JoeManiaci what is that? Immediate googling comes up with an ubuntu forum. – Al Bro Feb 25 '20 at 19:51
  • @squareskittles does not resolve problem, but this might be a problem further with the SeqAn3 library I'm trying to compile.... – Al Bro Feb 25 '20 at 19:52
  • @AlBro I'm typically in a linux environment and I've had issues in the past where gcc-7/g++-7 installation wasn't enough. It typically shows up with an error about a std header missing and installing g__-7-multilib resolves it. I've never really dug in to see how it changed things. – JoeManiaci Feb 25 '20 at 20:05

0 Answers0