curl / Mailing Lists / curl-library / Single Mail

curl-library

Re: Need to build 32-bit curl on RH Linux 64-bit

From: Petr Pisar via curl-library <curl-library_at_cool.haxx.se>
Date: Fri, 15 Mar 2019 17:08:34 +0100

On Thu, Mar 14, 2019 at 07:46:04PM +0000, Robert Sorrells via curl-library wrote:
> Conclusion: I have determined that under RHEL 6.6 it is not possible to
> change the absolute search path of "ld". I managed to pare it down by
> playing with /etc/ld.so.conf, but it still ALWAYS searches /usr/lib64 first.
> "ld" itself is dependent on /usr/lib64 for run-time, but this should have no
> influence on the SEARCH path for linking. I'm going to have my SA install
> the 32-bit RPM.
>
You could use --sysroot option to redefine the default library path, but it's
not necessary.

You only need to install i686 packages plus libgcc.i686 that seem not to be
picked up automatically (otherwise ld would complain "cannot find -lgcc_s").
After that I can build a 32-bit application that uses OpenSSL library:

$ cat test.c
#include <stdio.h>
#include <openssl/crypto.h>
int main(void) {
    printf("%s\n", SSLeay_version(SSLEAY_VERSION));
    return 0;
}

$ gcc -m32 test.c -lcrypto
$ file a.out
a.out: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, not stripped
$ ldd a.out
        linux-gate.so.1 => (0x00ede000)
        libcrypto.so.10 => /usr/lib/libcrypto.so.10 (0x00396000)
        libc.so.6 => /lib/libc.so.6 (0x00cc5000)
        libdl.so.2 => /lib/libdl.so.2 (0x00fc1000)
        libz.so.1 => /lib/libz.so.1 (0x006fd000)
        /lib/ld-linux.so.2 (0x00711000)
$ ./a.out
OpenSSL 1.0.1e-fips 11 Feb 2013

For you reference, this is a complete list of i686 packages I installed into my
RHEL 6.10 x86_64 system:

# rpm -qa |grep i686
libselinux-2.0.94-7.el6.i686
krb5-libs-1.10.3-65.el6.i686
keyutils-libs-1.4-5.el6.i686
nss-softokn-freebl-3.14.3-23.3.el6_8.i686
openssl-devel-1.0.1e-57.el6.i686
openssl-1.0.1e-57.el6.i686
libcom_err-1.41.12-23.el6.i686
libgcc-4.4.7-18.el6_9.2.i686
glibc-2.12-1.209.el6_9.2.i686
glibc-devel-2.12-1.209.el6_9.2.i686
zlib-1.2.3-29.el6.i686

-- Petr

-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html

Received on 2019-03-15