Bug 213973 - x11-toolkits/libgdiplus Building fails because of tests
Summary: x11-toolkits/libgdiplus Building fails because of tests
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-mono (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-11-01 12:47 UTC by alex.theissen
Modified: 2017-04-09 08:07 UTC (History)
2 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description alex.theissen 2016-11-01 12:47:20 UTC
When I try to install the port I get the following linker error:
-------------------------------------------------------------------------------------
gmake[3]: Entering directory '/usr/ports/x11-toolkits/libgdiplus/work/libgdiplus-4.2/tests'
/bin/sh ../libtool  --tag=CC   --mode=link cc  -D_THREAD_SAFE -O2 -pipe -march=native  -fstack-protector -fno-strict-aliasing -pthread  -L/usr/local/lib -fstack-protector -o testgdi testgdi.o ../src/libgdiplus.la -lm -L/usr/local/lib -lglib-2.0 -lintl   -L/usr/local/lib -lcairo -lpthread    -L/usr/local/lib -lfontconfig -lfreetype   -L/usr/local/lib -lfreetype   -L/usr/local/lib -lXrender -lX11   -L/lib -ljpeg -ltiff -lgif -lpng -lz
libtool: link: cc -D_THREAD_SAFE -O2 -pipe -march=native -fstack-protector -fno-strict-aliasing -pthread -fstack-protector -o .libs/testgdi testgdi.o  -L/usr/local/lib ../src/.libs/libgdiplus.so -lm -lglib-2.0 -lintl -lcairo -lpthread -lfontconfig -lfreetype -lXrender -lX11 -L/lib -ljpeg -ltiff -lgif -lpng -lz -pthread -Wl,-rpath -Wl,/usr/local/lib
testgdi.o: In function `win_draw':
testgdi.c:(.text+0x1e6): undefined reference to `GdipCreateFromXDrawable_linux'
cc: error: linker command failed with exit code 1 (use -v to see invocation)
-------------------------------------------------------------------------------------

I do not know why this reference can't be found by the linker but the "_linux" suffix suggests that it is linux specific and shouldn't be compiled on freebsd.
Comment 1 Andrej Ebert 2016-11-05 15:05:45 UTC
I have the same problem on:

FreeBSD 199-SERVER 11.0-STABLE FreeBSD 11.0-STABLE #3 r308338: Sat Nov  5 14:00:11 CET 2016     root@199-SERVER:/usr/obj/usr/src/sys/MASK  amd64
 
At first I thought the problem was that the port doesn't pull in or check for the required x11/libX11 library, at least on my system. But manually installing it changes nothing.

A portmaster -f run (rebuilding all ports depended on) on sonarr (the port I needed libgdiplus for in the first place) changed nothing.

poudriere testport on 10.3 & 11 RELEASE jails builds and installs it successfully, but curiously pulls in a lot more dependencies than my real system with the following make.conf (comments stripped):

CPUTYPE?=bdver2
MALLOC_PRODUCTION=YES
SVN=/usr/bin/svn
SVN_UPDATE=yes
MAKE_JOBS_NUMBER?=9
BUILD_OPTIMIZED=YES
WITH_CPUFLAGS=YES
OPTIONS_UNSET=X11
OPTIONS_UNSET=ALSA DEBUG FONTCONFIG CUPS NLS GUI KDE4 KDE QT QT4 GTK GTK1 GTK2
OPTIONS_SET=OPTIMIZED_CFLAGS
NO_SENDMAIL=YES
NO_GUI=YES
MK_PROFILE=no
WITHOUT_GALLIUM=YES
WITHOUT_DEBUG=YES
DEFAULT_VERSIONS=php=7.0 mysql=5.6 apache=2.4 perl5=5.24
APACHE_PORT=www/apache24
KERNCONF=MASK
BATCH_DELETE_OLD_FILES=YES
WITH_OPENSSL_PORT=YES
DEFAULT_VERSIONS+=ssl=libressl
horde_dir=/usr/local/www/horde5

So I think it has something to do with the "OPTIONS_UNSET=X11" knob, but since neither sonarr nor libgdiplus have any options, I went digging to the dependencies of libgdiplus, an the only direct dependency to have an X11 knob is graphics/cairo, OPENGL, X11 and XCB options where disabled for the port on my system. After enabling X11 and rebuilding, it pulled these additional dependencies:

        Installation of x11/libXext (libXext-1.3.3_1,1)
        Installation of x11/renderproto (renderproto-0.11.1)
        Installation of x11/libXrender (libXrender-0.9.10)

And libgdiplus built sucessfully.

I think some or all of them should be added as a direct dependency for x11-toolkits/libgdiplus (since I think we aren't the only ones building as much as we can without the X11 stuff), if someone (Alex, for example) can confirm my workaround works.

This should also explain why no one could reproduce bug #198066.
Comment 2 Andrej Ebert 2016-11-06 11:08:41 UTC
There's a pull request here: https://github.com/mono/libgdiplus/pull/35 to make libgdiplus compile without X11, but I couldn't get it to work. Would someone be willing to look at it?
Comment 3 Andrej Ebert 2016-11-07 08:45:22 UTC
Maybe a hint somewhere that at the moment cairo needs to be built with X11 support to build libgdipluss successfully would be useful?
Comment 4 commit-hook freebsd_committer freebsd_triage 2016-12-20 14:30:47 UTC
A commit references this bug:

Author: dbn
Date: Tue Dec 20 14:30:34 UTC 2016
New revision: 428990
URL: https://svnweb.freebsd.org/changeset/ports/428990

Log:
  x11-toolkits:libgdiplus: add missing dependencies, license

   - Add LICENSE as Mozilla Public License, use license file from source.
   - Add missing and indirect dependencies.

  PR:		213973

Changes:
  head/x11-toolkits/libgdiplus/Makefile
Comment 5 David Naylor freebsd_committer freebsd_triage 2016-12-20 14:31:40 UTC
Added missing dependencies to port.  When upstream releases a version that works without X11 please ping and we'll happily add support.
Comment 6 Andrej Ebert 2017-03-18 15:29:38 UTC
As requested, pinging:

Upstream finally added support for building without X11:

Please see https://github.com/mono/libgdiplus/pull/46
Comment 7 commit-hook freebsd_committer freebsd_triage 2017-04-09 08:07:45 UTC
A commit references this bug:

Author: dbn
Date: Sun Apr  9 08:07:00 UTC 2017
New revision: 438077
URL: https://svnweb.freebsd.org/changeset/ports/438077

Log:
  x11-toolkits/libgdiplus: add option to compile without X11

   - Add extra patch that conditionally compiles x11 support [1]
   - Add X11 option that applies extra patch if X11 support is disabled
   - PORTREVISION is not bumped as:
     - The default case (X11) has not changed, and
     - The non-default case will propogate due to options change

  [1] https://github.com/mono/libgdiplus/pull/46

  PR:		213973

Changes:
  head/x11-toolkits/libgdiplus/Makefile
  head/x11-toolkits/libgdiplus/files/
  head/x11-toolkits/libgdiplus/files/extrapatch-nox11