autotrace / autotrace

bitmap to vector graphics converter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pkg-config file lists many libraries as 'Libs', should use 'Requires.private'

Apteryks opened this issue · comments

Hi,

I've noticed that autotrace appears to misuse pkg-config, according to https://people.freedesktop.org/~dbn/pkg-config-guide.html. This was made visible by inkscape attempting to link with pstoedit and failing.

The above link mentions that libraries having pkg-config files should be listed in Requires instead of Libs. This means at least png16, MagickCore-6.Q16, gmodule-2.0, gthread-2.0, gobject-2.0 and glib-2.0 should be moved to Requires. Furthermore, I think most of these libs should be private (only needed to link statically), so in Requires.private or Libs.private.

@Apteryks thanks for reporting this. I've tried to fix it - please build against the latest master branch.

Thanks, I had come up with the same patch locally to fix the problem, so I confirm that it works. Using Requires.private would be better but doesn't currently work since the variables substituted by Autoconf contain link directives rather than pkg-config package names.

Perhaps we could use the package names directly in the Requires.private field, ignoring the autoconf provided *_LIBS variables.

I think we're not done here :-/. The libautotrace.so isn't actually linked against its dependencies such as pstoedit, so the ELF doesn't record the needed RUNPATH. It seems only the autotrace binary is linked against the needed dependencies. This causes Inkscape for example to fail to link to libautotrace.so, which is now underlinked:

[100%] Linking CXX executable ../bin/inkscape
cd /tmp/guix-build-inkscape-1.3.2.drv-0/build/src && /gnu/store/1fzd3ak386lgv7zl28j7zqkviv8wkz8d-cmake-minimal-3.24.2/bin/cmake -E cmake_link_script CMakeFiles/inkscape.dir/link.txt --verbose=1
/gnu/store/8yz8wfnzz3m4lmzr9hwmk9w9iiplnd8c-gcc-11.4.0/bin/c++  -DG_DISABLE_ASSERT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -DGLIBMM_DISABLE_DEPRECATED -DGTKMM_DISABLE_DEPRECATED -DGDKMM_DISABLE_DEPRECATED -DGTK_DIS
ABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -fstack-protector-strong -Werror=format -Werror=format-security -Werror=ignored-qualifiers -Werror=return-type -Wno-switch -Wmisleading-indentation -Wstrict-null-sentinel 
-pthread -D_GNU_SOURCE -fopenmp -DSIGCXX_DISABLE_DEPRECATED -O2 -g -DNDEBUG -Wl,--export-dynamic -rdynamic "CMakeFiles/inkscape.dir/inkscape-main.cpp.o" -o ../bin/inkscape  -Wl,-rpath,/tmp/guix-build-inkscape-1.3
.2.drv-0/build/lib: ../lib/libinkscape_base.so.1.3.2.0 /gnu/store/afmbxna3skh3h6kic2z4vncc1vmg86wl-boost-1.83.0/lib/libboost_filesystem.so.1.83.0 /gnu/store/afmbxna3skh3h6kic2z4vncc1vmg86wl-boost-1.83.0/lib/libbo
ost_atomic.so.1.83.0 -L/gnu/store/6dxhhymkz7lvnwq8mjp5xhgzw18fg556-autotrace-0.31.10/lib -lautotrace -L/gnu/store/9p6q4bghmd9ap2m1pgy0yzqhka4ax78c-lib2geom-1.3/lib -l2geom -L/gnu/store/xf4wiyj5d6x8glg12wr87hs2qw9
cknkw-pango-1.50.10/lib -lpangocairo-1.0 -L/gnu/store/02218a9wxf8nf1ssmywplk8d9aj8rgjs-cairo-1.16.0/lib -lcairo -lpangoft2-1.0 -lpango-1.0 -L/gnu/store/6g3cxkm4yahwmlz32n8gmyda62x9vpvc-harfbuzz-5.3.1/lib -lharfbu
zz -L/gnu/store/zppyqbgwjz580504alf0ni1gwnsbrzfv-fontconfig-minimal-2.14.0/lib -lfontconfig -L/gnu/store/h2ja83p5jqfxd741vg499dh501f47hia-freetype-2.13.0/lib -lfreetype -L/gnu/store/gg0pkq98v84dy4g19qy7qif575vylg
f2-gsl-2.7.1/lib -lgsl -lgslcblas -lm -L/gnu/store/0msq5y0ay3dx6nn772p5741sa5ms58bi-libsoup-minimal-2.74.2/lib -lsoup-2.4 -Wl,--export-dynamic -L/gnu/store/z8fw63658ag30p3r20m8im5710as48rh-glib-2.72.3/lib -lgmodu
le-2.0 -pthread -lgio-2.0 -lgobject-2.0 -lglib-2.0 -L/gnu/store/x9qbvrqvca7vikpqz4sd3mz0da8vigwn-libgc-8.2.4/lib -lgc -lpthread -ldl -L/gnu/store/7sxikv1pqikzi5jgw1r0x9csj7bxi0nz-lcms-2.13.1/lib -llcms2 -lpoppler
 -lpoppler-glib -lcairo -L/gnu/store/8bnilywavpi6sgig0nc80wrdqxmqnb15-libwpg-0.3.3/lib -lwpg-0.3 -L/gnu/store/rsprg9s1f3zlz6gm7gn819md9bblcvsp-librevenge-0.0.4/lib -lrevenge-0.0 -lrevenge-stream-0.0 -L/gnu/store/
n5sxr17q12zbw504b24ci153bcrdm1mk-libvisio-0.1.7/lib -lvisio-0.1 -L/gnu/store/m2slal1pi20j1qzdlkdak7ngzg5krqn4-libcdr-0.1.7/lib -lcdr-0.1 -ljpeg -lpng -lpotrace -lgtkmm-3.0 -latkmm-1.6 -lgdkmm-3.0 -lgiomm-2.4 -lpa
ngomm-1.4 -lglibmm-2.4 -lcairomm-1.0 -lsigc-2.0 -lgtk-3 -latk-1.0 -lgio-2.0 -lgdk-3 -lz -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -lgdk_pixbuf-2.0 -lcairo-gobject -lcairo -lgobject-2.0 -lglib-2.0 -L/gnu/store/lqchj
lfbxbja1x2ldva5bx78nya937rp-gspell-1.11.1/lib -lgspell-1 -L/gnu/store/2dcvzmg2yv77fc19v073xvlav3r7i6rf-gtk+-3.24.37/lib -lgtk-3 -lgdk-3 -lz -L/gnu/store/8y74hgg77bnab2gv6kl8dchhgkh3axaj-at-spi2-core-2.45.90/lib -
latk-1.0 -lcairo-gobject -L/gnu/store/hcf5xnb7lxcp2rnvzi8h7dqx4cqy511l-gdk-pixbuf-2.42.8/lib -lgdk_pixbuf-2.0 -L/gnu/store/1k0r8cgj5ic93qm5h9k9ssxa7z3fxppb-enchant-2.2.15/lib -lenchant-2 -lxslt -lxml2 -lz -L/gnu/
store/pz6mdmgr815f5sq8gk7xb4w3pa0640q7-readline-8.1.2/lib -lreadline -L/gnu/store/riimrfxsz4kkba8r2ma9x76qpbbhncsg-libsigc++-2.9.3/lib -lsigc-2.0 -L/gnu/store/4qg7kv0zaff77sdpyvvvrh6whjsi79hh-libepoxy-1.5.10/lib 
-lepoxy -lX11 -lXext
ld: /gnu/store/6dxhhymkz7lvnwq8mjp5xhgzw18fg556-autotrace-0.31.10/lib/libautotrace.so: undefined reference to `GetMagickInfoList'
ld: /gnu/store/6dxhhymkz7lvnwq8mjp5xhgzw18fg556-autotrace-0.31.10/lib/libautotrace.so: undefined reference to `pstoedit_plainC'
ld: /gnu/store/6dxhhymkz7lvnwq8mjp5xhgzw18fg556-autotrace-0.31.10/lib/libautotrace.so: undefined reference to `CloneImageInfo'
ld: /gnu/store/6dxhhymkz7lvnwq8mjp5xhgzw18fg556-autotrace-0.31.10/lib/libautotrace.so: undefined reference to `DestroyImage'
ld: /gnu/store/6dxhhymkz7lvnwq8mjp5xhgzw18fg556-autotrace-0.31.10/lib/libautotrace.so: undefined reference to `ReadImage'
ld: /gnu/store/6dxhhymkz7lvnwq8mjp5xhgzw18fg556-autotrace-0.31.10/lib/libautotrace.so: undefined reference to `DestroyImageInfo'
ld: /gnu/store/6dxhhymkz7lvnwq8mjp5xhgzw18fg556-autotrace-0.31.10/lib/libautotrace.so: undefined reference to `GetOnePixel'
ld: /gnu/store/6dxhhymkz7lvnwq8mjp5xhgzw18fg556-autotrace-0.31.10/lib/libautotrace.so: undefined reference to `GetImageType'
ld: /gnu/store/6dxhhymkz7lvnwq8mjp5xhgzw18fg556-autotrace-0.31.10/lib/libautotrace.so: undefined reference to `clearPstoeditDriverInfo_plainC'
ld: /gnu/store/6dxhhymkz7lvnwq8mjp5xhgzw18fg556-autotrace-0.31.10/lib/libautotrace.so: undefined reference to `InitializeMagick'
ld: /gnu/store/6dxhhymkz7lvnwq8mjp5xhgzw18fg556-autotrace-0.31.10/lib/libautotrace.so: undefined reference to `getPstoeditDriverInfo_plainC'
ld: /gnu/store/6dxhhymkz7lvnwq8mjp5xhgzw18fg556-autotrace-0.31.10/lib/libautotrace.so: undefined reference to `DestroyExceptionInfo'
ld: /gnu/store/6dxhhymkz7lvnwq8mjp5xhgzw18fg556-autotrace-0.31.10/lib/libautotrace.so: undefined reference to `pstoedit_checkversion'
ld: /gnu/store/6dxhhymkz7lvnwq8mjp5xhgzw18fg556-autotrace-0.31.10/lib/libautotrace.so: undefined reference to `GetExceptionInfo'
collect2: error: ld returned 1 exit status

I think it should be fixed at the level of the autotrace build system, I'll look into it.

I'm testing a fix.