[Insight-users] Re: [CMake] Solaris using gcc to link instead of g++
Michael Bell
michael.bell at acm.org
Mon Aug 7 12:44:47 EDT 2006
Bill,
I changed <CMAKE_C_COMPILER> to <CMAKE_CXX_COMPILER> and got the
results I was looking for. Thanks for your help.
I only have a limited view of things. Perhaps there could be an option
for making this change, with the default as running the C compiler.
thanks,
michael
On 8/7/06, William A. Hoffman <billlist at nycap.rr.com> wrote:
> The code is in Platforms/SunOS.cmake:
>
>
> IF(CMAKE_COMPILER_IS_GNUCXX)
> IF(CMAKE_COMPILER_IS_GNUCC)
> SET(CMAKE_CXX_CREATE_SHARED_LIBRARY
> "<CMAKE_C_COMPILER> <CMAKE_SHARED_LIBRARY_CXX_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> <CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>")
> ELSE(CMAKE_COMPILER_IS_GNUCC)
>
>
> If libstdc++ was automatically added, it would break the builds for many
> solaris boxes. Sun shipped a gcc compiler that did not have a shared
> libstdc++, and the .a did not have -PIC compiled .o files, so if we used g++
> or automatically added libstdc++ (same thing) it would break builds. That said,
> maybe things have changed. Any the above stuff can be changed on a
> per project basis.
>
> -Bill
>
>
>
>
> At 11:56 AM 8/7/2006, Michael Bell wrote:
> >Bill,
> >
> >So cmake detects solaris and decides to use gcc? If I use g++, it
> >works for me now (with gcc 3.3.1). Should I file this as a bug?
> >
> >Using g++ would be the perferable result for me, but at the very
> >least, libstdc++ should automatically be added at the linking step.
> >When libstc++ is not linked, the resulting run-time error message was
> >difficult to debug, to say the least.
> >
> >thanks,
> >michael
> >
> >On 8/7/06, William A. Hoffman <billlist at nycap.rr.com> wrote:
> >>I think that the problem was sun was shipping with a gcc that did not have
> >>a shared stdc++, so if you created shared libraries with g++ they did not link.
> >>
> >>-Bill
> >>
> >>
> >>At 10:36 AM 8/7/2006, Michael Bell wrote:
> >>>Hi,
> >>>
> >>>When compiling ITK2.8 on Solaris 5.9 with gcc 3.3.1, files are being
> >>>compiled correctly with g++, but libraries are being linked with gcc.
> >>> From a random link.txt:
> >>>gcc -fPIC -shared -Wl,-hlibITKIO.so.2.8 -o ../../bin/libITKIO.so.2.8.0 ...
> >>>
> >>>This problem requires me to manually link stdc++.
> >>>
> >>>Compiling from the exact same codebase on linux works correctly. I
> >>>compared the cmake configuration, and they are the same (different
> >>>paths to the same programs), except linux uses gmake while solaris
> >>>uses make.
> >>>
> >>>Why would solaris use gcc to link? What can I do about it?
> >>>
> >>>thanks,
> >>>michael
> >>>
> >>>
> >>>--
> >>>michael.bell at acm.org
> >>>_______________________________________________
> >>>CMake mailing list
> >>>CMake at cmake.org
> >>>http://www.cmake.org/mailman/listinfo/cmake
> >>
> >
> >
> >--
> >michael.bell at acm.org
> >_______________________________________________
> >CMake mailing list
> >CMake at cmake.org
> >http://www.cmake.org/mailman/listinfo/cmake
>
>
--
michael.bell at acm.org
More information about the Insight-users
mailing list