Bug 243525 - graphics/poppler-glib: c++: error: linker command failed
Summary: graphics/poppler-glib: c++: error: linker command failed
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-desktop (Team)
Depends on:
Reported: 2020-01-22 20:23 UTC by O. Hartmann
Modified: 2020-01-27 19:17 UTC (History)
3 users (show)

See Also:
tcberner: maintainer-feedback+

v2 (668 bytes, patch)
2020-01-22 20:51 UTC, Tobias C. Berner
no flags Details | Diff
[patch] fix for "cannot fine -lgtk-3" (1.38 KB, patch)
2020-01-27 19:07 UTC, John Hein
jcfyecrayz: maintainer-approval? (desktop)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description O. Hartmann 2020-01-22 20:23:56 UTC
Host: FreeBSD 13.0-CURRENT #84 r356991: Wed Jan 22 20:29:28 CET 2020 amd64, ports tree at 523835, updating/upgrading the local ports via traditional make/portmaster fails with the error shown below:

/usr/bin/c++  -Wall -Wextra -Wpedantic -Wno-unused-parameter -Wcast-align -Wformat-security -Wframe-larger-than=65536 -Wmissing-format-attribute -Wnon-virtual-dtor -Woverloaded-virtual -Wmissing-declarations -Wundef -Wzero-as-null-pointer-constant -Wshadow -fno-exceptions -fno-check-new -fno-common -D_DEFAULT_SOURCE -O2 -DNDEBUG -O2 -pipe -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing  -isystem /usr/local/include   -fstack-protector-strong CMakeFiles/poppler-glib-demo.dir/main.c.o CMakeFiles/poppler-glib-demo.dir/find.c.o CMakeFiles/poppler-glib-demo.dir/fonts.c.o CMakeFiles/poppler-glib-demo.dir/forms.c.o CMakeFiles/poppler-glib-demo.dir/info.cc.o CMakeFiles/poppler-glib-demo.dir/images.c.o CMakeFiles/poppler-glib-demo.dir/links.c.o CMakeFiles/poppler-glib-demo.dir/outline.c.o CMakeFiles/poppler-glib-demo.dir/page.c.o CMakeFiles/poppler-glib-demo.dir/print.c.o CMakeFiles/poppler-glib-demo.dir/render.c.o CMakeFiles/poppler-glib-demo.dir/text.c.o CMakeFiles/poppler-glib-demo.dir/transitions.c.o CMakeFiles/poppler-glib-demo.dir/utils.c.o CMakeFiles/poppler-glib-demo.dir/annots.c.o CMakeFiles/poppler-glib-demo.dir/attachments.c.o CMakeFiles/poppler-glib-demo.dir/layers.c.o CMakeFiles/poppler-glib-demo.dir/selections.c.o CMakeFiles/poppler-glib-demo.dir/taggedstruct.c.o  -o poppler-glib-demo  -Wl,-rpath,/usr/ports/graphics/poppler-glib/work/poppler-0.84.0/glib:/usr/ports/graphics/poppler-glib/work/poppler-0.84.0:/usr/local/lib /usr/local/lib/libcairo.so ../libpoppler-glib.so.8.15.0 -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lpthread -lgio-2.0 -lgdk_pixbuf-2.0 -lgobject-2.0 -lglib-2.0 -lintl /usr/local/lib/libcairo.so ../../libpoppler.so.94.0.0 /usr/local/lib/libgio-2.0.so /usr/local/lib/libgobject-2.0.so /usr/local/lib/libglib-2.0.so /usr/local/lib/libintl.so /usr/local/lib/libfreetype.so -pthread 
ld: error: unable to find library -lgtk-3
ld: error: unable to find library -lgdk-3
ld: error: unable to find library -lpangocairo-1.0
ld: error: unable to find library -lpango-1.0
ld: error: unable to find library -latk-1.0
ld: error: unable to find library -lcairo-gobject
ld: error: unable to find library -lcairo
ld: error: unable to find library -lgio-2.0
ld: error: unable to find library -lgdk_pixbuf-2.0
ld: error: unable to find library -lgobject-2.0
ld: error: unable to find library -lglib-2.0
ld: error: unable to find library -lintl
c++: error: linker command failed with exit code 1 (use -v to see invocation)
*** [glib/demo/poppler-glib-demo] Error code 1

make[3]: stopped in /usr/ports/graphics/poppler-glib/work/poppler-0.84.0
Comment 1 Tobias C. Berner freebsd_committer 2020-01-22 20:24:57 UTC
Moin moin 

Please update your tree to r523840 [1].

mfg Tobias

[1] https://svnweb.freebsd.org/changeset/ports/523840
Comment 2 Tobias C. Berner freebsd_committer 2020-01-22 20:43:42 UTC
The underlying issue is that in an unclean environment it finds gtk and builds the demo-application.

endif ()

So we can just toggle the option BUILD_GTK_TESTS to off, and it should work again, and revert the temporary fix of r523840.

mfg Tobias
Comment 3 Tobias C. Berner freebsd_committer 2020-01-22 20:51:53 UTC
Created attachment 210973 [details]

Remove localbase:ldflags again, and toggle BUILD_GTK_TESTS off.
Comment 4 commit-hook freebsd_committer 2020-01-25 20:28:06 UTC
A commit references this bug:

Author: tcberner
Date: Sat Jan 25 20:27:10 UTC 2020
New revision: 524130
URL: https://svnweb.freebsd.org/changeset/ports/524130

  graphics/poppler-glib: disable gkt-test/demo builds

  In unclean build environments GTK could get picked up and lead to linker errrors
  in demo applications which are not installed, but still manage to make the build

  Remove the temporary work around added in r523840  which passed -L${LOCALBASE}/lib
  to the linker.

  PR:		243525
  Reported by:	Walter Schwarzenfeld <w.schwarzenfeld@utanet.at>, O. Hartmann <ohartmann@walstatt.org>

Comment 5 John Hein 2020-01-27 19:07:26 UTC
Created attachment 211111 [details]
[patch] fix for "cannot fine -lgtk-3"

I've had this patch locally for a few months and just saw this PR.  It allows the gtk tests (so you could remove the CMAKE_OFF=BUILD_GTK_TESTS).

And it could (probably should be) upstreamed.  But I never got around to that.  If someone else does, that would be great.

The root cause is poor cmake config (unfortunately a common thing, but that's partly because of the cmake culture itself).

I can open a new bug, but I thought I'd start here.  Feel free to re-open and apply this patch.

This has been QA tested inside poudriere and outside on a live system with lots of other packages installed.
Comment 6 Tobias C. Berner freebsd_committer 2020-01-27 19:17:57 UTC
Moin moin 

Thanks, but... :D

That would also require adding a dependency on gtk3 for a binary we don't install. 
Not sure what would be the benefit there :)

mfg Tobias