[geos-devel] cmake detailed comments

Paul Ramsey pramsey at cleverelephant.ca
Fri Oct 15 12:01:26 PDT 2021


I'm running your script now, but just from looking at it, this seems
suspicious...

cmake .. \
           -DCMAKE_INSTALL_PREFIX=${PREFIX} \
           -DCMAKE_BUILD_RPATH=${LIBDIR} \
           -DCMAKE_INSTALL_RPATH=${LIBDIR}

My understanding of the "build rpath" is that it exists in the built
binaries PRE install, so for build testing, PRE install, you want it
to point into the local library location. By over-riding it and
setting it to LIBDIR, you're saying "no no no, please put this path
into the rpath of of the PRE install binaries". I'd guess/hope that
removing the CMAKE_BUILD_RPATH while leaving CMAKE_INSTALL_RPATH as
you have it is closer to the intent, but I'll play with a build
myself.

P

On Fri, Oct 15, 2021 at 6:02 AM Greg Troxel <gdt at lexort.com> wrote:
>
>
> tl;dr:
>
> I've done things the cmake way and the test are still not ok.
> The problem is that the test RPATH is being *appended* to the BUILD
> RPATH, instead of prepended.
>
> long version:
>
> My build script is:
> ----------------------------------------
> #!/bin/sh
>
> if [ -d $HOME/bin/ccache ]; then
>     echo "enabling ccache"
>     ccache -z
>     PATH=$HOME/bin/ccache:$PATH
> fi
>
> PREFIX=/usr/pkg
> LIBDIR=${PREFIX}/lib
>
> # In theory, BSD make is ok.
> MAKE=make
>
> (rm -rf build destdir &&
>      mkdir build &&
>      cd build &&
>      cmake .. \
>            -DCMAKE_INSTALL_PREFIX=${PREFIX} \
>            -DCMAKE_BUILD_RPATH=${LIBDIR} \
>            -DCMAKE_INSTALL_RPATH=${LIBDIR} \
>            > OUT.00.cmake 2>&1 &&
>      ${MAKE} > OUT.10.make 2>&1 &&
>      (${MAKE} check > OUT.20.check 2>&1 || true) && \
>      make DESTDIR=../destdir install > OUT.30.install 2>&1 && \
>      echo BUILD DONE
> )
> ----------------------------------------
>
> BUILD_RPATH is passed because a packaging system invoking cmake must in
> general ensure that programs/libs in the build environment can find
> their dependencies at test time.
>
> Some tests pass, and some fail, with "std:alloc bad" and various other
> stuff.  But a quick look shows that objdump -x of one of the test
> programs has:
>
>   RPATH                /usr/pkg/lib:/home/n0/gdt/SOFTWARE/GEO/GEOS/geos-master/build/lib
>
> so I expect it to go badly.   This should have been
>
>   RPATH                /home/n0/gdt/SOFTWARE/GEO/GEOS/geos-master/build/lib:/usr/pkg/lib
>
> and then I think it would have been fine.
>
>
> If anyone can tell me what cmake args I should be using instead for the
> general case of a program with a correct cmake setup and  which might be
> finding dependencies from ${PREFIX}, I'd like to hear about it.   The
> list above is what I came up after reading the cmake docs pointed out by
> pramsey@ and strk at .
>
> Greg
> _______________________________________________
> 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