how to build and use a debug version of a ports lib?
Gary Aitken
freebsd at dreamchaser.org
Sat Apr 7 19:07:44 UTC 2018
Trying to get a debug version of graphics/lensfun built and linked with
something.
I tried setting
CFLAGS= -O0 -ggdb -pipe
CMAKE_ARGS= -DBUILD_AUXFUN:BOOL=ON -O0 -ggdb -pipe
in graphics/lensfun/Makefile,
then got the following for make configure:
CMake Warning:
Manually-specified variables were not used by the project:
CMAKE_CXX_FLAGS_DEBUG
CMAKE_C_FLAGS_DEBUG
CMAKE_C_FLAGS_RELEASE
CMAKE_EXE_LINKER_FLAGS
CMAKE_MODULE_LINKER_FLAGS
CMAKE_VERBOSE_MAKEFILE
Python_ADDITIONAL_VERSIONS
THREADS_HAVE_PTHREAD_ARG
1. Can someone explain what the above means? Where were these manually
specified, since I don't think I did it; they aren't in the main
Makefile. Or does that message really mean:
Manually-specifiable variables which were not ...
2. What's the right way to get libraries built suitable for debugging?
Assuming I get the library built suitable for debugging, how do I get
it linked? I tried manually doing the following, but ldd still
shows the lensfun lib coming from the one in /usr/local/lib, not the
one I pointed at:
$ c++ -O0 -pipe -fstack-protector -fno-strict-aliasing -fstack-protector -o ufraw ufraw-ufraw.o libufraw.a /usr/ports/graphics/lensfun/work/lensfun-0.3.2/libs/lensfun/liblensfun.so.0.3.2 -L/usr/local/lib -lpthread -lexiv2 -lgthread-2.0 -pthread -lglib-2.0 -lintl -llcms2 -ltiff -lpng16 -lz -L/usr/local/lib -lgtkimageview -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lpthread -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lintl -lfontconfig -lfreetype -ljasper -ljpeg -lbz2 -lz -lm -lintl
$ ldd ./ufraw
./ufraw:
liblensfun.so.1 => /usr/local/lib/liblensfun.so.1 (0x80098e000)
...
$ file /usr/ports/graphics/lensfun/work/lensfun-0.3.2/libs/lensfun/liblensfun.so.0.3.2
/usr/ports/graphics/lensfun/work/lensfun-0.3.2/libs/lensfun/liblensfun.so.0.3.2: ELF 64-bit LSB shared object, x86-64, version 1 (FreeBSD), dynamically linked, not stripped
If instead of specifying the liblensfun.so specifically, I use a
-L/usr/ports/graphics/lensfun/work/lensfun-0.3.2/libs/lensfun
the link fails with things like:
libufraw.a(ufraw_lens_ui.o): In function `camera_menu_fill':
.../ufraw_lens_ui.c:77: undefined reference to `lf_mlstr_get'
Thanks,
Gary
More information about the freebsd-questions
mailing list