G'MIC: lookup symbol err on openSUSE darktable master build

I’ll build a new pre-release package on the website, then.

ETA for a full release?

I’ve just released 2.8.2 two days ago, so maybe it would be cool to have at least a working prototype of the module for Darktable before releasing 2.8.3 ?

Oh, it doesn’t.

I’ve compiled the development branch with the cmake options from above on tumbleweed again.

The symbols is still not there when compiled with LTO :frowning:

objdump -T libgmic.so.1 | grep _ZN12cimg_library8CImgListIcE6assignEj
./src/darktable: symbol lookup error: /tmp/local/dt/lib64/darktable/plugins/liblut3d.so: undefined symbol: _ZN12cimg_library8CImgListIcE6assignEj

I’ll set up a virtual machines for tumbletweed, to make more tests.

Tip:

zypper si -d gmic
zypper si -d darktable

This will install all required dependencies for building gmic and darktable. Strange is that darktable builds and links fine against gmic but the runtime fails if you activate the lut3d module and try to load the gmic_cluts.gmz.

IIRC we dont link loadable modules that they cant have undefined references.

@asn, I’ve installed a fresh OpenSuse Tumbleweed on a VM, installed all necessary packages with zypper, and tried to compile the libgmic example from the develop branch of the git repo.

dtschump@localhost:~/work/src/gmic/src> make OPT_CFLAGS="-flto -Ofast" OPT_LIBS="-flto" lib
make "CFLAGS+=-Dgmic_build -Dcimg_date=\\\"\\\" -Dcimg_time=\\\"\\\" -Dcimg_use_zlib  -Dgmic_prerelease="\\\"200120\\\""  -std=c++11 -pedantic -Wall -Wextra -Wfatal-errors -Werror=unknown-pragmas -Werror=unused-label -Wshadow -Dcimg_use_vt100 -Dcimg_use_abort -Dgmic_is_parallel  -Dcimg_use_fftw3  -Dcimg_use_curl  -Dcimg_use_png -I/usr/include/libpng16  -Dcimg_use_jpeg -Dcimg_use_tiff  -fopenmp -Dcimg_use_openmp -Dcimg_display=1   -flto -Ofast" "LIBS+=-L/lib64 -lz   -L/usr/lib -lm -lpthread  -lfftw3  -lfftw3_threads -lcurl  -lpng16 -L/lib64 -lz  -ljpeg -ltiff  -lgomp -lX11  -lpthread  -flto" _lib
make[1]: Entering directory '/home/dtschump/work/src/gmic/src'
> Retrieve CImg Library...
 done!
ar rcs libgmic.a libgmic.o
g++ -shared -std=c++11 -pedantic -Wl,-soname,libgmic.so.2 -o libgmic.so libgmic.o -L/lib64 -lz   -L/usr/lib -lm -lpthread  -lfftw3  -lfftw3_threads -lcurl  -lpng16 -L/lib64 -lz  -ljpeg -ltiff  -lgomp -lX11  -lpthread  -flto
^Cmake[1]: *** wait: No child processes.  Stop.
make[1]: *** Waiting for unfinished jobs....
make[1]: *** wait: No child processes.  Stop.
make: *** wait: No child processes.  Stop.
make: *** Waiting for unfinished jobs....
make: *** wait: No child processes.  Stop.
dtschump@localhost:~/work/src/gmic/src> df -k .
Filesystem     1K-blocks    Used Available Use% Mounted on
/dev/sda2       19523584 6853888  12087776  37% /home
dtschump@localhost:~/work/src/gmic/src> df -k .
Filesystem     1K-blocks    Used Available Use% Mounted on
/dev/sda2       19523584 6857816  12084008  37% /home
dtschump@localhost:~/work/src/gmic/src> make OPT_CFLAGS="-flto -Ofast" OPT_LIBS="-flto" lib
make "CFLAGS+=-Dgmic_build -Dcimg_date=\\\"\\\" -Dcimg_time=\\\"\\\" -Dcimg_use_zlib  -Dgmic_prerelease="\\\"200120\\\""  -std=c++11 -pedantic -Wall -Wextra -Wfatal-errors -Werror=unknown-pragmas -Werror=unused-label -Wshadow -Dcimg_use_vt100 -Dcimg_use_abort -Dgmic_is_parallel  -Dcimg_use_fftw3  -Dcimg_use_curl  -Dcimg_use_png -I/usr/include/libpng16  -Dcimg_use_jpeg -Dcimg_use_tiff  -fopenmp -Dcimg_use_openmp -Dcimg_display=1   -flto -Ofast" "LIBS+=-L/lib64 -lz   -L/usr/lib -lm -lpthread  -lfftw3  -lfftw3_threads -lcurl  -lpng16 -L/lib64 -lz  -ljpeg -ltiff  -lgomp -lX11  -lpthread  -flto" _lib
make[1]: Entering directory '/home/dtschump/work/src/gmic/src'
> Retrieve CImg Library...
 done!
ar rcs libgmic.a libgmic.o
g++ -shared -std=c++11 -pedantic -Wl,-soname,libgmic.so.2 -o libgmic.so libgmic.o -L/lib64 -lz   -L/usr/lib -lm -lpthread  -lfftw3  -lfftw3_threads -lcurl  -lpng16 -L/lib64 -lz  -ljpeg -ltiff  -lgomp -lX11  -lpthread  -flto
g++ -o use_libgmic use_libgmic.cpp -std=c++11 -pedantic -L. -lgmic -L/lib64 -lz   -L/usr/lib -lm -lpthread  -lfftw3  -lfftw3_threads -lcurl  -lpng16 -L/lib64 -lz  -ljpeg -ltiff  -lgomp -lX11  -lpthread  -flto
make[1]: Leaving directory '/home/dtschump/work/src/gmic/src'
dtschump@localhost:~/work/src/gmic/src> export LD_LIBRARY_PATH=.
dtschump@localhost:~/work/src/gmic/src> ln -s libgmic.so libgmic.so.2
dtschump@localhost:~/work/src/gmic/src> ./use_libgmic 

- 1st step : Create input list of images.
    Input image 0 =  256x256x1x3, buffer : 0x7f9a2a5da010
    Input image 1 =  256x256x1x3, buffer : 0x7f9a2a519010
    Input image 2 =  256x256x1x3, buffer : 0x7f9a2a458010
    Input image 3 =  256x256x1x3, buffer : 0x7f9a2a397010
    Input image 4 =  256x256x1x3, buffer : 0x7f9a2a2d6010

- 2st step : Call G'MIC interpreter.
[gmic]-5./ Start G'MIC interpreter.
[gmic]-5./ Add images [0,1,2,3,4].
[gmic]-1./ Normalize image [0] in range [0,255], with constant-case ratio 0.
[gmic]-1./ Apply flower deformation on image [0], with amplitude 8, frequency 6, offset 0, angle 0 deg. and center point (8,6).
[gmic]-1./ Sharpen image [0] with inverse diffusion and amplitude 100.
[gmic]-1./ Output image [0] as bmp file 'foo1.bmp' (1 image 256x256x1x3).
[gmic]-1./ End G'MIC interpreter.

- 3rd step (alternative) : Call G'MIC interpreter twice from empty instance.
[gmic]-1./ Start G'MIC interpreter.
[gmic]-1./ Blur image [0] with standard deviation 5, neumann boundary conditions and quasi-gaussian kernel.
[gmic]-1./ Sharpen image [0] with inverse diffusion and amplitude 1000.
[gmic]-1./ Normalize image [0] in range [0,255], with constant-case ratio 0.
[gmic]-1./ Output image [0] as bmp file 'foo2.bmp' (1 image 256x256x1x3).
[gmic]-1./ End G'MIC interpreter.

[gmic]-1./ Start G'MIC interpreter.
[gmic]-1./ Resize image [0] to 50%x50%x100%x100% , with nearest-neighbor interpolation, dirichlet boundary conditions and alignment (0,0,0,0).
[gmic]-1./ Force image [1] to be in RGBA mode.
[gmic]-2./ Rotate image [1] of 30 deg., with linear interpolation and dirichlet boundary conditions.
[gmic]-1./ Drop shadow behind image [1], with offsets (0,13), smoothness 5 and curvature 0.
[gmic]-1./ Apply radial blur on image [0], with amplitude 10% and center point (50%,50%).
[gmic]-2./ Blend all images [0,1] together, using 'alpha' mode and opacity 1.
[gmic]-1./ Output image [0] as bmp file 'foo3.bmp' (1 image 256x256x1x3).
[gmic]-1./ End G'MIC interpreter.

- 4th step : Returned 1 output images.
   Output image 0 = 256x256x1x3, buffer : 0x1023c90

- That's it !
dtschump@localhost:~/work/src/gmic/src> 

Will try with cmake next, but the basic compilation of the lib is working as expected.

With the cmake method:

dtschump@localhost:~/work/src/gmic/obj> objdump -T libgmic.so.1 | grep assign
00000000001d4830 g    DF .text	00000000000004fa  Base        _ZN12cimg_library8CImgListIfE6assignEj
00000000001d51e0 g    DF .text	000000000000011c  Base        _ZN12cimg_library4CImgIfE6assignEjjjj
00000000005266c0 g    DF .text	00000000000000b7  Base        _ZN12cimg_library11CImgDisplay12_assign_xshmEP9_XDisplayP11XErrorEvent
dtschump@localhost:~/work/src/gmic/obj> objdump -T libgmic.so.1 | grep sorted
000000000051c580 g    DF .text	00000000000000b7  Base        _ZN4gmic13search_sortedIN12cimg_library8CImgListIcEEEEbPKcRKT_jRj
dtschump@localhost:~/work/src/gmic/obj> 

and use_libgmic continues to work with the library compiled with the cmake:

dtschump@localhost:~/work/src/gmic/src> ldd use_libgmic | grep gmic
	libgmic.so.2 => ./libgmic.so.2 (0x00007fd554f18000)
dtschump@localhost:~/work/src/gmic/src> ls -l ./libgmic.so.2
lrwxrwxrwx 1 dtschump users 19 Jan 20 14:30 ./libgmic.so.2 -> ../obj/libgmic.so.1

So right now, I don’t know what to do next. Everything seems ok.

@David_Tschumperle it happens only with cmake line above. The compile flags matter! That’s why I pasted the complete cmake line the build system uses. It sets -flto=auto for CFLAGS and LDFLAGS …

Yes, I know that, I’ve copy-pasted the exact line you show here : G'MIC: lookup symbol err on openSUSE darktable master build - #33 by asn