bugGNU gettext - Bugs: bug #36443, Compiling fails when compiling...

 
 

bug #36443: Compiling fails when compiling with -O0 under mingw

Submitted by:  None
Submitted on:  Wed 09 May 2012 07:00:14 PM UTC  
 
Category: NoneSeverity: 2 - Minor
Item Group: NoneStatus: Need Info
Privacy: PublicAssigned to: Daiki Ueno <ueno>
Open/Closed: Open

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

Please log in, so followups can be emailed to you.

 

(Jump to the original submission Jump to the original submission)

Fri 13 Dec 2013 02:20:39 AM UTC, comment #11:

The last patch was against 0.18.3.1 and included the needed change for gettext-tools/src/Makefile.in for people who use the release tarball.

I will submit another patch against the latest from git soon.

Anonymous
Mon 12 Aug 2013 07:44:32 AM UTC, comment #10:

Unfortunately, not yet. It is not that easy to fix in the gettext side, but there is a workaround (use -O2). Setting the severity minor.

Daiki Ueno <ueno>
Project AdministratorIn charge of this item.
Sun 11 Aug 2013 04:48:28 PM UTC, comment #9:

I am having the same problem with 0.18.3, is it supposed to be fixed in this version?

Antonio

Antonio Dell Elce <dellelce>
Thu 17 Jan 2013 09:36:22 AM UTC, comment #8:

I guess those ostream link errors could be fixed by adding C++ wrapper in gettext-tools/woe32dll/ and linking them to the library (patch attached, bootstrapping is needed).

However, some errors still remain.

(file #27292)

Daiki Ueno <ueno>
Project AdministratorIn charge of this item.
Tue 25 Dec 2012 11:46:54 AM UTC, comment #7:

And again

export CFLAGS="$CFLAGS -O2"
export CXXFLAGS="$CXXFLAGS -O2"

before 'configure' fixes this problem.

Evgeny Grin <karlson2k>
Tue 25 Dec 2012 11:33:07 AM UTC, comment #6:

Same for 0.18.2
MinGW-w64 + Msys + GCC 4.7.2 on Windows 7 x64
Both Win32 and Win64 toolchains have same errors:

GEN libgettextlib.la
../woe32dll/.libs/c++html-styled-ostream.o:c++html-styled-ostream.cc:(.text+0x4d): undefined reference to `html_ostream_write_mem(any_ostream_representation, void const, unsigned int)'
../woe32dll/.libs/c++html-styled-ostream.o:c++html-styled-ostream.cc:(.text+0x63): undefined reference to `html_ostream_flush(any_ostream_representation*)'
../woe32dll/.libs/c++html-styled-ostream.o:c++html-styled-ostream.cc:(.text+0x79): undefined reference to `html_ostream_free(any_ostream_representation*)'
../woe32dll/.libs/c++html-styled-ostream.o:c++html-styled-ostream.cc:(.text+0xc2): undefined reference to `html_ostream_begin_span(any_ostream_representation, char const)'
../woe32dll/.libs/c++html-styled-ostream.o:c++html-styled-ostream.cc:(.text+0xdf): undefined reference to `html_ostream_end_span(any_ostream_representation, char const)'
../woe32dll/.libs/c++html-styled-ostream.o:c++html-styled-ostream.cc:(.text+0x268): undefined reference to `ostream_write_mem(any_ostream_representation, void const, unsigned int)'
t:/mingw-w64/mingw/bin/../lib/gcc/i686-w64-mingw32/4.7.2/../../../../i686-w64-mingw32/bin/ld.exe: ../woe32dll/.libs/c++html-styled-ostream.o: bad reloc address 0x0 in section `.data'
collect2.exe: error: ld returned 1 exit status
make[3]: *** [libgettextlib.la] Error 1

Just make sure that no -O1, -O2 or -O3 flags for GCC are used (or use -O0). Check 'Makefile' and set -O0 flag.
One more note: 'configure' trying to set -O2 flag for GCC, but it fails to detect GCC when cross-compiling (MinGW-w64 is actually a cross-compiled even on Msys/Windows)

Moreover, new problem with 0.18.2 and -O0 flag:

libtool: link: i686-w64-mingw32-gcc -std=gnu99 -shared .libs/bindtextdom.o .libs/dcgettext.o .libs/dgettext.o .libs/gettext.o .libs/finddomain.o .libs/hash-string.o .libs/loadmsgcat.o .libs/localealias.o .libs/textdomain.o .libs/l10nflist.o .libs/explodename.o .libs/dcigettext.o .libs/dcngettext.o .libs/dngettext.o .libs/ngettext.o .libs/plural.o .libs/plural-exp.o .libs/localcharset.o .libs/threadlib.o .libs/lock.o .libs/relocatable.o .libs/langprefs.o .libs/localename.o .libs/log.o .libs/printf.o .libs/setlocale.o .libs/version.o .libs/osdep.o .libs/intl-compat.o .libs/libintl.res.o -L/mingw/i686-w64-mingw32/lib /mingw/i686-w64-mingw32/lib/libiconv.dll.a -m32 -m32 -Wl,--disable-auto-import -Wl,--export-all-symbols -o .libs/libintl-8
.dll -Wl,--enable-auto-image-base -Xlinker --out-implib -Xlinker .libs/libintl.dll.a
.libs/printf.o:printf.c:(.text+0x491): undefined reference to `xsum'
.libs/printf.o:printf.c:(.text+0x662): undefined reference to `xsum'
.libs/printf.o:printf.c:(.text+0x713): undefined reference to `xsum'
.libs/printf.o:printf.c:(.text+0x984): undefined reference to `xsum'
.libs/printf.o:printf.c:(.text+0xa35): undefined reference to `xsum'
.libs/printf.o:printf.c:(.text+0xed9): more undefined references to `xsum' follow
.libs/printf.o:printf.c:(.text+0x1543): undefined reference to `xsum4'
.libs/printf.o:printf.c:(.text+0x1654): undefined reference to `xsum'
.libs/printf.o:printf.c:(.text+0x1791): undefined reference to `xsum'
.libs/printf.o:printf.c:(.text+0x1aa4): undefined reference to `xsum'
.libs/printf.o:printf.c:(.text+0x1b93): undefined reference to `xsum'
.libs/printf.o:printf.c:(.text+0x1e66): undefined reference to `xsum'
.libs/printf.o:printf.c:(.text+0x1ea7): more undefined references to `xsum' follow
.libs/printf.o:printf.c:(.text+0x42aa): undefined reference to `xmax'
.libs/printf.o:printf.c:(.text+0x43de): undefined reference to `xsum'
.libs/printf.o:printf.c:(.text+0x441d): undefined reference to `xsum'
.libs/printf.o:printf.c:(.text+0x4435): undefined reference to `xsum'
.libs/printf.o:printf.c:(.text+0x4b38): undefined reference to `xsum'
.libs/printf.o:printf.c:(.text+0x4d25): undefined reference to `xsum'
.libs/printf.o:printf.c:(.text+0x4dda): more undefined references to `xsum' follow
.libs/printf.o:printf.c:(.text+0x5c3c): undefined reference to `xsum4'
.libs/printf.o:printf.c:(.text+0x5d64): undefined reference to `xsum'
.libs/printf.o:printf.c:(.text+0x5eb6): undefined reference to `xsum'
.libs/printf.o:printf.c:(.text+0x61e2): undefined reference to `xsum'
.libs/printf.o:printf.c:(.text+0x62d1): undefined reference to `xsum'
.libs/printf.o:printf.c:(.text+0x6570): undefined reference to `xsum'
.libs/printf.o:printf.c:(.text+0x65b1): more undefined references to `xsum' follow
.libs/printf.o:printf.c:(.text+0x8a19): undefined reference to `xmax'
.libs/printf.o:printf.c:(.text+0x8b5d): undefined reference to `xsum'
.libs/printf.o:printf.c:(.text+0x8b9c): undefined reference to `xsum'
.libs/printf.o:printf.c:(.text+0x8bb4): undefined reference to `xsum'
t:/mingw-w64/mingw/bin/../lib/gcc/i686-w64-mingw32/4.7.2/../../../../i686-w64-mingw32/bin/ld.exe: .libs/printf.o: bad reloc address 0x8 in section `.r
data'
collect2.exe: error: ld returned 1 exit status

Will report it separately

Evgeny Grin <karlson2k>
Tue 25 Dec 2012 08:05:31 AM UTC, comment #5:

I cannot reproduce the "undefined reference" issue when cross compiling. Could anyone check this with 0.18.2 released today? It has fixes for redefinition of getopt variables and test-lock.c compilation failure.

Daiki Ueno <ueno>
Project AdministratorIn charge of this item.
Thu 20 Dec 2012 08:07:08 AM UTC, comment #4:

Yes, this is actually bug!

When not using -O(1-3) compiler flags, this section of html-ostream.h generated file becomes effective (not inlined version):
--------
/* Functions that invoke the methods. */
extern void html_ostream_write_mem (html_ostream_t first_arg, const void *data, size_t len);
extern void html_ostream_flush (html_ostream_t first_arg);
extern void html_ostream_free (html_ostream_t first_arg);
extern void html_ostream_begin_span (html_ostream_t first_arg, const char *classname);
extern void html_ostream_end_span (html_ostream_t first_arg, const char *classname);
--------

But this section is not surrounded with
------
#ifdef __cplusplus
extern "C" {
#endif
------
lines, so C++ code can't be linked with this C function.

Evgeny Grin <karlson2k>
Fri 23 Nov 2012 09:32:18 PM UTC, comment #3:

I am getting the same exact errors on Windows Vista with MinGW/GCC 4.7:

My compiler is detected correctly and it is set to use -O2 optimization. I dropped down to version 0.17 and was able to compile but had to fix a couple things:

  • I had to add "LIBS=-lpthread".
  • I had to apply the following patch due to undefined

references to rpl_optarg and rpl_optind:

Anonymous
Fri 12 Oct 2012 06:08:01 PM UTC, comment #2:

I had the same problem but I'm pretty sure this is not due to optimization flags.

I've been able to cross compile to mingw-w64 (32 and 64 bits) with -O2 but, apart from the usual workarounds (Fedora and openSUSE docet), I had to explicitely pass CXX="$arch-g++" to the main configure because gettext-tools/configure was unable to autodetect it (it was setting CXX to : and CXXCPP to /lib/cpp).

No idea why though... gettext-runtime/configure works flawlessly detecting CXX properly.

Nicola Fontana <ntd>
Sun 03 Jun 2012 12:00:41 AM UTC, comment #1:

Compile with CFLAGS="-O1" or higher.
This will allow gcc to use inlining, and the html_ostream_* functions will be inlined instead of being compiled in separate object files and linked.

LRN <lrn>
Wed 09 May 2012 07:00:14 PM UTC, original submission:

libtool: link: g++ -shared -nostdlib d:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../dllcrt2.o d:/mingw/bin/../lib/gcc/mingw32/4.6.2/crtbegin.o .libs/set-mode-a
cl.o .libs/copy-acl.o .libs/file-has-acl.o .libs/areadlink.o .libs/gl_array_list.o .libs/backupfile.o .libs/addext.o .libs/basename.o .libs/c-ctype.o .libs/c-st
rcasecmp.o .libs/c-strncasecmp.o .libs/c-strcasestr.o .libs/c-strstr.o .libs/classpath.o .libs/clean-temp.o .libs/closeout.o .libs/concat-filename.o .libs/copy-
file.o .libs/csharpcomp.o .libs/csharpexec.o .libs/error-progname.o .libs/execute.o .libs/exitfail.o .libs/fatal-signal.o .libs/fd-ostream.o .libs/fd-safer-flag
.o .libs/dup-safer-flag.o .libs/file-ostream.o .libs/findprog.o .libs/fstrcmp.o .libs/full-write.o .libs/fwriteerror.o .libs/gcd.o ../woe32dll/.libs/gettextlib-
exports.o .libs/hash.o .libs/html-ostream.o ../woe32dll/.libs/c++html-styled-ostream.o .libs/javacomp.o .libs/javaexec.o .libs/javaversion.o .libs/gl_linkedhash
_list.o .libs/gl_list.o .libs/localcharset.o .libs/localename.o glthread/.libs/lock.o .libs/malloca.o .libs/mbchar.o .libs/mbslen.o .libs/mbsstr.o .libs/mbswidt
h.o .libs/ostream.o .libs/pipe.o .libs/pipe-filter-ii.o .libs/pipe2.o .libs/pipe2-safer.o .libs/progname.o .libs/propername.o .libs/quote.o .libs/quotearg.o .li
bs/sh-quote.o .libs/striconv.o .libs/striconveh.o .libs/striconveha.o .libs/strnlen1.o .libs/styled-ostream.o .libs/term-ostream.o ../woe32dll/.libs/c++term-sty
led-ostream.o glthread/.libs/threadlib.o glthread/.libs/tls.o .libs/tmpdir.o .libs/trim.o uniconv/.libs/u8-conv-from-enc.o unilbrk/.libs/lbrktables.o unilbrk/.l
ibs/u8-possible-linebreaks.o unilbrk/.libs/u8-width-linebreaks.o unilbrk/.libs/ulc-common.o unilbrk/.libs/ulc-width-linebreaks.o uniname/.libs/uniname.o unistr/
.libs/u16-mbtouc.o unistr/.libs/u16-mbtouc-aux.o unistr/.libs/u8-check.o unistr/.libs/u8-mblen.o unistr/.libs/u8-mbtouc.o unistr/.libs/u8-mbtouc-aux.o unistr/.l
ibs/u8-mbtouc-unsafe.o unistr/.libs/u8-mbtouc-unsafe-aux.o unistr/.libs/u8-mbtoucr.o unistr/.libs/u8-prev.o unistr/.libs/u8-uctomb.o unistr/.libs/u8-uctomb-aux.
o uniwidth/.libs/width.o .libs/wait-process.o .libs/xmalloc.o .libs/xstrdup.o .libs/xconcat-filename.o .libs/xerror.o .libs/gl_xlist.o .libs/xmalloca.o .libs/xr
eadlink.o .libs/xsetenv.o .libs/xstriconv.o .libs/xstriconveh.o .libs/xvasprintf.o .libs/xasprintf.o .libs/argmatch.o .libs/asnprintf.o .libs/asprintf.o .libs/c
anonicalize-lgpl.o .libs/cloexec.o .libs/dup-safer.o .libs/dup2.o .libs/error.o .libs/fcntl.o .libs/fd-safer.o .libs/fnmatch.o .libs/fopen.o .libs/getdelim.o .l
ibs/getdtablesize.o .libs/getline.o .libs/getopt.o .libs/getopt1.o .libs/lstat.o .libs/malloc.o .libs/mkdtemp.o .libs/obstack.o .libs/open.o .libs/pipe-safer.o
.libs/printf-args.o .libs/printf-parse.o .libs/rawmemchr.o .libs/readlink.o .libs/realloc.o .libs/rmdir.o .libs/safe-read.o .libs/safe-write.o .libs/setenv.o .l
ibs/sigaction.o .libs/sigprocmask.o .libs/spawn_faction_addclose.o .libs/spawn_faction_adddup2.o .libs/spawn_faction_addopen.o .libs/spawn_faction_destroy.o .li
bs/spawn_faction_init.o .libs/spawnattr_destroy.o .libs/spawnattr_init.o .libs/spawnattr_setflags.o .libs/spawnattr_setsigmask.o .libs/spawni.o .libs/spawnp.o .
libs/stat.o .libs/stdio-write.o .libs/stpcpy.o .libs/stpncpy.o .libs/strchrnul.o .libs/strerror.o .libs/strnlen.o .libs/strstr.o .libs/tempname.o .libs/tparm.o
.libs/tputs.o .libs/unsetenv.o .libs/vasnprintf.o .libs/vasprintf.o .libs/wcwidth.o .libs/write.o -Wl,--whole-archive ./.libs/libcroco_rpl.a -Wl,--no-whole-arc
hive ../intl/.libs/libintl.dll.a -L/mingw/lib /mingw/lib/libglib-2.0.dll.a -lole32 -lwinmm -lshlwapi /mingw/lib/libintl.dll.a /mingw/lib/libxml2.dll.a -lz -lws
2_32 /mingw/lib/libiconv.dll.a -Ld:/mingw/bin/../lib/gcc/mingw32/4.6.2 -Ld:/mingw/bin/../lib/gcc -Ld:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../../mingw32/lib
-Ld:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../.. -lstdc++ -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt -ladvapi32 -lshell32 -luser32 -lkernel32 -lming
w32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt d:/mingw/bin/../lib/gcc/mingw32/4.6.2/crtend.o -march=i686 -Wl,--export-all-symbols -Wl,--disable-auto-import
-o .libs/libgettextlib-0-18-1.dll -Wl,--enable-auto-image-base -Xlinker --out-implib -Xlinker .libs/libgettextlib.dll.a
Creating library file: .libs/libgettextlib.dll.a
../woe32dll/.libs/c++html-styled-ostream.o:c++html-styled-ostream.cc:(.text+0x31): undefined reference to `html_ostream_write_mem(any_ostream_representation*, v
oid const*, unsigned int)'
../woe32dll/.libs/c++html-styled-ostream.o:c++html-styled-ostream.cc:(.text+0x47): undefined reference to `html_ostream_flush(any_ostream_representation*)'
../woe32dll/.libs/c++html-styled-ostream.o:c++html-styled-ostream.cc:(.text+0x5d): undefined reference to `html_ostream_free(any_ostream_representation*)'
../woe32dll/.libs/c++html-styled-ostream.o:c++html-styled-ostream.cc:(.text+0xa6): undefined reference to `html_ostream_begin_span(any_ostream_representation*,
char const*)'
../woe32dll/.libs/c++html-styled-ostream.o:c++html-styled-ostream.cc:(.text+0xc3): undefined reference to `html_ostream_end_span(any_ostream_representation*, ch
ar const*)'
../woe32dll/.libs/c++html-styled-ostream.o:c++html-styled-ostream.cc:(.text+0x248): undefined reference to `ostream_write_mem(any_ostream_representation*, void
const*, unsigned int)'
../woe32dll/.libs/c++term-styled-ostream.o:c++term-styled-ostream.cc:(.text+0x1c): undefined reference to `term_ostream_set_color(any_ostream_representation*, i
nt)'
../woe32dll/.libs/c++term-styled-ostream.o:c++term-styled-ostream.cc:(.text+0x37): undefined reference to `term_ostream_set_bgcolor(any_ostream_representation*,
int)'
../woe32dll/.libs/c++term-styled-ostream.o:c++term-styled-ostream.cc:(.text+0x52): undefined reference to `term_ostream_set_weight(any_ostream_representation*,
term_weight_t)'
../woe32dll/.libs/c++term-styled-ostream.o:c++term-styled-ostream.cc:(.text+0x6d): undefined reference to `term_ostream_set_posture(any_ostream_representation*,
term_posture_t)'
../woe32dll/.libs/c++term-styled-ostream.o:c++term-styled-ostream.cc:(.text+0x88): undefined reference to `term_ostream_set_underline(any_ostream_representation
*, term_underline_t)'
../woe32dll/.libs/c++term-styled-ostream.o:c++term-styled-ostream.cc:(.text+0xa4): undefined reference to `term_ostream_write_mem(any_ostream_representation*, v
oid const*, unsigned int)'
../woe32dll/.libs/c++term-styled-ostream.o:c++term-styled-ostream.cc:(.text+0xba): undefined reference to `term_ostream_flush(any_ostream_representation*)'
../woe32dll/.libs/c++term-styled-ostream.o:c++term-styled-ostream.cc:(.text+0xd0): undefined reference to `term_ostream_free(any_ostream_representation*)'
../woe32dll/.libs/c++term-styled-ostream.o:c++term-styled-ostream.cc:(.text+0x63d): undefined reference to `term_ostream_rgb_to_color(any_ostream_representation
*, int, int, int)'
../woe32dll/.libs/c++term-styled-ostream.o:c++term-styled-ostream.cc:(.text+0xd8a): undefined reference to `term_ostream_free(any_ostream_representation*)'
collect2: ld returned 1 exit status
make[4]: *** [libgettextlib.la] Error 1
make[4]: Leaving directory `/gettext-0.18.1.1/gettext-tools/gnulib-lib'
make[3]: *** [all] Error 2
make[3]: Leaving directory `/gettext-0.18.1.1/gettext-tools/gnulib-lib'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/gettext-0.18.1.1/gettext-tools'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/gettext-0.18.1.1/gettext-tools'
make: *** [all-recursive] Error 1

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #29914:  0001-Fix-Woe32-link-errors-when-compiling-with-O0.patch added by None (9kB - text/x-patch - Patch against git.)
file #29913:  120-Fix-Woe32-link-errors-when-compiling-with-O0.patch added by None (20kB - application/octet-stream - I updated Daiki's patch a little as it was dropping color.c or ../woe32dll/c++color.cc from the objects and also un-necessarily re-ordering things resulting in a bigger patch.)
file #27292:  0001-Fix-Woe32-link-errors-when-compiling-with-O0.patch added by ueno (8kB - text/x-patch - patch for -O0 link errors)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by dellelce (Posted a comment)
  • -unavailable- added by ueno (Posted a comment)
  • -unavailable- added by karlson2k (Posted a comment)
  • -unavailable- added by ntd (Posted a comment)
  • -unavailable- added by lrn (Posted a comment)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 7 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 13 Dec 2013 02:21:28 AM UTCNoneAttached File-=>Added 0001-Fix-Woe32-link-errors-when-compiling-with-O0.patch, #29914
    Fri 13 Dec 2013 02:04:18 AM UTCNoneAttached File-=>Added 120-Fix-Woe32-link-errors-when-compiling-with-O0.patch, #29913
    Mon 12 Aug 2013 07:44:32 AM UTCuenoSeverity3 - Normal=>2 - Minor
      SummaryCompiling fails for gettext-0.18.1.1 under mingw=>Compiling fails when compiling with -O0 under mingw
    Thu 17 Jan 2013 09:36:22 AM UTCuenoAttached File-=>Added 0001-Fix-Woe32-link-errors-when-compiling-with-O0.patch, #27292
    Tue 25 Dec 2012 08:05:31 AM UTCuenoStatusNone=>Need Info
      Assigned toNone=>ueno

    Back to the top


    Powered by Savane 3.1-cleanup