[CMake] Nonstandard architectures.

Mathias Froehlich M.Froehlich at science-computing.de
Fri Sep 28 09:36:00 EDT 2007


On Friday 28 September 2007 14:56, you wrote:
> Mathias Froehlich wrote:
> > Hi,
> >
> > On Thursday 27 September 2007 16:31, Bill Hoffman wrote:
> >>> I think there's a way to tell CMake to either use lib or lib64,
> >>> something like LIB_SUFFIX.
> >>
> >> CMake does a test for sizeof void* if it is 8 bytes then lib64 is
> >> searched before lib in all FIND_* stuff.
> >
> > That is way too croase and will even bring the wrong results.
>
> It produces good results on linux x64 and itanium platforms.  I have
> tested and used
> it on both. 
> There maybe issues with other platforms. 
> Right now the code does this:
>
> if(is64bit)
>    1. try this: cmSystemTools::ReplaceString(s, "lib/", "lib64/");
>    2. try this:  add 64 to the name of the path.

I am not sure about that, since even on such platforms files in /usr/lib are 
still found.

For example on IRIX I see with building openscenegraph that even with 'CC -64' 
producing mips4 64 bits abi object, cmake thinks that it can make use 
of /usr/lib/libInventor.so - a 32 bit default abi file, even if ther is 
no /usr/lib64/libInventor.* avaliable. And yes on irix the path conventions 
match the ones from linux. So there is a /usr/lib64.

So cmake still tries to look in lib rather than just only in lib64.

The build then fails because the 64 bit linker tries to link -lInventor and 
does not have one that matches the abi ...

> I suppose the lib64 thing could be and the path extension could be
> changed to be
> variables that are set in the Platform files. 
Yep, and i think that it should be overwritable from outside. There are too 
many platforms with too different abis out there that you can in the best 
case do an educated default guess.

> It also checks to see if 
> the above
> paths exist before adding them to the search paths.   However, finding a
> library
> without testing it with a try_compile will produce incorrect results
> from time
> to time.   I am not sure that FIND_LIBRARY should do a try_compile, but
> maybe it should....
Probably yes.
IMO, better test what you need rather than test something that is more or less 
closely related but not the same than what you need.
And in the final build stage you will need to link with a library. The test if 
there is a file just tells you that there is a file - not that you can link 
with that file.

   Greetings

        Mathias

-- 
Dr. Mathias Fröhlich, science + computing ag, Software Solutions
Hagellocher Weg 71-75, D-72070 Tuebingen, Germany
Phone: +49 7071 9457-268, Fax: +49 7071 9457-511
-- 
Vorstand/Board of Management:
Dr. Bernd Finkbeiner, Dr. Florian Geyer,
Dr. Roland Niemeier, Dr. Arno Steitz, Dr. Ingrid Zech
Vorsitzender des Aufsichtsrats/
Chairman of the Supervisory Board:
Prof. Dr. Hanns Ruder
Sitz/Registered Office: Tuebingen
Registergericht/Registration Court: Stuttgart
Registernummer/Commercial Register No.: HRB 382196 



More information about the CMake mailing list