[CMake] Can't find libstdc++ on RHEL Linux 5...

Andreas Pakulat apaku at gmx.de
Fri Oct 24 02:39:36 EDT 2008


On 23.10.08 17:13:27, Dick Munroe wrote:
> I have the following in my CMakeLists.txt file:
>
> 		   	FIND_LIBRARY(
> 				APPLE_LIBC
> 				NAMES c
> 		   	)
> message("${APPLE_LIBC}")
> 		  	FIND_LIBRARY(
> 				APPLE_STDC++
> 				NAMES stdc++
> 		   	)
> message("${APPLE_STDC++}")

Thats not necessary as long as you use the right binary for compilation.
For C++ code you should use g++, which automatically will link against the
right libstdc++ and for plain C use gcc which will automatically link
against the right libc

> When this runs I get the following:
>
> /usr/lib/libc.so
> APPLE_STDC++-NOTFOUND
>
> and when I do a ls in /usr/lib I see:
>
> [munroe at redhat ESPlanner Executables-cmake]$ ls /usr/lib/libstd*
> /usr/lib/libstdc++.so.5      /usr/lib/libstdc++.so.6
> /usr/lib/libstdc++.so.5.0.7  /usr/lib/libstdc++.so.6.0.8
>
> So why isn't cmake finding libstdc++ but IS finding libc.so (unless
> cmake can't deal with the versioning).

Because there's no libstdc++.so, which usually indicates missing -dev
packages. But anyway, you don't need to search for libstdc++, the compiler
will pick the right one.

Andreas

-- 
You'll wish that you had done some of the hard things when they were easier
to do.


More information about the CMake mailing list