What is the correct way to build 32-bit libcurl on freebsd? - libcurl

I need to build a 32 bit libcurl.so on freebsd.
If I run ./configure like this:
CFLAGS="-m32" CPPFLAGS="-m32" LDFLAGS="-L/usr/lib32 -m32" ./configure --prefix=/usr/home/debby/libcurl2
I get the following errors in config.log:
configure:4373: checking whether the C compiler works
configure:4395: gcc -m32 -m32 -L/usr/lib32 -m32 conftest.c >&5
/usr/local/bin/ld: i386:x86-64 architecture of input file `/usr/lib/crt1.o' is incompatible with i386 output
/usr/local/bin/ld: i386:x86-64 architecture of input file `/usr/lib/crti.o' is incompatible with i386 output
/usr/local/bin/ld: i386:x86-64 architecture of input file `/usr/local/lib/gcc6/gcc/x86_64-portbld-freebsd11.1/6.4.0/crtbegin.o' is incompatible with i386 output
/usr/local/bin/ld: i386:x86-64 architecture of input file `/usr/local/lib/gcc6/gcc/x86_64-portbld-freebsd11.1/6.4.0/crtend.o' is incompatible with i386 output
/usr/local/bin/ld: i386:x86-64 architecture of input file `/usr/lib/crtn.o' is incompatible with i386 output
Am I even approaching this the right way? Should I be specifying --build and --host on the ./configure command line instead, and if so what values?
=========
UPDATE
Using the first link suggested by #Wodin I ran configure as follows:
export CFLAGS="-m32 -march=i686 -mmmx -msse -msse2 -mfancy-math-387 -DCOMPAT_32BIT"
#export CPPFLAGS="-m32 -march=i686 -mmx -msse -msse2 -DCOMPAT_32BIT"
export LDFLAGS="-m32 -L/usr/lib32 -B/usr/lib32"
./configure --prefix=/usr/home/debby/libcurl
make then fails because I don't have the 32 bit runtime libraries
[debby#GServerBuild ~/curl-7.60.0]$ make install
Making install in lib
CCLD libcurl.la
/usr/local/bin/ld: i386:x86-64 architecture of input file `/usr/lib/crti.o' is incompatible with i386 output
/usr/local/bin/ld: i386:x86-64 architecture of input file `/usr/local/lib/gcc6/gcc/x86_64-portbld-freebsd11.1/6.4.0/crtbeginS.o' is incompatible with i386 output
/usr/local/bin/ld: i386:x86-64 architecture of input file `/usr/local/lib/gcc6/gcc/x86_64-portbld-freebsd11.1/6.4.0/crtendS.o' is incompatible with i386 output
/usr/local/bin/ld: i386:x86-64 architecture of input file `/usr/lib/crtn.o' is incompatible with i386 output
collect2: error: ld returned 1 exit status
*** Error code 1
Based on the second link provided it seems I need to build those libraries from /usr/src which is empty.
I am trying to get src using fetch -o /tmp ftp://ftp.freebsd.org/pub/uname -s/releases/uname -m/uname -r | cut -d'-' -f1,2/src.txz as described here: https://unix.stackexchange.com/questions/204956/how-do-you-install-the-freebsd10-kernel-sources
and will put an update here on how the rest goes

You're using /usr/local/bin/ld which is the binutils from ports. Probably doesn't have 32 bit support. Try setting LD.
LD=/usr/bin/ld CFLAGS="-m32" CPPFLAGS="-m32" LDFLAGS="-L/usr/lib32" ./configure --libdir=/usr/local/lib32
Also I checked the file after with readelf.
readelf -h lib/.libs/libcurl.so
ELF Header:
Magic: 7f 45 4c 46 01 01 01 09 00 00 00 00 00 00 00 00
Class: ELF32
Data: 2's complement, little endian
Version: 1 (current)
OS/ABI: FreeBSD
The best way would be to make a copy of the Makefile in ports and set.
PKGNAMEPREFIX="lib32-"
CFLAGS+="-m32"
CPPFLAGs+="-m32"
LDFLAGS+="-L/usr/lib32"
CONFIGURE_ARGS+="--libdir="${LOCALBASE}/lib32"

Related

Compile boost as universal library (Intel and Apple Silicon architectures)

I am trying to build boost library as dylib on MacOS. I need to build it for both the Intel architecture and the upcoming Apple Silicon (arm64) architecture.
I downloaded boost and ran the following commands:
./bootstrap.sh
./b2 -address-model=64 architecture=combined -a
lipo -archs always shows produced dylibs architecture is x86_64.
I have Xcode12 beta and MacOS Catalina 10.15.7,
I can build a sample universal library if I create a project in Xcode and set archs arm64 x86_64 in build settings.
Running command ./b2 cxxflags="-arch arm64 -arch x86_64" fails with following errors:
"clang++" -x c++ -fvisibility-inlines-hidden -m64 -O3 -Wall -fvisibility=hidden -Wno-inline -arch arm64 -arch x86_64 -ftemplate-depth-255 -fvisibility=hidden -fvisibility-inlines-hidden -DBOOST_ALL_NO_LIB=1 -DNDEBUG -I"." -c -o "bin.v2/libs/serialization/build/clang-darwin-12.0/release/link-static/threading-multi/visibility-hidden/polymorphic_xml_iarchive.o" "libs/serialization/src/polymorphic_xml_iarchive.cpp"
...failed clang-darwin.compile.c++ bin.v2/libs/serialization/build/clang-darwin-12.0/release/link-static/threading-multi/visibility-hidden/polymorphic_xml_iarchive.o...
clang-darwin.compile.c++ bin.v2/libs/serialization/build/clang-darwin-12.0/release/link-static/threading-multi/visibility-hidden/polymorphic_xml_oarchive.o
In file included from libs/serialization/src/polymorphic_xml_oarchive.cpp:16:
In file included from ./boost/serialization/config.hpp:18:
In file included from ./boost/config.hpp:57:
In file included from ./boost/config/platform/macos.hpp:28:
In file included from ./boost/config/detail/posix_features.hpp:18:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/unistd.h:71:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/_types.h:27:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/sys/_types.h:32:
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/sys/cdefs.h:807:2: error: Unsupported architecture
#error Unsupported architecture
^
In file included from libs/serialization/src/polymorphic_xml_oarchive.cpp:16:
In file included from ./boost/serialization/config.hpp:18:
In file included from ./boost/config.hpp:57:
In file included from ./boost/config/platform/macos.hpp:28:
In file included from ./boost/config/detail/posix_features.hpp:18:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/unistd.h:71:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/_types.h:27:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/sys/_types.h:33:
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/machine/_types.h:34:2: error: architecture not supported
#error architecture not supported
^
In file included from libs/serialization/src/polymorphic_xml_oarchive.cpp:16:
In file included from ./boost/serialization/config.hpp:18:
In file included from ./boost/config.hpp:57:
In file included from ./boost/config/platform/macos.hpp:28:
In file included from ./boost/config/detail/posix_features.hpp:18:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/unistd.h:71:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/_types.h:27:
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/sys/_types.h:55:9: error: unknown type name '__int64_t'
typedef __int64_t __darwin_blkcnt_t; /* total blocks */
^
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/sys/_types.h:56:9: error: unknown type name '__int32_t'; did you mean '__int128_t'?
typedef __int32_t __darwin_blksize_t; /* preferred block size */
^
note: '__int128_t' declared here
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/sys/_types.h:57:9: error: unknown type name '__int32_t'; did you mean '__int128_t'?
typedef __int32_t __darwin_dev_t; /* dev_t */
^
note: '__int128_t' declared here
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/sys/_types.h:60:9: error: unknown type name '__uint32_t'; did you mean '__uint128_t'?
typedef __uint32_t __darwin_gid_t; /* [???] process and group IDs */
^
note: '__uint128_t' declared here
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/sys/_types.h:61:9: error: unknown type name '__uint32_t'; did you mean '__uint128_t'?
typedef __uint32_t __darwin_id_t; /* [XSI] pid_t, uid_t, or gid_t*/
^
The following works for me on Big Sur using Xcode 12.2. On Catalina 10.15.7 (19H15) I get the same error messages as OP.
./bootstrap.sh --with-libraries=regex,date_time
./b2 architecture=combined cxxflags="-arch x86_64 -arch arm64"
I'm on Monterey with an M1 (XCode 13.1) and failed to get any of the other answers to work, but I combined stuff from Navan and Petr along with some other bits to get the libboost_coroutine to work on x86_64. I arrived at the following script which builds all the boost libraries (why not, it doesn't take long on the M1):
#!/bin/sh
rm -rf arm64 x86_64 universal stage bin.v2
rm -f b2 project-config*
./bootstrap.sh cxxflags="-arch x86_64 -arch arm64" cflags="-arch x86_64 -arch arm64" linkflags="-arch x86_64 -arch arm64"
./b2 toolset=clang-darwin target-os=darwin architecture=arm abi=aapcs cxxflags="-arch arm64" cflags="-arch arm64" linkflags="-arch arm64" -a
mkdir -p arm64 && cp stage/lib/*.dylib arm64
./b2 toolset=clang-darwin target-os=darwin architecture=x86 cxxflags="-arch x86_64" cflags="-arch x86_64" linkflags="-arch x86_64" abi=sysv binary-format=mach-o -a
mkdir x86_64 && cp stage/lib/*.dylib x86_64
mkdir universal
for dylib in arm64/*; do
lipo -create -arch arm64 $dylib -arch x86_64 x86_64/$(basename $dylib) -output universal/$(basename $dylib);
done
for dylib in universal/*; do
lipo $dylib -info;
done
This script prints out the lipo info for each dylib in the universal directory, so you can see quickly that every one has both x86_64 and arm64 inside. I had the following result, maybe it's useful for you to see if your output matches:
Architectures in the fat file: universal/libboost_atomic.dylib are: x86_64 arm64
Architectures in the fat file: universal/libboost_chrono.dylib are: x86_64 arm64
Architectures in the fat file: universal/libboost_container.dylib are: x86_64 arm64
Architectures in the fat file: universal/libboost_context.dylib are: x86_64 arm64
Architectures in the fat file: universal/libboost_contract.dylib are: x86_64 arm64
Architectures in the fat file: universal/libboost_coroutine.dylib are: x86_64 arm64
Architectures in the fat file: universal/libboost_date_time.dylib are: x86_64 arm64
Architectures in the fat file: universal/libboost_filesystem.dylib are: x86_64 arm64
Architectures in the fat file: universal/libboost_graph.dylib are: x86_64 arm64
Architectures in the fat file: universal/libboost_iostreams.dylib are: x86_64 arm64
Architectures in the fat file: universal/libboost_locale.dylib are: x86_64 arm64
Architectures in the fat file: universal/libboost_log.dylib are: x86_64 arm64
Architectures in the fat file: universal/libboost_log_setup.dylib are: x86_64 arm64
Architectures in the fat file: universal/libboost_numpy27.dylib are: x86_64 arm64
Architectures in the fat file: universal/libboost_prg_exec_monitor.dylib are: x86_64 arm64
Architectures in the fat file: universal/libboost_program_options.dylib are: x86_64 arm64
Architectures in the fat file: universal/libboost_python27.dylib are: x86_64 arm64
Architectures in the fat file: universal/libboost_random.dylib are: x86_64 arm64
Architectures in the fat file: universal/libboost_regex.dylib are: x86_64 arm64
Architectures in the fat file: universal/libboost_serialization.dylib are: x86_64 arm64
Architectures in the fat file: universal/libboost_stacktrace_addr2line.dylib are: x86_64 arm64
Architectures in the fat file: universal/libboost_stacktrace_basic.dylib are: x86_64 arm64
Architectures in the fat file: universal/libboost_stacktrace_noop.dylib are: x86_64 arm64
Architectures in the fat file: universal/libboost_system.dylib are: x86_64 arm64
Architectures in the fat file: universal/libboost_thread.dylib are: x86_64 arm64
Architectures in the fat file: universal/libboost_timer.dylib are: x86_64 arm64
Architectures in the fat file: universal/libboost_type_erasure.dylib are: x86_64 arm64
Architectures in the fat file: universal/libboost_unit_test_framework.dylib are: x86_64 arm64
Architectures in the fat file: universal/libboost_wave.dylib are: x86_64 arm64
Architectures in the fat file: universal/libboost_wserialization.dylib are: x86_64 arm64
After spending considerable amount of time here:
https://github.com/bfgroup/b2/issues/105
I was able to compile boost on arm64. The command line is:
./b2 architecture=arm address-model=64 asmflags=--target=arm64-apple-darwin21.2.0 cflags=--target=arm64-apple-darwin21.2.0 cxxflags=--target=arm64-apple-darwin21.2.0 linkflags=--target=arm64-apple-darwin21.2.0 -s NO_LZMA=1 -s NO_ZSTD=1 abi=aapcs
the LZMA and ZSTD flags are there since I did not have an universal binary for those libs on my machine.
I was facing the same issue and came across this answer, which was for creating universal binaries for i386 and x86_64.
To summarise the answer, you need to run ./b2 twice ( with different toolsets as clang always builds for x86_64, even if you pass the appropriate CXXFlags
This is the script I used to first individually generate the libraries I required and then combined them using lipo
#!/bin/sh
rm -rf arm64 x86_64 universal
./bootstrap.sh --with-toolset=clang --with-libraries=thread,system,filesystem,program_options,serialization
./b2 cxxflags="-arch arm64" toolset=darwin -a
mkdir -p arm64 && cp stage/lib/*.dylib arm64
./b2 toolset=clang cxxflags="-arch arm64 -arch x86_64" -a
mkdir x86_64 && cp stage/lib/*.dylib x86_64
mkdir universal
for dylib in arm64/*; do
lipo -create -arch arm64 $dylib -arch x86_64 x86_64/$(basename $dylib) -output universal/$(basename $dylib);
done
You don't need to use lipo, you can pass
-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk to cxxflags and it will build a universal library out of the box.
I followed the answer by Navan Chauhan which seems to be the way to go on macOS 10.15.7 with Xcode 12.3.
My only issue was that the build system was adding additional -arch armv4t clang option (or something similar) which fails the build. Using the architecture=combine cannot work as well as it is able to manage Intel and PowerPC only. What does work for me instead is:
bootstrap.sh --with-toolset=clang-darwin and cxxflags, cflags and linkflags set to -arch x86_64 -arch arm64 plus additional options.
x86_64 build: b2 toolset=clang-darwin target-os=darwin architecture=x86 stage and cxxflags, cflags and linkflags set to -arch x86_64 only (plus additional options).
arm64 build: b2 toolset=clang-darwin target-os=darwin architecture=arm abi=aapcs stage and cxxflags, cflags and linkflags set to -arch arm64 only (plus additional options).
Merge libraries with lipo…
I've been forced to set the ABI also as the automatic-guess-something is not able to recognize Apple Silicon goal therefor some assembly stuff is not compiled – hence missing symbols later on during the build. Finally the armv4t issue is solved by the clang-darwin toolset.
The only caveat of this at the moment is that both builds go into the same architectural/configuration directories which can be solved by custom user-config.jam or by immediate call to install just after each stage which is what I did.
Works on:
Host platform: Intel
macOS 10.15.7
Xcode 12.3 (with Command Line Tools installed)
Boost 1.75.0 (dependent compression and ICU libraries already compiled as universal)
For macOS with M1 building boost 1.81.0
./bootstrap.sh
sudo ./b2 -address-model=64 architecture=arm+x86 install
Libraries that support both architectures are installed

Build and install Boost 1.60 in 32 bit on a 64 bit Mac OS X El Capitan

I have an application that use the 32 bit boost library( 1.48 ). The 1.48 version of boost was pre built on 32 bit platform and uses older C++ standards.
For example file libboost_wserialization.dylib gives
libboost_wserialization.dylib: Mach-O universal binary with 2 architectures
libboost_wserialization.dylib (for architecture i386): Mach-O dynamically linked shared library i386
libboost_wserialization.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64
The requirements have changed and i want to link/use the boost 1.60 with C++ 11 and 32 bit.
I have downloaded the 1.60 boost and modified the bootstrap.sh to include application specific lib and include directories.
I am running the following command
./b2 cxxflags="-std=c++0x -stdlib=libc++" linkflags="-stdlib=libc++" address-model=32 architecture=x86 install
I get the following error
error: unknown target CPU 'i686' for all the files.
If i install the default then I don get the 32 bit version of the boost libraries and application fails to link.
How do i get rid of this error ?. The machine that i am building boost on is Mac OS X El capitan 64 bit.
The entire error is
"clang++" -x c++ -std=c++0x -stdlib=libc++ -O3 -O3 -Wno-inline -Wall -march=i686 -DBOOST_ALL_NO_LIB=1 -DBOOST_MATH_TR1_DYN_LINK=1 -DNDEBUG -I"." -I"libs/math/src/tr1" -c -o "bin.v2/libs/math/build/clang-darwin-4.2.1/release/address-model-32/threading-multi/atanh.o" "libs/math/build/../src/tr1/atanh.cpp"
...failed clang-darwin.compile.c++ bin.v2/libs/math/build/clang-darwin-4.2.1/release/address-model-32/threading-multi/atanh.o...
clang-darwin.compile.c++ bin.v2/libs/math/build/clang-darwin-4.2.1/release/address-model-32/threading-multi/cbrt.o
error: unknown target CPU 'i686'
Try with address-model=64.
More info: http://www.boost.org/build/doc/html/bbv2/reference/tools.html#bbv2.reference.tools.compiler.darwin

building 32 exe on 64 bit open suse linux gives link error

In my VM, I have installed open suse linux 64 bit.
Trying to build an exe for 32 bit.
But on running the command :
g++ prg1.cpp -o prg1 -m32
I get the following error:
/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld:
skipping incompatible
/usr/lib64/gcc/x86_64-suse-linux/4.8/libstdc++.so when searching for
-lstdc++ /usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld:
skipping incompatible /usr/lib64/gcc/x86_64-suse-linux/4.8/libstdc++.a
when searching for -lstdc++
/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld:
cannot find -lstdc++ collect2: error: ld returned 1 exit status
To build for 32 i have installed the necessary rpms for 32 bit.
On running
g++ -print-search-dirs , the output is
install: /usr/lib64/gcc/x86_64-suse-linux/4.8/ programs:
=/usr/lib64/gcc/x86_64-suse-linux/4.8/:/usr/lib64/gcc/x86_64-suse-linux/4.8/:/usr/lib64/gcc/x86_64-suse-linux/:/usr/lib64/gcc/x86_64-suse-linux/4.8/:/usr/lib64/gcc/x86_64-suse-linux/:/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/x86_64-suse-linux/4.8/:/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/
libraries:
=/usr/lib64/gcc/x86_64-suse-linux/4.8/:/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/lib/x86_64-suse-linux/4.8/:/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/lib/../lib64/:/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../x86_64-suse-linux/4.8/:/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../lib64/:/lib/x86_64-suse-linux/4.8/:/lib/../lib64/:/usr/lib/x86_64-suse-linux/4.8/:/usr/lib/../lib64/:/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/lib/:/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../:/lib/:/usr/lib/
Although the 32 bit libstdc++ is also installed, the linker is not able to link to it. Is any specific flag required to tell the linker to build 32 bit
Or I have to install any other package?
To build for 32 i have installed the necessary rpms for 32 bit.
No, you have not.
Note that in order to build programs you need 32-bit runtime and development libraries. I am guessing that you've installed the former, but not the latter.

Attempting to compile a GNU library on OS X for 32 and 64 bit

thanks in advance for any help on this, I have scoured the web and can't quite get this to work.
I am trying to compile from source the libgcrypt library from GNU on a mac running OS X 10.9.4. I need to compile to a 32 bit binary which I will later use lipo to blend with the 64 bit one (I have the 64 bit part working). I am trying to be able to reference the libgcrypt binary from both 32 and 64 bit programs. Link here: http://www.gnu.org/software/libgcrypt/
I have grabbed an un-tared the source.
I have used the following configure:
$ ./configure -host=i386-apple-darwin10.5.0 CFLAGS='-arch i386' LDFLAGS='-arch i386'
Which results in:
Libgcrypt v1.6.2 has been configured as follows:
Platform: Darwin (i386-apple-darwin10.5.0)
Hardware detection module: hwf-x86
Enabled cipher algorithms: arcfour blowfish cast5 des aes twofish
serpent rfc2268 seed camellia idea salsa20
gost28147
Enabled digest algorithms: crc gostr3411-94 md4 md5 rmd160 sha1
sha256 sha512 tiger whirlpool stribog
Enabled kdf algorithms: s2k pkdf2 scrypt
Enabled pubkey algorithms: dsa elgamal rsa ecc
Random number generator: default
Using linux capabilities: no
Try using Padlock crypto: yes
Try using AES-NI crypto: yes
Try using Intel PCLMUL: yes
Try using DRNG (RDRAND): yes
Try using Intel AVX: yes
Try using Intel AVX2: yes
Try using ARM NEON: n/a
But when I try and make (or sudo make), boom!
Making all in src
/bin/sh ../libtool --tag=CC --mode=link gcc -I/opt/local/include -arch i386 -Wall -arch i386 -o mpicalc mpicalc-mpicalc.o libgcrypt.la -L/opt/local/lib -lgpg-error
libtool: link: gcc -I/opt/local/include -arch i386 -Wall -arch i386 -o .libs/mpicalc mpicalc-mpicalc.o ./.libs/libgcrypt.dylib -L/opt/local/lib -lgpg-error
ld: warning: ignoring file /opt/local/lib/libgpg-error.dylib, file was built for x86_64 which is not the architecture being linked (i386): /opt/local/lib/libgpg-error.dylib
Undefined symbols for architecture i386:
"_gpg_strerror", referenced from:
_print_mpi in mpicalc-mpicalc.o
_scan_mpi in mpicalc-mpicalc.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [mpicalc] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
Also of possible interest:
$ g++ --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin13.3.0
Thread model: posix
Relevant web links:
https://gmplib.org/list-archives/gmp-discuss/2010-September/004312.html
Many, many thanks in advance for any help.
Okay, I have solved this, and hopefully other folks will find this of interest.
The configure flags above aren't quite right. The proper configure command is (-m32 is needed):
./configure -host=i386-apple-darwin CFLAGS='-arch i386 -m32' LDFLAGS='-arch i386 -m32'
This will properly compile. FYI, In order for the 32-bit libgcrypt library to compile, you will need a 32 bit version of libgpg-error.
With the 32 bit versions of these libraries compiled, I used lipo to blend the 32-bit and 64-bit versions so that both 32-bit programs and 64-bit programs can both access these libraries.
lipo -create ./libgcrypt.20.dylib /usr/local/lib/libgcrypt.20.dylib -output /tmp/libgcrypt.20.dylib
sudo mv /tmp/libgcrypt.20.dylib /usr/local/lib/libgcrypt.20.dylib

libstdc++ 64bit and 32bit version on the same machine

I am trying to cross compile a version of my software for a 64bit platform. Can I have the 32bit and 64bit version of libstdc++ installed on the same machine without too much worries of breaking my linux install. The Os is 32bit ubuntu.
I have not cross compiled before and just wanted to check that if I set my CFLAGS and LDFLAGS
for the appropriate CPU I should be ok once I have the correct versions of libstdc++ installed.
I checked a 64bit version of ubuntu however this has a symbolic link
lib64 -> lib
this would mess up lots if this is the case on a 32bit machine too anyone know how to sort this?
I am hitting the following error at the moment
[exec] /usr/bin/ld: skipping incompatible /usr/lib/gcc/i486-linux-gnu/4.2.4/libstdc++.so
[exec] /usr/bin/ld: skipping incompatible /usr/lib/gcc/i486-linux-gnu/4.2.4/libstdc++.a
when searching for -lstdc++ [exec] /usr/bin/ld: skipping incompatible
and so on till
[exec] /usr/bin/ld: cannot find -lstdc++
[exec] collect2: ld returned 1 exit status
Which seems to be due to fact I do not have the 64bit version of libstdc++
Sure you can.
Just put them into /usr/lib and /usr/lib64, respectively.
Can't check it on Ubuntu, but on Fedora they get there right from the packages:
[~#] repoquery -q -l libstdc++.i386
/usr/lib/libstdc++.so.6
/usr/lib/libstdc++.so.6.0.10
[~#] repoquery -q -l libstdc++.x86_64
/usr/lib64/libstdc++.so.6
/usr/lib64/libstdc++.so.6.0.10