LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Prepare shared one with 32bit opsec libraries and shared one should load by 64bit exe (https://www.linuxquestions.org/questions/programming-9/prepare-shared-one-with-32bit-opsec-libraries-and-shared-one-should-load-by-64bit-exe-4175527065/)

nagendrar 12-02-2014 03:09 AM

Prepare shared one with 32bit opsec libraries and shared one should load by 64bit exe
 
HI,
currently opsec libraries are available with 32bit version only.

Here my problem is,

I prepared shared library on 64bit machine with "-m32" option which links to 32 bit opsec library.

But this newly built shared library is failed to load with 64bit executable and giving "wrong ELF class: ELFCLASS32" error.

Please help me.
How would I build shared lib with 32bit opsec library on 64bit machine and How would this newly built shared lib loaded by 64bit executable? (In Linux).

-regards
Nagendra Rednam

NevemTeve 12-02-2014 03:23 AM

Replace -m32 with -m64.

Eg:
Code:

# Makefile

MODS=a b c

all: obj-64/libabc.la obj-32/libabc.la

obj-64/libabc.la: $(foreach m,$(MODS),obj-64/$m.lo)
        libtool --mode=link gcc -rpath /usr/local/lib64 -m64 ${LDFLAGS} -o $@ $^

obj-32/libabc.la: $(foreach m,$(MODS),obj-32/$m.lo)
        libtool --mode=link gcc -rpath /usr/local/lib  -m32 ${LDFLAGS} -o $@ $^

obj-64/%.lo: %.c
        libtool --mode=compile gcc -m64 ${CPPFLAGS} ${CFLAGS} -o $@ -c $<

obj-32/%.lo: %.c
        libtool --mode=compile gcc -m32 ${CPPFLAGS} ${CFLAGS} -o $@ -c $<



All times are GMT -5. The time now is 10:35 PM.