Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22116

How can I configure GNU Autotools to compile a program in 32-bit when '-m32' switch doesn't work?

$
0
0

I'm doing all this on a VLE and below is what I'm working with:

Running OS: Linux Centos 7

Before gcc install: gcc -v

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/cloog-install --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC)

After gcc install:gcc -v

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-pc-linux-gnu/7.1.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-7.1.0/configure --enable-multiarch --with-list-multilib=m32,m64 --enable-multilib
Thread model: posix
gcc version 7.1.0 (GCC)

I'm trying to use GNU autotools (libtool, autoconf, automake) to build a project in 32-bit using gcc-7.1.0. Also, as a requirement, I must do this on Centos 7 and use gcc-7.1.0.

Apparently, the latest version of gcc that can be officially upgraded through yum is 4.8.5. However, I did find two ways to install gcc-7: one is through the software collection (SCL) by installing devtoolset-7, and the other being installing it from the official source.

At first, I installed devtoolset-7.x86_64 but I couldn't install some 32-bit libraries for devtoolset-7 so I abandoned that route.

I successfully installed gcc-7.1.0 from the official source and even included --enable-multiarch --with-list-multilib=m32,m64 --enable-multilib during configure.

The issue I'm running into is that the autotools seem to want to use the 64-bit libraries even though I'm including -m32 compiler switch in CXXFLAGS, CFLAGS, and LDFLAGS. The reason I think it's using 64-bit libraries at linking is that I get the error below:

libtool: link: g++ -m32 -fPIC -Wall -Wextra -Weffc++ -Werror -std=c++03 -O2 -o fldprog fldprog-icpprog.o  ../../                                                                                                                                                                 ../seal3/fld/src/.libs/libbsp_fld.a -lpci /usr/local/lib/../lib64/libstdc++.so -lm -Wl,-rpath -Wl,/usr/local/lib                                                                                                                                                                 /../lib64 -Wl,-rpath -Wl,/usr/local/lib/../lib64
/usr/local/lib/../lib64/libstdc++.so: error adding symbols: File in wrong format

And when I rename /usr/local/lib64 to lib64_something, the program will compile without any errors. However, this is a temporary work around and I want to find a permanent solution.

I've searched the internet for answers but none of them seem to really work. I've tried including -L/usr/local/lib to AM_LDFLAGS, AM_CFLAGS in configure.ac

Something that I think will work is perhaps editing libtool script. I found sys_lib_search_path_spec in configure script but there wasn't anything in configure.ac for me to edit or set the value of sys_lib_search_path_spec. I found LT_SYS_LIBRARY_PATH on libtool webpage and tried adding it in configure.acbut I got an error

configure.ac:38: error: possibly undefined macro: LT_SYS_LIBRARY_PATH
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
autoreconf: /usr/bin/autoconf failed with exit status: 1

Another internet search reveals that my libtool is 2.4.2 and the LT_SYS_LIBRARY_PATH isn't defined. I don't know where to go from here. Is there any way for me to specify the 32-bit library path in autotools?

I'd appreciate any input. Thank you.


Viewing all articles
Browse latest Browse all 22116

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>