Daniel Jabbour wrote: > Hi, > > I am trying to build a cross-compiled glibc toolchain on a non-linux > platform. My only issue involves a problem with the include path for > glibc. I have patched glibc with the cross_hacks patch from your CLFS > project. This basically makes glibc compile a native localedef-native > binary so localedata/insatll-locales will work in the cross-compiler. > > The issue is that it cannot find libintl.h during compilation. This is > part of the GNU gettext utilities package. So basically, I know I need > to figure out some way to get the make script to properly include the > path to my headers for gettext. On my system, gettext is installed in > /usr/local/include/. > > I have tried two methods to pass the include directory, neither worked. > > First, I tried to pass it to the configure script for glibc by way of > CPPFLAGS. In this case my configure command looked like: > > BUILD_CC="gcc" CC="mipsel-linux-gcc" CPPFLAGS="-I/opt/local/include" > AR="mipsel-linux-ar" RANLIB="mipsel-linux-ranlib" > ../glibc-2.6.1/configure --prefix=/usr --libexecdir=/usr/lib/glibc > --host=mipsel-linux --disable-profile --enable-add-ons --with-tls > --enable-kernel=2.6.0 --with-__thread > --with-binutils=/opt/mipsel-liunx-toolchain/bin > --with-headers=../linux-2.6.24.3-lt-headers --cache-file=config.cache > > When I did a make, however, it still didn't find libintl.h, and I > noticed no -I/opt/local/include in the gcc commands that it called. > > Next, i tried passing the CPPFLAGS variable to make such as: > make CPPFLAGS="-I/opt/local/include" > > This time, I noticed the -I flag was being passed to gcc, but that the > native -I flags there used to be there were not. This meant that it > could no longer find the various other files it needed to include, and > died on something else. > > My conclusion is that CPPFLAGS during `make` overrides all other > compiler flags, and CPPFLAGS during `configure` is ignored. So how do > I pass this information to the build process for glibc so I can > compile it on my system? Thank you kindly, I would try BUILD_CC="gcc -I/opt/local/include" . I know its not exactly kosher but it should work. And yes, you're right, when compiling glibc specifying a flag on the command line does override the variable completely. That behavior can be very useful in some situations but in this particular one its more of a pain.
Specifying a variable like CPPFLAGS on the command line wont make it into the native compile command. I had to add a few make targets specifically for compiling natively and I did not add CPPFLAGS in because it probably would create problems to use the same headers for the host and cross system. Instead CPPFLAGS-native is used. I just took a look through the patch, It looks like the only way to get extra options onto the BUILD_CC command would be to append them to the variable passed to configure. In the patched Makerules file at about line 365 you'll see: +native-compile.c = $(BUILD_CC) -g $< -c $(CFLAGS-native) $(CPPFLAGS-native) Both CFLAGS-native and CPPFLAGS-native are defined to override any previous settings. (should) _______________________________________________ Clfs-support mailing list [email protected] http://lists.cross-lfs.org/listinfo.cgi/clfs-support-cross-lfs.org
