cannot find -lglib-2.0 while cross compiling
Hi, I need to run syslog-ng on an itanium RHEL 4.7 server but cannot find any RPM's for ia64 arch. So decided to cross compile it. I am trying to build it on a centos 4.7 VM and get the following error: ia64-unknown-linux-gnu-gcc -Os -Wall -o syslog-ng main.o libsyslog-ng.a -lnsl -lrt -Wl,-Bstatic -lglib-2.0 -levtlog -lnet -Wl,-Bdynamic -ldl /opt/crosstool/gcc-3.4.5-glibc-2.3.6/ia64-unknown-linux-gnu/lib/gcc/ia64-unknown-linux-gnu/3.4.5/../../../../ia64-unknown-linux-gnu/bin/ld: cannot find -lglib-2.0 collect2: ld returned 1 exit status However it seems that I already have glib-2.0 libs installed: $ pkg-config glib-2.0 --cflags --libs -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -lglib-2.0 Can you tell what am I missing here? Best regards.
Hi, On Thu, Jul 08, 2010 at 10:33:24AM +0300, Hasan Ümit Ezerçe wrote:
Hi,
I need to run syslog-ng on an itanium RHEL 4.7 server but cannot find any RPM's for ia64 arch. So decided to cross compile it. I am trying to build it on a centos 4.7 VM and get the following error:
ia64-unknown-linux-gnu-gcc -Os -Wall -o syslog-ng main.o libsyslog-ng.a -lnsl -lrt -Wl,-Bstatic -lglib-2.0 -levtlog -lnet -Wl,-Bdynamic -ldl /opt/crosstool/gcc-3.4.5-glibc-2.3.6/ia64-unknown-linux-gnu/lib/gcc/ia64-unknown-linux-gnu/3.4.5/../../../../ia64-unknown-linux-gnu/bin/ld: cannot find -lglib-2.0 collect2: ld returned 1 exit status
However it seems that I already have glib-2.0 libs installed: $ pkg-config glib-2.0 --cflags --libs -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -lglib-2.0
Can you tell what am I missing here?
Best regards. By default, pkg-config looks for the native libs on your system, not the cross-compiled ones the cross compiler needs. Sadly, I don't have any experience with cross-compiling but it'll go something like this:
For syslog-ng you need to cross-compile the following libs if you don't need crypto support: - libintl - gettext - glib - eventlog - libnet You have to cross compile and install them to an arbitrary directory. In all cases, you have to tell ./configure and pkg-config to look for needed files under the cross-compile directory. Ex. Say, the holding directory for the cross compiled libs is /usr/local/cross/ia64. You have to set the following environment variables before running ./configure --prefix=/usr/local/cross/ia64/ && make: PATH=/usr/local/cross/ia64/bin:$PATH CFLAGS="-I/usr/local/cross/ia64/include $CFLAGS" LDFLAGS="-L/usr/local/cross/ia64/lib $LDFLAGS" PKG_CONFIG_PATH=/usr/local/cross/ia64/lib/pkgconfig Good luck, -- Pal Tamas/Folti folti@balabit.hu
On 2010-07-08 11:22, Pal Tamas wrote:
Hi,
On Thu, Jul 08, 2010 at 10:33:24AM +0300, Hasan Ümit Ezerçe wrote:
Hi,
I need to run syslog-ng on an itanium RHEL 4.7 server but cannot find any RPM's for ia64 arch. So decided to cross compile it. I am trying to build it on a centos 4.7 VM and get the following error:
ia64-unknown-linux-gnu-gcc -Os -Wall -o syslog-ng main.o libsyslog-ng.a -lnsl -lrt -Wl,-Bstatic -lglib-2.0 -levtlog -lnet -Wl,-Bdynamic -ldl /opt/crosstool/gcc-3.4.5-glibc-2.3.6/ia64-unknown-linux-gnu/lib/gcc/ia64-unknown-linux-gnu/3.4.5/../../../../ia64-unknown-linux-gnu/bin/ld: cannot find -lglib-2.0 collect2: ld returned 1 exit status
However it seems that I already have glib-2.0 libs installed: $ pkg-config glib-2.0 --cflags --libs -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -lglib-2.0
Can you tell what am I missing here?
Best regards. By default, pkg-config looks for the native libs on your system, not the cross-compiled ones the cross compiler needs. Sadly, I don't have any experience with cross-compiling but it'll go something like this:
For syslog-ng you need to cross-compile the following libs if you don't need crypto support: - libintl - gettext - glib - eventlog - libnet
You have to cross compile and install them to an arbitrary directory.
In all cases, you have to tell ./configure and pkg-config to look for needed files under the cross-compile directory. Ex. Say, the holding directory for the cross compiled libs is /usr/local/cross/ia64.
You have to set the following environment variables before running ./configure --prefix=/usr/local/cross/ia64/&& make: PATH=/usr/local/cross/ia64/bin:$PATH CFLAGS="-I/usr/local/cross/ia64/include $CFLAGS" LDFLAGS="-L/usr/local/cross/ia64/lib $LDFLAGS" PKG_CONFIG_PATH=/usr/local/cross/ia64/lib/pkgconfig
If you are using sysrooted toolchain then the correct way of using pkg-config is: PKG_CONFIG_SYSROOT_DIR=$SYSROOT PKG_CONFIG_LIBDIR=$SYSROOT/usr/lib/pkgconfig And no PKG_CONFIG_PATH or CFLAGS or LDFLAGS. For this to work you need a recent version of pkg-config (version 0.25 works weel, but 0.23 does not).
participants (3)
-
Hasan Ümit Ezerçe
-
Pal Tamas
-
Sergei Zhirikov