1

I have downloaded glib 2.56 sources from here:

https://download.gnome.org/sources/glib/2.56/

And then i am trying to build & install 32-bit glib library on 64-bit x86_64 platform using following commands:-

../configure CC='/local/common/pkgs/gcc/v6.3.0p2/bin/gcc -m32' CXX='/local/common/data/gcc/v6.3.0p2/bin/g++ -m32' CFLAGS='-fPIC -O2' CXXFLAGS='-fPIC -O2' LD_LIBRARY_PATH=/local/common/data/gcc/v6.3.0p2/lib LDFLAGS=-m32 --enable-static=yes --prefix=/home/gout/source_glib/32bit_glib/glib-2.56.1/glib_32bit --enable-libmount=no PYTHON=/local/common/data/python/v2.7.6/bin/python --with-pcre=/home/gout/pcre_32bit/pcre-8.20/pcre_install

make
make install

While building code (using 'make' command). I am hitting following issue:-

/local/common/pkgsData/gcc-v6.3.0p2/Linux/RHEL6.0-2013-x86_64/bin/ld: i386:x86-64 architecture of input file `.libs/glib_probes.o' is incompatible with i386 output

I found that file 'glib_probes.' is getting created with 64bit architecture.

[gout@il-gout glib]$ file .libs/glib_probes.o
.libs/glib_probes.o: ELF 64-bit LSB relocatable, x86-64, version 1 (SYSV), not stripped

Above particular file is getting created by command :-

/bin/sh ../libtool --mode=compile --silent --tag=CC dtrace -G -s ../../glib/glib_probes.d -o glib_probes.lo

Rule where we are running above command from glib source is :-

glib_probes.lo: glib_probes.d
    $(AM_V_GEN) $(LIBTOOL) --mode=compile $(AM_V_lt) --tag=CC $(DTRACE) -G -s $< -o $@

variable LIBTOOL points to libtool script which got created after running ./configure script. I have mentioned CC= '/local/common/pkgs/gcc/v6.3.0p2/bin/gcc -m32' to configure script, Still this particular file glib_probes.o is getting created with 64 bit architecture.. Not sure whats wrong in creating glib library.

I verified that all other files were created with 32-bit architecture except above file... Please help me in fixing this issue. This issue leads to issue failing creating libglib-2.0.la

  CCLD     libglib-2.0.la
/local/common/data/gcc-v6.3.0p2/Linux/RHEL6.0-2013-x86_64/bin/ld: i386:x86-64 architecture of input file `.libs/glib_probes.o' is incompatible with i386 output
Florian Weimer
  • 32,022
  • 3
  • 48
  • 92
santosh
  • 421
  • 1
  • 6
  • 14

1 Answers1

2

The Meson build script that glib uses does not pass down the CC setting specified at configure time. Systemtap's dtrace tool uses CC from the environment, so you could call make like this:

CC="/local/common/pkgs/gcc/v6.3.0p2/bin/gcc -m32" make

Alternatively, you can disable those probes at configure time using --disable-dtrace if you do not need them.

Florian Weimer
  • 32,022
  • 3
  • 48
  • 92
  • BTW, I used --disable-dtrace, And able to build glib library..Not sure whether my application needs probes stuff. After creating glib library. When i try to use that library in my application i am facing : undefined symbol: pthread_key_create. – santosh Nov 10 '19 at 12:19
  • No, you would have to set `CC` during the invocation of `make`. It is unlikely that you will need probes, they are only for debugging. – Florian Weimer Nov 10 '19 at 15:54
  • Florian, Our regressions are failing with trance errors. Not sure if its because of skip building probes stuff.. I want to include probes stuff while creating build. Setting up environment variable and triggering make should work right ? I.e setenv CC '/local/common/pkgs/gcc/v6.3.0p2/bin/gcc -m32' then after 'make' – santosh Nov 13 '19 at 11:07
  • `setenv` sounds like csh, I'm not familiar with that. But it ought to work. Maybe the generated makefiles do something funny though. If everything fails, you could introduce a wrapper script for `gcc` and put that on the `PATH`. – Florian Weimer Nov 13 '19 at 11:24