Build 32bit on 64 bit Linux using an automake configure script?

前端 未结 5 1452
猫巷女王i
猫巷女王i 2020-12-04 06:59

I\'m using a 64bit system but want a set of 32bit binaries. What options must I pass to a configure script to generate a 32bit/x86 makefile?

5条回答
  •  我在风中等你
    2020-12-04 07:55

    Jack's answer is incomplete.

    You need compiler/libc support for 32-bit compilation. In some distros like Ubuntu, what you need to do is install packages gcc-multilib and/or g++-multilib:

    sudo apt-get install gcc-multilib g++-multilib
    

    Then you can call configure as you said, specifyiong a 32-bit host and passing 32-bit compilation flags:

    ./configure --host=i686-linux-gnu "CFLAGS=-m32" "CXXFLAGS=-m32" "LDFLAGS=-m32"
    

    If you do not have multilib installed, you will get an error like configure: error: C compiler cannot create executables when passing the -m32 flag.

提交回复
热议问题