[geos-devel] cmake detailed comments

Paul Ramsey pramsey at cleverelephant.ca
Wed Oct 13 15:18:37 PDT 2021


Consider looking at cmake descriptions of what it intends to do with RPATH, and ways to set link flags without forcing environment variables in

https://cmake.org/cmake/help/latest/variable/CMAKE_SHARED_LINKER_FLAGS.html
https://cmake.org/cmake/help/latest/variable/CMAKE_SKIP_INSTALL_RPATH.html
https://cmake.org/cmake/help/latest/variable/CMAKE_SKIP_RPATH.html

P


> On Oct 13, 2021, at 3:17 PM, Sandro Santilli <strk at kbt.io> wrote:
> 
> I should add, I'm using cmake version 3.16.3
> 
> --strk;
> 
> On Wed, Oct 13, 2021 at 11:31:54PM +0200, Sandro Santilli wrote:
>> On Wed, Oct 13, 2021 at 12:08:50PM -0400, Greg Troxel wrote:
>> 
>>> So maybe strk can test (on Linux I'm guessing):
>> 
>> Ubuntu 20.10 here
>> 
>>>  build and install geos 3.9.1 as --prefix=/usr/foo
>> 
>> Done (3.9 branch of geos):
>> 
>>  ./autogen.sh && \
>>  ./configure --prefix=/tmp/geos && \
>>  sudo make install
>> 
>> 
>> Note that after this I get:
>> 
>>  $ objdump -x /tmp/geos/lib/libgeos_c.so.1.14.2  | grep RUNPATH
>>    RUNPATH              /tmp/geos/lib
>> 
>> I'm not sure it's relevant.
>> 
>>>  build geos 3.10 by telling cmake to use /usr/foo as prefix, and
>>>  passing in the environment
>>>    CPPFLAGS=-I/usr/foo/include
>>>    LDFLAGS="-L/usr/foo/lib -Wl,-R/usr/foo/lib"
>>>  as a packaging system building everything for /usr/foo would do.
>> 
>> Done:
>> 
>>  $ export CPPFLAGS=-I/tmp/geos
>>  $ export LDFLAGS="-L/tmp/geos/lib -Wl,-R/tmp/geos/lib"
>>  $ cmake .
>>  $ make 
>> 
>>>  Then look at the test binaries  with objdump -x, ldd, and run them.I
>>>  expect they will mislink against the installed geos.
>> 
>>  $ objdump -x bin/test_geos_unit | grep RUNPATH
>>    RUNPATH /tmp/geos/lib:/usr/local/src/geos/geos/src/main/lib
>>  $ ldd bin/test_geos_unit | grep tmp
>>        libgeos_c.so.1 => /tmp/geos/lib/libgeos_c.so.1 (0x00007f0be9ead000)
>>        libgeos-3.9.2.so => /tmp/geos/lib/libgeos-3.9.2.so (0x00007f0be9489000)
>> 
>>> If so, the bug in cmake or geos cmakefiles is that the extra RPATH for
>>> tests is put after the other RPATH values, rather then being put first.
>>> 
>>> Or rather, that is the bug, but if you can reproduce it that's progress
>>> in understanding its scope.
>> 
>> So yes, I can reproduce the problem on a Linux system.
>> 
>> --strk;
> 
> -- 
> 
>  Libre GIS consultant/developer
>  https://strk.kbt.io/services.html
> _______________________________________________
> geos-devel mailing list
> geos-devel at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/geos-devel



More information about the geos-devel mailing list