LinuxQuestions.org
Visit Jeremy's Blog.
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 07-29-2014, 04:23 PM   #1
usef62
Member
 
Registered: Dec 2006
Posts: 50

Rep: Reputation: 15
How make a type specific LIB and ELF


Hi
Can someone help please.
How can I build a LIB & ELF that only possible to compile and run on one kind of Linux distribution?
Is it possible to create a type-specific ELF & LIB?

Thanks
 
Old 07-29-2014, 04:33 PM   #2
notKlaatu
Senior Member
 
Registered: Sep 2010
Location: Lawrence, New Zealand
Distribution: Slackware
Posts: 1,077

Rep: Reputation: 732Reputation: 732Reputation: 732Reputation: 732Reputation: 732Reputation: 732Reputation: 732
It sounds like you are trying to compile something into a binary of a specific architecture, it, a 32bit binary, or a 64bit binary. Is that what you are trying to do?

If so, you need to have the libraries and header files installed *for that architecture*. So if your system is 64bit and you are trying to compile something for 32xit, then you need the libs and headers for 32bit; just because you have the 64bit versions on your system does not mean the 32bit versions are also there. So you probably need to install those.

After that, it's a simple(-ish) matter of gcc usage. For example:

Code:
gcc -m32 infile.c -o outfile -L/usr/lib -march=i586

More details about what your system is, and what your target is, and what you have tried so far would be helpful.
 
Old 07-29-2014, 10:48 PM   #3
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,863
Blog Entries: 1

Rep: Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869
Script configure might check the distribution (eg via searching for distro-specific files in /etc), if that's what you mean... of course the user will see the script, so they can remove the check. It wouldn't make much sense anyways.

PS: exactly what do you mean under 'kind' and 'type'?

Last edited by NevemTeve; 07-29-2014 at 10:49 PM.
 
Old 07-29-2014, 11:29 PM   #4
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,225

Rep: Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320
Quote:
Originally Posted by usef62 View Post
Hi
Can someone help please.
How can I build a LIB & ELF that only possible to compile and run on one kind of Linux distribution?
Is it possible to create a type-specific ELF & LIB?

Thanks
You mean you want to make an executable that only runs in say, Ubuntu and won't work in say, Arch?

Of course it's not possible.

I'm curious as to why you want to do that though.
 
  


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
"bash: /usr/bin/: /lib/ld-linux.so.2: bad ELF interpreter: No such file or direc LittleMaster Linux - Server 4 05-25-2013 03:42 AM
Way to make autofs mount to specific USB flash drive to specific folder? utahnix Linux - Software 2 11-24-2010 05:27 PM
[SOLVED] how to make grep to search a pattern in only specific file type mq15 Linux - Newbie 7 03-07-2010 09:41 AM
snes9x lib and ELF header issues jasondcater Linux - Games 2 05-13-2004 05:28 PM
NVIDIA: lib/modules/2.4.22/net not ELF file coasterdigi Linux - Hardware 2 04-05-2004 04:33 PM

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

All times are GMT -5. The time now is 03:44 PM.

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