Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 654712 - media-libs/freetype-2.9.1 does not build with sys-devel/binutils[multitarget] (fatal error: windows.h: No such file or directory)
Summary: media-libs/freetype-2.9.1 does not build with sys-devel/binutils[multitarget]...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Lars Wendler (Polynomial-C) (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-05-03 10:18 UTC by Marien Zwart
Modified: 2018-05-04 06:53 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log (build.log,15.69 KB, text/plain)
2018-05-03 10:18 UTC, Marien Zwart
Details
emerge --info (file_654712.txt,6.68 KB, text/plain)
2018-05-03 10:19 UTC, Marien Zwart
Details
config.log (config.log,36.23 KB, text/plain)
2018-05-03 10:21 UTC, Marien Zwart
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Marien Zwart 2018-05-03 10:18:50 UTC
Created attachment 529552 [details]
build.log

media-libs/freetype-2.9.1 does not build (freetype-2.9.0 is fine):

libtool: compile:  x86_64-pc-linux-gnu-windres /var/tmp/portage/media-libs/freetype-2.9.1/work/freetype-2.9.1/src/base/ftver.rc  -o /var/tmp/portage/media-libs/freetype-2.9.1/work/freetype-2.9.1-abi_x86_64.amd64/.libs/ftver.o
/var/tmp/portage/media-libs/freetype-2.9.1/work/freetype-2.9.1/src/base/ftver.rc:19:9: fatal error: windows.h: No such file or directory
 #include<windows.h>
         ^~~~~~~~~~~

(will attach the full build log, config.log and emerge --info)

This is a Linux (~amd64) system. windows.h should not be there.

The problem isn't specific to the ebuild: manual "./configure && make" of freetype-2.9.1 fails similarly.

The problem is introduced by the following two upstream commits:

http://git.savannah.gnu.org/cgit/freetype/freetype2.git/commit/?id=fd8000f0402d48fd22f774170c74d585a82d7508
http://git.savannah.gnu.org/cgit/freetype/freetype2.git/commit/?id=4b8ccc56d8b4971a4f0434f497d74c641402222d

These move ftver.rc out of the Windows-specific build, and have autotools build it if windres is found. Even though (other than app-emulation/wine) there shouldn't be anything to do with Windows on this system, binutils provides windres:

[ebuild   R    ] sys-devel/binutils-2.30-r2:2.30::gentoo  USE="cxx doc multitarget nls -static-libs {-test}" 0 KiB     

% qlist sys-devel/binutils|grep windres
/usr/share/binutils-data/x86_64-pc-linux-gnu/2.30/man/man1/windres.1
/usr/x86_64-pc-linux-gnu/binutils-bin/2.30/windres

Which is symlinked from /usr/bin:

lrwxrwxrwx 1 root root 36 May  2 22:20 /usr/bin/x86_64-pc-linux-gnu-windres -> /usr/x86_64-pc-linux-gnu/bin/windres
lrwxrwxrwx 1 root root 50 May  2 22:20 /usr/x86_64-pc-linux-gnu/bin/windres -> /usr/x86_64-pc-linux-gnu/binutils-bin/2.30/windres
Comment 1 Marien Zwart 2018-05-03 10:19:30 UTC
Created attachment 529554 [details]
emerge --info
Comment 2 Marien Zwart 2018-05-03 10:21:24 UTC
Created attachment 529556 [details]
config.log
Comment 3 Marien Zwart 2018-05-03 10:34:58 UTC
Looks like the culprit is sys-devel/binutils[multitarget]. Built without that flag, binutils does not provide windres.

multitarget is not on by default, only depended upon by a tiny number of ebuilds, and probably not something one would otherwise enable. So I wouldn't expect many people to run into this.
Comment 4 Ulenrich 2018-05-03 11:12:31 UTC
My freetype only has one bin file, called /usr/bin and probalby is ttdebug

 freetype-2.9.1.tbz2/utar://usr
-rwxr-xr-x  1 root     root       39120 Mai  3 12:23 bin
Comment 5 Ulenrich 2018-05-03 11:22:37 UTC
I am just happily recognizing my Gentoo installation survived the emerge of freetype-2.9.1, because emerge had renamed the /usr/bin file.
But my issue seems to be a different bug ....
Comment 6 Sergei Trofimovich (RETIRED) gentoo-dev 2018-05-03 22:30:20 UTC
Ideally freetype should try to use windres (and as a result windows.h) only if --host is a windows host (as .rc resource embedding is only used on PE32/32+ nowadays).

In ebuilds it can be worked around by passing empty RC after matching on CHOST in a similar way:

This seems to work for me:

diff --git a/media-libs/freetype/freetype-2.9.1.ebuild b/media-libs/freetype/freetype-2.9.1.ebuild
index b5c2fb86dea..b32a8ff7c76 100644
--- a/media-libs/freetype/freetype-2.9.1.ebuild
+++ b/media-libs/freetype/freetype-2.9.1.ebuild
@@ -174,6 +174,12 @@ multilib_src_configure() {
                LIBPNG_CFLAGS="$($(tc-getPKG_CONFIG) --cflags libpng)"
                LIBPNG_LDFLAGS="$($(tc-getPKG_CONFIG) --libs libpng)"
        )
+       case ${CHOST} in
+               mingw*|*-mingw*) ;;
+               # Workaround windows mis-detection: bug #654712
+               # Have to do it for both ${CHOST}-windres and windres
+               *) myeconfargs+=(ac_cv_prog_RC= ac_cv_prog_ac_ct_RC=) ;;
+       esac
 
        ECONF_SOURCE="${S}" econf "${myeconfargs[@]}"
 }
Comment 7 Larry the Git Cow gentoo-dev 2018-05-04 06:53:05 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=dd38b4c265dd04f2659a0d4518bc687f82c168ac

commit dd38b4c265dd04f2659a0d4518bc687f82c168ac
Author:     Lars Wendler <polynomial-c@gentoo.org>
AuthorDate: 2018-05-04 06:52:56 +0000
Commit:     Lars Wendler <polynomial-c@gentoo.org>
CommitDate: 2018-05-04 06:52:56 +0000

    media-libs/freetype: Workaround windows mis-detection
    
    Thanks to slyfox for providing a fix.
    
    Closes: https://bugs.gentoo.org/654712
    Package-Manager: Portage-2.3.35, Repoman-2.3.9

 media-libs/freetype/freetype-2.9.1-r1.ebuild | 7 +++++++
 media-libs/freetype/freetype-9999.ebuild     | 7 +++++++
 2 files changed, 14 insertions(+)