Sample Header Ad - 728x90

How to check if my ARM64 board supports 32 bit binary compilation? (error: unrecognized command line option ‘-m32’)

2 votes
1 answer
2816 views
I have a ARM virtual machine on AWS with Ubuntu18.04 installed. dpkg & uname commands show this, $ dpkg --print-architecture arm64 $ uname -m aarch64 I've got a third-party precompiled static library (.a) built for 32-bit. I understand that I cannot link 32-bit library to a 64-bit application, so I've created a new application which will link the library and get compiled for 32-bit. This application will communicate with rest of the applications (64-bit) using some IPC mechanism. To compile this application I've added following flag in my cmake file, set (CMAKE_CXX_FLAGS "-m32") but the compiler throw this error, c++: error: unrecognized command line option ‘-m32’ c++ version on my machine is, $ c++ -v Using built-in specs. COLLECT_GCC=c++ COLLECT_LTO_WRAPPER=/usr/lib/gcc/aarch64-linux-gnu/7/lto-wrapper Target: aarch64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 7.4.0-1ubuntu1~18.04.1' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --program-prefix=aarch64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libquadmath --disable-libquadmath-support --enable-plugin --enable-default-pie --with-system-zlib --enable-multiarch --enable-fix-cortex-a53-843419 --disable-werror --enable-checking=release --build=aarch64-linux-gnu --host=aarch64-linux-gnu --target=aarch64-linux-gnu Thread model: posix gcc version 7.4.0 (Ubuntu/Linaro 7.4.0-1ubuntu1~18.04.1) It shows that it is prepared with configuration option ***--enable-multiarch*** which I suppose should allow me to compile for different architecture (32-bit ARM). On one of the other thread on stackoverflow says that some ARM64 machine's hardware may not support compilation of 32-bit applications. My question is how to check if my ARM64 machine is capable of building 32-bit application? And if it is capable of building then what is the alternative to ***-m32*** flag?
Asked by nik (41 rep)
Jan 9, 2020, 07:25 AM
Last activity: Jan 19, 2020, 01:29 PM