I am trying to build the software package Trilinos, and I think it failed because it couldn't locate the C compiler directory correctly. Can anyone tell what the correct location of gcc is on my Ubuntu 16.04 computer? I actually need the C, C++ and fortran directory locations.

I am using the build script:

cmake \
-DCMAKE_C_COMPILER=<path to C compiler> \
-DCMAKE_CXX_COMPILER=<path to C++ compiler> \
-DCMAKE_Fortran_COMPILER=<path to Fortran compiler> \
-DCMAKE_INSTALL_PATH=<path to install Trilinos into> \
<path to Trilinos source>

make -j<n> install

I used directories:

<path to C compiler> = /usr/bin
<path to C++ compiler> = /usr/bin
<path to Fortran compiler> = /usr/bin

I assume C is gcc-5, C++ is g++-5 and fortran is gfortran-5?

Should the directory be /usr/lib/gcc/x86_64-linux-gnu from Linux C Compiler?

The cmake build gave error message (end part of build output):

-- The C compiler identification is unknown
-- Check for working C compiler: /usr/bin
-- Check for working C compiler: /usr/bin -- broken
CMake Error at /usr/share/cmake-3.5/Modules/CMakeTestCCompiler.cmake:61 (message):
  The C compiler "/usr/bin" is not able to compile a simple test program.

The path requires the full path including filename, using:

which gcc

which g++
  • If you use bash (which you probably do), type is often better than which. which is an external command that does not have any knowledge of your shell environment, so cannot respond to e.g. shell builtins or functions, but type is a shell builtin so can. type is also more explicit when the given command isn't found; which prints nothing, but type responds with a "not found". – a CVn Mar 14 '17 at 16:10

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.