tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

cmake, elf libraries, tests?



I am testing an update to geography/geos, currently building
3.10.0beta3.  It has switched to cmake, and I've added USE_CMAKE=yes to
the Makefile and things seem to mostly work.

When running tests of 3.10.0beta3 while 3.9.0 is installed in /usr/pkg,
I find that that the 3.10 tests fail because they find the installed
version of libgeos_c.so.

The reason is a link line that looks like this (but is much longer).

cd /tmp/work/geography/geos/work/geos-3.10.0beta3/util/geosop && /usr/pkg/bin/cmake -E cmake_link_script CMakeFiles/geosop.dir/link.txt --verbose=1
/tmp/work/geography/geos/work/.cwrapper/bin/c++ -O2 -D_FORTIFY_SOURCE=2 -I/usr/include -DNDEBUG -L/usr/lib -Wl,-R/usr/lib -Wl,-R/usr/pkg/lib CMakeFiles/geosop.dir/GeosOp.cpp.o CMakeFiles/geosop.dir/GeomFunction.cpp.o CMakeFiles/geosop.dir/WKBStreamReader.cpp.o CMakeFiles/geosop.dir/WKTStreamReader.cpp.o -o ../../bin/geosop  ../../lib/lib/geos_c.so.1.16.0 ../../lib/libgeos.so.3.10.0

I see -R/usr/pkg/lib, which makes sense as pkgsrc intends to pass that
so that package builds can in general link with dependencies in pkgsrc.
(geos happens not to have any).    But I don't see -L/usr/pkg/lib, and
I'm not sure why.

The -R/usr/pkg/lib in the test program -- which isn't really wrong in
general as test programs might use dependecies -- causes the installed
library to be found.

I know automake/libtool addresses this by relinking one way in the build
directory and relinking for install.

Can anyone shed light on how this is supposed to work in cmake?  What is
the general plan for test programs to pick up the not-yet-installed
library?   Does this have to be open-coded by every project?   I would
like to be coherent to geos upstream about this problem.


Another question is how -L/usr/pkg/lib -Wl,-R/usr/pkg/lib is passed to
cmake.  Reading mk/configure/cmake.mk, I don't see it, and I have
experienced cmake wanting to see ldflags on the command line in a
variable rather than in the environment.

Attachment: signature.asc
Description: PGP signature



Home | Main Index | Thread Index | Old Index