Hi,

Some programs like smlnj, which is SML by New Jersey, support only 32-bit
binaries. On Linux distros, I can use gcc multilib support. How do I do
that in OpenBSD?

I installed gcc-4.7.2 package and used that to compile to see whether I can
get it to generate a 32-bit binary.


$ egcc -m32 hello.c -o hello
/usr/bin/ld: warning: i386 architecture of input file `/tmp//ccMULgjf.o' is
incompatible with i386:x86-64 output

So, it seems to use the system linker. To confirm that:

$ egcc -v
Using built-in specs.
COLLECT_GCC=egcc
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-unknown-openbsd5.2/4.7.2/lto-wrapper
Target: x86_64-unknown-openbsd5.2
Configured with: /usr/obj/gcc-4.7.2/gcc-4.7.2/configure --verbose
--program-transform-name='s,^,e,' --disable-nls --disable-checking
--with-system-zlib --disable-libmudflap --disable-libgomp --disable-tls
--with-as=/usr/bin/as --with-ld=/usr/bin/ld --with-gnu-ld --with-gnu-as
--enable-threads=posix --enable-wchar_t --with-gmp=/usr/local
--disable-libstdcxx-pch --enable-languages=c,c++,fortran,objc,ada
--enable-cpp --enable-shared --prefix=/usr/local --sysconfdir=/etc
--mandir=/usr/local/man --infodir=/usr/local/info --localstatedir=/var
--disable-silent-rules
Thread model: posix
gcc version 4.7.2 (GCC)


Do I have to build gcc-4.7.2 from ports with multilib support?

For simple programs,

export CFLAGS="-m32"
export LDFLAGS="-m32"

works. But, if I want to compile something like sml-nj, then the make
fails.


Thanks
Salil

Reply via email to