Bug 233668 - graphics/gexiv2: fix build with GCC-based architectures
Summary: graphics/gexiv2: fix build with GCC-based architectures
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: Christoph Moench-Tegeder
Depends on:
Reported: 2018-11-30 17:20 UTC by Piotr Kubaj
Modified: 2018-12-06 14:54 UTC (History)
3 users (show)

See Also:
bugzilla: maintainer-feedback? (cmt)

patch (2.39 KB, patch)
2018-11-30 17:20 UTC, Piotr Kubaj
no flags Details | Diff
fix empty argument when linking (1.06 KB, patch)
2018-12-01 18:08 UTC, Christoph Moench-Tegeder
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Piotr Kubaj freebsd_committer 2018-11-30 17:20:16 UTC
Created attachment 199689 [details]

Building with GCC7 (which is necessary on GCC platforms) currently fails with:
g++7  -o gexiv2/libgexiv2.so.2.0.0 'gexiv2/gexiv2@@gexiv2@sha/meson-generated_.._gexiv2-enums.cpp.o' 'gexiv2/gexiv2@@gexiv2@sha/gexiv2-metadata.cpp.o
' 'gexiv2/gexiv2@@gexiv2@sha/gexiv2-metadata-exif.cpp.o' 'gexiv2/gexiv2@@gexiv2@sha/gexiv2-metadata-gps.cpp.o' 'gexiv2/gexiv2@@gexiv2@sha/gexiv2-metadata-iptc.cpp.o' 'gexiv2/gexiv2@@gexiv2@sha/gexiv2-metadata-xmp.cpp.o' 'gexiv2/gexiv2@@gexiv2@sha/gexiv2-stream-io.cpp.o' 'gexiv2/gexiv2@@gexiv2@sha/gexiv2-preview-properties.cpp.o' 'gexiv2/gexiv2@@gexiv2@sha/gexiv2-preview-image.cpp.o' 'gexiv2/gexiv2@@gexiv2@sha/gexiv2-log.cpp.o' 'gexiv2/gexiv2@@gexiv2@sha/gexiv2-startup.cpp.o' -L/usr/local/lib/gcc7 -Wl,--no-undefined -Wl,--as-needed -Wl,-O1 -shared -fPIC -Wl,--start-group -Wl,-soname,libgexiv2.so.2 -O2 -pipe -Wl,-rpath=/usr/local/lib/gcc7 -Wl,-rpath=/usr/local/lib/gcc7 -Wl,-rpath=/usr/local/lib/gcc7 '' /usr/local/lib/libgobject-2.0.so /usr/local/lib/libglib-2.0.so /usr/local/lib/libintl.so /usr/local/lib/libexiv2.so -Wl,--end-group
g++7: error: : No such file or directory

Our local patch, introduced in the last update, causes this issue. I attach the patch to apply our local patch conditionally only when using Clang.

Tested on powerpc64 and amd64.

Hardware sponsored by IntegriCloud.
Comment 1 Christoph Moench-Tegeder freebsd_committer 2018-11-30 19:51:11 UTC
That patch is there because without it some consumers - I use gnome-photos as the reference - crash. See bug #230505 . In fact, the patch in question here is the patch from over there adapted for meson.

- Was gexiv2 already broken before the update?
- Does gnome-photos work when building gexiv2 with gcc and without the patch? (if it doesn't work, it crashes on startup - no need to import photos)
  If yes, I'd rather not do conditional patching, but use meson's capabilities to pick the right options based on the compiler (we can query the compiler like this: https://mesonbuild.com/Reference-tables.html#compiler-ids ) and submit that upstream.
Comment 2 Justin Hibbits freebsd_committer 2018-12-01 00:44:12 UTC
The problem with the patch from the other bug is that it adds an empty argument, which gcc balks at, for obvious reasons.  Maybe LLVM can handle an empty argument, but most utilities treat an empty argument just like any other argument.  What's needed, to satisfy all FreeBSD targets, is to prune the empty argument.  I don't know how to do that in meson, maybe someone else does.
Comment 3 Christoph Moench-Tegeder freebsd_committer 2018-12-01 17:56:00 UTC
(In reply to Justin Hibbits from comment #2)
Oh, empty argument, I see. Let me check how to fix that.

And again: does anybody know if the gcc-compiled gexiv2 _with_ the version script (that is, with the patch from above) is actually useful? Or did that fix the build by breaking the lib?
Comment 4 Christoph Moench-Tegeder freebsd_committer 2018-12-01 18:08:36 UTC
Created attachment 199718 [details]
fix empty argument when linking

Just RTFM :) The meson manual has the answer: https://mesonbuild.com/howtox.html#use-an-argument-only-with-a-specific-compiler

Can you re-check with the attached patch? In my test build, the extranous argument '' is now gone.
Comment 5 Piotr Kubaj freebsd_committer 2018-12-05 15:27:57 UTC
(In reply to Christoph Moench-Tegeder from comment #4)
Yes, this patch is ok.
Comment 6 commit-hook freebsd_committer 2018-12-06 14:53:05 UTC
A commit references this bug:

Author: cmt
Date: Thu Dec  6 14:52:16 UTC 2018
New revision: 486763
URL: https://svnweb.freebsd.org/changeset/ports/486763

  gexiv2: fix build with non-clang compilers

  clang silently ignores empty arguments, others do complain. Set up
  conditional arguments like the meson documentation recommends.

  PR:		233668
  Reported by:	Piotr Kubaj, jhibbits@

Comment 7 Christoph Moench-Tegeder freebsd_committer 2018-12-06 14:54:36 UTC
committed as ports r486763 - thanks for reporting and testing.