How to get the dang thing to work (Was: Linux: How to statically link against system libs?)

Spacen Jasset spacenjasset at yahoo.co.uk
Thu Apr 28 02:53:34 PDT 2011


On 27/04/2011 21:56, Nick Sabalausky wrote:
> "Nick Sabalausky"<a at a.a>  wrote in message
> news:ip9va1$2lbe$1 at digitalmars.com...
>> "Spacen Jasset"<spacenjasset at yahoo.co.uk>  wrote in message
>> news:ip9n5d$27je$1 at digitalmars.com...
>>>
>>> try lsb_release for this, if you aren't sure (and it's available as a
>>> command)
>>>
>>> jason at ionrift:~$ lsb_release -a
>>> No LSB modules are available.
>>> Distributor ID: Ubuntu
>>> Description:    Ubuntu 10.04.2 LTS
>>> Release:        10.04
>>> Codename:       lucid
>>>
>>> otherwise cat /etc/*release*
>>>
>>
>> On my system, the one I'm compiling on, I get:
>>
>> $ lsb_release -a
>> No LSB modules are available.
>> Distributor ID: Ubuntu
>> Description:    Ubuntu 10.04.1 LTS
>> Release:        10.04
>> Codename:       lucid
>>
>> On the main server I just get:
>>
>> $ lsb_release -a
>> -jailshell: lsb_release: command not found
>>
>
> On the main server, cat /etc/*release* doesn't work either:
>
> $ cat /etc/*release*
> cat: cat /etc/*release*: No such file or directory
>
>
>

I see. It looks like you are trying to run at least on debian 4 yes.


What I would suggest you do is get the oddest debian or centos 
distribution you can, use a virtual box, and build on that. e.g. centos 3

It is possible to get "compat libraries" for some distributions, but 
that may just be more hassle.


You *can* by the way statically link any libraries (if you need to), 
except libc.so. As other libraries don't call the kernel directly.

something like this:

gcc obects.o -Wl,-Bstatic -lc++ -lfoo -lfish -Wl,-Bdynamic



The way to then check if the binary will run on an older (or newer 
system) is

ldd <executable> or library. It will then tell you what it will bind to, 
or if it cannot find any particular library.


More information about the Digitalmars-d-learn mailing list