LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-02-2014, 03:09 AM   #1
nagendrar
Member
 
Registered: Apr 2008
Location: HYD, INDIA.
Posts: 154

Rep: Reputation: 15
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
 
Old 12-02-2014, 03:23 AM   #2
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,869
Blog Entries: 1

Rep: Reputation: 1870Reputation: 1870Reputation: 1870Reputation: 1870Reputation: 1870Reputation: 1870Reputation: 1870Reputation: 1870Reputation: 1870Reputation: 1870Reputation: 1870
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 $<
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Program development with shared libraries (OpenCV exe fails on another machine) roundpotato Linux - Software 7 06-27-2014 04:14 AM
error while loading shared libraries: libexpat.so.0: cannot open shared object file: Naimbora Linux - General 2 08-02-2013 01:53 PM
shared partitions between 13.1(32bit) and current(64bit) PDock Slackware 4 01-26-2011 12:37 AM
CentOS 5.3 (64bit) - error while loading shared libraries: librpmdb-4.4.so Orayi Red Hat 2 09-24-2009 08:39 AM
error while loading shared libraries: libdb-4.1.so: cannot open shared object file putquery8581 Linux - Software 1 10-01-2004 07:03 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:12 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration