LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   How make a type specific LIB and ELF (https://www.linuxquestions.org/questions/programming-9/how-make-a-type-specific-lib-and-elf-4175512660/)

usef62 07-29-2014 04:23 PM

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

notKlaatu 07-29-2014 04:33 PM

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.

NevemTeve 07-29-2014 10:48 PM

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'?

dugan 07-29-2014 11:29 PM

Quote:

Originally Posted by usef62 (Post 5211601)
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.


All times are GMT -5. The time now is 01:51 PM.