After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 755222 - cerbero: gettext-tools compilation failure on mingw
cerbero: gettext-tools compilation failure on mingw
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: cerbero
git master
Other Windows
: Normal blocker
: 1.6.2
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks: 791807
 
 
Reported: 2015-09-18 14:07 UTC by Philippe Renon
Modified: 2017-12-20 12:19 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
windows: don't use mingw ansi stdio (660 bytes, patch)
2015-09-30 17:26 UTC, Philippe Renon
none Details | Review
m4: Fix build issue on windows (2.37 KB, patch)
2017-12-19 21:05 UTC, Xavier Claessens
none Details | Review

Description Philippe Renon 2015-09-18 14:07:21 UTC
Since the gettext version bump (http://cgit.freedesktop.org/gstreamer/cerbero/commit/?id=ff87925304c88f15e814f34bea010d5ecf5d5d71) gettext-tools fails to compile on Windows/MinGW with this error:

/bin/sh ../libtool  --tag=CC   --mode=compile i686-w64-mingw32-gcc -std=gnu99 -DHAVE_CONFIG_H -DEXEEXT=\".exe\" -DEXEEXT
=\".exe\" -DEXEEXT=\".exe\" -I. -I..  -I../intl -I../intl -I.. -I.. -DDEPENDS_ON_LIBICONV=1 -DDEPENDS_ON_LIBINTL=1 -DLIB
XML_STATIC -DUSER_LABEL_PREFIX_UNDERSCORE -DGNULIB_DEFINED_ERROR    -I./libcroco  -I/D/dev/MinGW/msys/1.0/home/Philippe.
Renon/cerbero/build-tools/include  -Wall -g -O2 -DWINVER=0x0501 -D_WIN32_WINNT=0x0501 -c -o asprintf.lo asprintf.c
libtool: compile:  i686-w64-mingw32-gcc -std=gnu99 -DHAVE_CONFIG_H -DEXEEXT=\".exe\" -DEXEEXT=\".exe\" -DEXEEXT=\".exe\"
 -I. -I.. -I../intl -I../intl -I.. -I.. -DDEPENDS_ON_LIBICONV=1 -DDEPENDS_ON_LIBINTL=1 -DLIBXML_STATIC -DUSER_LABEL_PREF
IX_UNDERSCORE -DGNULIB_DEFINED_ERROR -I./libcroco -I/D/dev/MinGW/msys/1.0/home/Philippe.Renon/cerbero/build-tools/includ
e -Wall -g -O2 -DWINVER=0x0501 -D_WIN32_WINNT=0x0501 -c asprintf.c  -DDLL_EXPORT -DPIC -o .libs/asprintf.o
asprintf.c:30:1: error: redefinition of 'asprintf'
In file included from ./stdio.h:43:0,
                 from asprintf.c:24:
d:\dev\mingw\msys\1.0\home\philippe.renon\cerbero\mingw\w32\bin\../lib/gcc/i686-w64-mingw32/4.7.3/../../../../i686-w64-m
ingw32/include/stdio.h:309:5: note: previous definition of 'asprintf' was here
make[3]: *** [asprintf.lo] Error 1

Reverting the version bump fixes the issue.
Comment 1 Philippe Renon 2015-09-29 20:29:30 UTC
I started looking at the differences between gettext-tools version 0.19.4 and 0.19.5.1 and noted potential culprit changes in :
- gettext-runtime/libasprintf/configure
- gettext-runtime/libasprintf/Makefile.in

Both those files have added references to LT_SYS_LIBRARY_PATH in various places.

This might be the cause of libtool picking up asprintf from the sys library path.

I am not sure how to proceed to fix or workaround this issue.

I am also wondering why no one else has this issue... ;)
Comment 2 Philippe Renon 2015-09-29 20:36:08 UTC
Forgot to mention that the failure happens during "cerbero bootstrap" execution.
Comment 3 Philippe Renon 2015-09-30 15:47:01 UTC
Duh...

It is not getttext-tools/gettext-runtime/libasprintf that fails to compile, but getttext-tools/gnulib-lib
Comment 4 Philippe Renon 2015-09-30 17:26:28 UTC
Created attachment 312441 [details] [review]
windows: don't use mingw ansi stdio

This fixes the gettext-tools build failure on windows/mingw.
Comment 5 Sebastian Dröge (slomo) 2015-10-02 13:15:31 UTC
Can you explain why this is needed and what it does? :)
Comment 6 Philippe Renon 2015-10-02 14:53:00 UTC
Well, I was happily compiling and coding with gstreamer 1.5.x with msys/mingw until gettext-tools version got bumped from version 0.19.4 to 0.19.5.1 (see http://cgit.freedesktop.org/gstreamer/cerbero/commit/?id=ff87925304c88f15e814f34bea010d5ecf5d5d71).

After that version bump, I started seeing the compilation error shown in first message in this bug report. The error happens when doing "cerbero bootstrap".

The duplicate definition comes from .\cerbero\mingw\w32\i686-w64-mingw32\include\stdio.h

Here is a relevant extract:

#if __USE_MINGW_ANSI_STDIO
/*
 * User has expressed a preference for C99 conformance...
 */

[SNIP]

static __attribute__ ((__unused__))
__attribute__ ((__format__ (gnu_printf, 2, 3))) __attribute__((nonnull (1,2)))
int asprintf(char **__ret, const char *__format, ...)
{
  register int __retval;
  __builtin_va_list __local_argv; __builtin_va_start( __local_argv, __format );
  __retval = __mingw_vasprintf( __ret, __format, __local_argv );
  __builtin_va_end( __local_argv );
  return __retval;
}

[SNIP]

#endif /* __USE_MINGW_ANSI_STDIO */


Another relevant part is found in .\mingw\w32\i686-w64-mingw32\include\_mingw.h

#if defined(_POSIX) && !defined(__USE_MINGW_ANSI_STDIO)
/* Enable __USE_MINGW_ANSI_STDIO if _POSIX defined
 * and If user did _not_ specify it explicitly... */
#  define __USE_MINGW_ANSI_STDIO			1
#endif



Now I am not sure why the issue started but adding the patch addresses it.
With the patch I am able to run "cerbero bootstrap" and "cerbero package gstreamer-1.0" to completion.

I am not sure it is the best solution but it does the job...

Something that gets me wondering though is that there is another gettext recipe that is triggered when running "cerbero package gstreamer-1.0" which compiles the same version of gettext tool but without any errors.
Comment 7 Philippe Renon 2015-10-02 14:58:12 UTC
To resume the patch forces the __USE_MINGW_ANSI_STDIO define to be set to 0.

This instructs mingw includes (stdio.h and others) to not define a bunch of symbols that gettext-tools defines itself.

But, again, I don't know why the duplicate symbols errors appeared all of the sudden.
Comment 8 Sebastian Dröge (slomo) 2015-10-02 15:01:09 UTC
The one built at bootstrap is used during building only, the one built during "package" is part of the resulting binaries.

It would be good to know why the latter builds just fine :)
Comment 9 Philippe Renon 2015-10-02 15:10:51 UTC
Yes, knowing why the latter build fine would be good.

Knowing why I am, apparently, the only one getting this issue would be good too. I am the only one to build with msys/mingw ? ;)
Comment 10 Philippe Renon 2015-10-02 15:19:52 UTC
There are some differences between the build-tools/gettext-tools.recipe and gettext.recipe but none that could explain, to my knowledge, why one succeeds to compile and not the other.

The gettext.recipe applies a patch that sounds related to the issue but adding the same to build-tools/gettext-tools.recipe did not make a difference.
Comment 11 Philippe Renon 2015-10-02 15:24:57 UTC
I think I know why gettext compiles while gettext-tools does not.

gettext-tools.recipe will compile gettext/gettext-tools and by extension gettext/gettext-tools/gnulib-lib which has an asprintf.c file.

gettext.recipe will compile gettext/gettext-runtime and by extension gettext/gettext-runtime/gnulib-lib which has *not* an asprintf.c file.
Comment 12 Philippe Renon 2015-10-02 15:28:29 UTC
Sorry to spam... to bad one cannot modify a comment...

But the difference between the two recipes that ...makes a difference... lies in the different value given to the srcdir property.
Comment 13 Philippe Renon 2015-10-02 15:34:32 UTC
Could that dependency be the cause of our woes :

Platform.WINDOWS:  ['mingw-runtime']

Apparently gettext and gettext-tools are the only two recipes to have this dep.
Comment 14 Sebastian Dröge (slomo) 2015-10-13 09:44:04 UTC
Does it work without any other changes if you remove that dependency? Not sure why it is there
Comment 15 Edward Hervey 2015-10-13 09:54:59 UTC
If you do tests, please do so from a "clean" setup. i.e. wipe --force --build-tools

Otherwise it might pick up stuff from previous builds.
Comment 16 Philippe Renon 2015-10-13 10:04:26 UTC
I tested without the mingw-runtime dependency and got the same issue.
Seems that the dependency is not needed but removing it did not address the issue.

I'll try again with a wipe (and with and without my proposed fix).

Will report back later.
Comment 17 Philippe Renon 2015-10-13 12:26:30 UTC
New test after a wipe confirms that removing the  mingw-runtime dependency does not address the issue.

I noticed that the configure step reports:

Running command './configure --prefix /D/dev/MinGW/msys/1.0/home/Philippe.Renon/cerbero/build-tools --libdir /D/dev/MinG
W/msys/1.0/home/Philippe.Renon/cerbero/build-tools/lib  --disable-java --disable-csharp --disable-native-java --without-
csv --enable-threads=win32 --disable-maintainer-mode  --disable-silent-rules  --disable-introspection  ne_cv_libsfor_get
hostbyname="-lws2_32" ac_cv_c_attribute_aligned="64" ac_cv_func_realloc_0_nonnull="yes" lt_cv_deplibs_check_method="pass
_all" am_cv_python_pyexecdir="D:/dev/MinGW/msys/1.0/home/Philippe.Renon/cerbero/build-tools/lib/python2.7/site-packages"
 ac_cv_lib_bz2_BZ2_bzlibVersion="yes" am_cv_python_version="2.7" ne_cv_libsfor_socket="-lws2_32" am_cv_python_platform="
win32" am_cv_python_pythondir="D:/dev/MinGW/msys/1.0/home/Philippe.Renon/cerbero/build-tools/lib/python2.7/site-packages
" ac_cv_func_malloc_0_nonnull="yes" --host=i686-w64-mingw32 --build=i686-w64-mingw32 --target=i686-w64-mingw32'
[SNIP]
checking for asprintf... no
[SNIP]

But compilation fails with:

libtool: compile:  i686-w64-mingw32-gcc -std=gnu99 -DHAVE_CONFIG_H -DEXEEXT=\".exe\" -DEXEEXT=\".exe\" -DEXEEXT=\".exe\"
 -I. -I.. -I../intl -I../intl -I.. -I.. -DDEPENDS_ON_LIBICONV=1 -DDEPENDS_ON_LIBINTL=1 -DLIBXML_STATIC -DUSER_LABEL_PREFIX_UNDERSCORE -DGNULIB_DEFINED_ERROR -I./libcroco -I/D/dev/MinGW/msys/1.0/home/Philippe.Renon/cerbero/build-tools/include -Wall -g -O2 -DWINVER=0x0501 -D_WIN32_WINNT=0x0501 -c asprintf.c  -DDLL_EXPORT -DPIC -o .libs/asprintf.o
asprintf.c:30:1: error: redefinition of 'asprintf'
In file included from ./stdio.h:43:0,
                 from asprintf.c:24:

There is no reference to /D/dev/MinGW/msys/1.0/home/Philippe.Renon/cerbero/build-tools/include when configuring but it shows up when compiling.
Comment 18 Keith Thornton 2015-10-13 12:38:03 UTC
your not the only one having this problem. I am also having it. I have a clean installation in a virtual machine.
Comment 19 Philippe Renon 2015-10-13 12:43:26 UTC
Thank Keith, good to know.

My last sentence in my last message is not relevant. Please ignore it.
I need sleep...
Comment 20 Thibault Jochem 2015-10-13 14:47:27 UTC
I also have the issue, trying to build gstreamer to cook my own patch to solve an issue.
Comment 21 Philippe Renon 2015-10-13 15:05:42 UTC
Removing the mingw-runtime dependency and applying my patch works.

So it looks like this dependency is not need (but does not cause the issue).
Comment 22 Philippe Renon 2015-10-18 18:00:42 UTC
mingw-runtime *is* needed. It copies some mingw libraries to the gstreamer dist dir.
Comment 23 Philippe Renon 2015-11-19 20:26:58 UTC
Seems like this commit did what was suggested here : http://cgit.freedesktop.org/gstreamer/cerbero/commit/?id=6c8bf12e230778cc7bfd296ac7b5d29b3d5e0145
Comment 24 Sebastian Dröge (slomo) 2015-11-19 21:56:56 UTC
Not completely, it's only undefining that for this single file as for others it's beneficial to have. The gnulib configure macros are actually explicitly checking for the existence of this.
Comment 25 Philippe Renon 2015-11-20 07:27:08 UTC
No problems... Just wanted to link to your fix.
Comment 26 Sebastian Dröge (slomo) 2015-11-20 09:24:35 UTC
Sure, I completely forgot about this bug actually :) It's good to have this tracked in Bugzilla in any case.
Comment 27 Xavier Claessens 2017-12-19 21:05:15 UTC
Created attachment 365770 [details] [review]
m4: Fix build issue on windows
Comment 28 Xavier Claessens 2017-12-19 21:05:49 UTC
m4 fails too for me. Exactly the same patch fixed it.
Comment 29 Nicolas Dufresne (ndufresne) 2017-12-19 22:34:09 UTC
Xavier, the Clone button is hidden bottom right. Thread reason we want this is because we cannot set two versions in which it was fixed.