1
votes

I am attempting to use Mingw-w64's 32-bit compiler (the i686-w64-mingw32 toolchain) to cross-compile the ICU library for Windows. The host is Ubuntu 12.10 64-bit.

The steps I have taken look something like this:

  1. Grab the latest source code archive from here and extract it.

  2. Make two copies of the source/ directory - one for the host and one for the target.

  3. For the host build:

    ./configure ; make
  4. For the target build:

    ./configure --host=i686-w64-mingw32 --with-cross-build=<host_source_dir>

    ...where <host_source_dir> is the directory from the previous step.

  5. When I run make in the target source directory, compilation proceeds without any errors for a few moments and then throws this error:

    i686-w64-mingw32-g++ -O2 -W -Wall -pedantic -Wpointer-arith -Wwrite-strings
    -Wno-long-long -mthreads  -o ../../bin/uconv.exe uconv.o uwmsg.o
    -L../../lib -licuin50 -L../../lib -licuuc50 -L../../stubdata -licudt50
    -lm   uconvmsg/uconvmsg.a
    uconv.o:uconv.cpp:(.text+0x2f): undefined reference to `_uconvmsg_dat'

What could be causing this error? I backed up a few lines and also noticed this:

pkgdata: i686-w64-mingw32-gcc -O2 -Wall -std=c99 -pedantic -Wshadow
  -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -mthreads  -shared
  -Wl,-Bsymbolic -Wl,--enable-auto-import -Wl,--out-implib=./all.lib  -o
  ../lib/icudt50.dll ./out/tmp/icudt50l_dat.o
Cannot export icudt50_dat: symbol not found
collect2: ld returned 1 exit status
-- return status = 256
Error generating library file. Failed command: i686-w64-mingw32-gcc -O2 -Wall
  -std=c99 -pedantic -Wshadow -Wpointer-arith -Wmissing-prototypes
  -Wwrite-strings -mthreads -shared -Wl,-Bsymbolic -Wl,--enable-auto-import
  -Wl,--out-implib=./all.lib -o ../lib/icudt50.dll ./out/tmp/icudt50l_dat.o   
Error generating assembly code for data.

What am I doing wrong?

2

2 Answers

0
votes

In order to debug your symbol problem just provide the flag -Wl,--trace-symbol=_uconvmsg_dat to i686-w64-mingw32-g++ like follows:

i686-w64-mingw32-g++ -O2 -W -Wall -pedantic -Wpointer-arith -Wwrite-strings -Wno-long-long -mthreads -o ../../bin/uconv.exe uconv.o uwmsg.o -L../../lib -licuin50 -L../../lib -licuuc50 -L../../stubdata -licudt50 -lm uconvmsg/uconvmsg.a -Wl,--trace-symbol=_uconvmsg_dat

0
votes

So it turns out that the problem was indeed with the ICU source code. I'm not sure I understand exactly what the problem is, but thankfully someone else did and wrote three patches.

The first two apply to my question above:

The third patch is used instead of the second in the list above when building for the x86_64 architecture:

There does still seem to be a problem when running make install, but at least the source tree seems to build now.