[tlbuild] --host is not passed to ICU

Mojca Miklavec mojca.miklavec.lists at gmail.com
Thu May 4 13:09:49 CEST 2017


Hi,

I'm sorry for the "wrong" report about cross compilation.

On 1 May 2017 at 16:59, Mojca Miklavec wrote:
> Hi,
>
> I tried to cross-compile TL with some of the flags that I have
> shamelessly "stolen" from LuaTeX's build script (not sure if those
> C[XX]FLAGS actually make sense):
>
> NAME=x86_64-w64-mingw32
> export CC=${NAME}-gcc
> export CXX=${NAME}-g++
> export RANLIB=${NAME}-ranlib
> export STRIP=${NAME}-strip
> export CFLAGS="-mtune=nocona -g -O3 -fno-lto -fno-use-linker-plugin ${CFLAGS}"
> export CXXFLAGS="-mtune=nocona -g -O3 -fno-lto -fno-use-linker-plugin
> ${CXXFLAGS}"
> export LDFLAGS="${LDFLAGS} -fno-lto -fno-use-linker-plugin
> -static-libgcc -static-libstdc++"
>
> ./Build -C --host=${NAME} --build=x86_64-apple-darwin
>
> but the build fails because --host does not proliferate to icu-native

Well, yes, that's expected, icu-native is there *precisely* for the
reason the name explains: to be built natively. The problem is that I
defined CC and CXX and those two are used independent of whether the
native compiler or the cross-compiler should be used.

Once I removed export CC/CXX, things started looking better.

Building icu-native without setting the compiler explicitely:

checking whether to build release libraries... yes
checking for x86_64-apple-darwin11-gcc... no
checking for x86_64-apple-darwin11-cc... no
checking for x86_64-apple-darwin11-clang... no
checking for x86_64-apple-darwin11-c99... no
checking for x86_64-apple-darwin11-c89... no
checking for x86_64-apple-darwin11-xlc_r... no
checking for x86_64-apple-darwin11-xlc... no
checking for x86_64-apple-darwin11-cl.exe... no
checking for x86_64-apple-darwin11-icc... no
checking for gcc... gcc
checking whether the C compiler works... no

Now, this revealed further problems:

(a) I need to delete CFLAGS/CXXFLAGS/LDFLAGS as well. So basically I'm
unable to set any compiler or any flags.

(b) I'm unable to choose which compiler to use for building the native
binaries. In most cases that should not be a problem, but building ICU
in particular might require a C++11 capable compiler in the very very
near future and the default compiler might not support C++11 without
additional flags.


If I understand the README.6cross properly, then I should be able to
set the native compiler with

     BUILDCC=...
     BUILDCPPFLAGS=...
     BUILDCFLAGS=...
     BUILDCXX=...
     BUILDCXXFLAGS=...
     BUILDLDFLAGS=...

but I have problems with interpretation. I tried setting BUILDCC and
BUILDCXX, but icu-native would ignore those settings and insist in
building with "gcc" (the first and the only compiler it found)


The build finally fails with a mysterious error:

make[6]: Making `all' in `makeconv'
   g++ ...  /path/to/source/Work/libs/icu/../../../libs/icu/icu-src/source/tools/makeconv/makeconv.cpp
   gcc ...  /path/to/source/Work/libs/icu/../../../libs/icu/icu-src/source/tools/makeconv/ucnvstat.c
   g++ ...  /path/to/source/Work/libs/icu/../../../libs/icu/icu-src/source/tools/makeconv/genmbcs.cpp
   gcc ...  /path/to/source/Work/libs/icu/../../../libs/icu/icu-src/source/tools/makeconv/gencnvex.c
g++ -O2     -o ../../bin/makeconv makeconv.o ucnvstat.o genmbcs.o
gencnvex.o -L../../lib -licutu -L../../lib -licui18n -L../../lib
-licuuc -L../../stubdata -licudata -lpthread -lm
ld: warning: ld: warning: ignoring file ../../lib/libicui18n.a, file
was built for archive which is not the architecture being linked
(x86_64): ../../lib/libicui18n.aignoring file ../../lib/libicutu.a,
file was built for archive which is not the architecture being linked
(x86_64): ../../lib/libicutu.a

ld: archive has no table of contents for architecture x86_64
collect2: ld returned 1 exit status
make[7]: *** [../../bin/makeconv] Error 1
make[6]: *** [all-recursive] Error 2
make[5]: *** [all-recursive] Error 2
make[4]: *** [icubuild] Error 2
make[3]: *** [all-recursive] Error 1
make[2]: *** [recurse] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all-recursive] Error 1
+ echo 2

I need to take a closer look at the error.

One of my main questions: is there any consensus about what variable
should be used for native/cross-compiled build for
CC/CXX/CFLAGS/CXXFLAGS/LDFLAGS?

I would like to set up regular builds for cross-compiling from
GNU/Linux to Windows. From what I understand 99.5% of the work has
already been done, it's just about minor remaining problems (which
don't have to be fixed straight away, but it would be nice to get them
fixed eventually). The above experiments were done on OS X, but the
procedure should not be any different from compiling on Linux.

Mojca


More information about the tlbuild mailing list