The C compiler "/usr/bin/cc" is not able to compile a simple test program.

classic Classic list List threaded Threaded
5 messages Options
hce
Reply | Threaded
Open this post in threaded view
|

The C compiler "/usr/bin/cc" is not able to compile a simple test program.

hce
Hi,

How can I set up the cmake not to check /usr/bin/cc but to check $CC (which link to gcc without hard corded path in the environment)?

Thank you.

Regards



--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
hce
Reply | Threaded
Open this post in threaded view
|

Re: The C compiler "/usr/bin/cc" is not able to compile a simple test program.

hce
I thought if I add -DCMAKE_CC_COMPILER=gcc that error should go, no, it still compile with the specific default cc:

/usr/bin/cc ....

How could I fix it?

Thank you.

On Sun, Jul 30, 2017 at 11:51 AM, jupiter <[hidden email]> wrote:
Hi,

How can I set up the cmake not to check /usr/bin/cc but to check $CC (which link to gcc without hard corded path in the environment)?

Thank you.

Regards




--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: The C compiler "/usr/bin/cc" is not able to compile a simple test program.

Micha Hergarden
On 30-07-17 04:36, jupiter wrote:
I thought if I add -DCMAKE_CC_COMPILER=gcc that error should go, no, it still compile with the specific default cc:

/usr/bin/cc ....

How could I fix it?

Thank you.

On Sun, Jul 30, 2017 at 11:51 AM, jupiter <[hidden email]> wrote:
Hi,

How can I set up the cmake not to check /usr/bin/cc but to check $CC (which link to gcc without hard corded path in the environment)?

Thank you.

Regards





Hello Jupiter,

Running the following sets the compiler to gcov:

CC=/usr/bin/gcov cmake ../

This outputs:

-- The C compiler identification is unknown
-- The CXX compiler identification is GNU 7.1.1
-- Check for working C compiler: /usr/bin/gcov
-- Check for working C compiler: /usr/bin/gcov -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- 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
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done


As you can see cmake definitely uses the CC environment variable. What is your OS? What do you set $CC to? What is the full commandline you use to call cmake?
What happens if you set it the way I did?

Regards,
Micha

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

signature.asc (537 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: The C compiler "/usr/bin/cc" is not able to compile a simple test program.

Nils Gladitz-2
On 30.07.2017 10:54, Micha Hergarden wrote:
> On 30-07-17 04:36, jupiter wrote:
>> I thought if I add -DCMAKE_CC_COMPILER=gcc that error should go, no,
>> it still compile with the specific default cc:

The corresponding CMake cache variable for the C compiler is
CMAKE_C_COMPILER (note C not CC).

Also note if the C compiler has already been configured for a build tree
it can not simply be changed.
Which is also why the CC environment variable has no effect on build
trees where the C compiler is already configured.

Nils
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
hce
Reply | Threaded
Open this post in threaded view
|

Re: The C compiler "/usr/bin/cc" is not able to compile a simple test program.

hce
In reply to this post by Micha Hergarden
Thanks Micha and Nils.

Cheers.



On Sun, Jul 30, 2017 at 6:54 PM, Micha Hergarden <[hidden email]> wrote:
On 30-07-17 04:36, jupiter wrote:
I thought if I add -DCMAKE_CC_COMPILER=gcc that error should go, no, it still compile with the specific default cc:

/usr/bin/cc ....

How could I fix it?

Thank you.

On Sun, Jul 30, 2017 at 11:51 AM, jupiter <[hidden email]> wrote:
Hi,

How can I set up the cmake not to check /usr/bin/cc but to check $CC (which link to gcc without hard corded path in the environment)?

Thank you.

Regards





Hello Jupiter,

Running the following sets the compiler to gcov:

CC=/usr/bin/gcov cmake ../

This outputs:

-- The C compiler identification is unknown
-- The CXX compiler identification is GNU 7.1.1
-- Check for working C compiler: /usr/bin/gcov
-- Check for working C compiler: /usr/bin/gcov -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- 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
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done


As you can see cmake definitely uses the CC environment variable. What is your OS? What do you set $CC to? What is the full commandline you use to call cmake?
What happens if you set it the way I did?

Regards,
Micha


--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake