[newbie] Not specifying the dynamic library?

G

Gilles Ganault

Hello

I don't have much experience with C, and have to solve the
following issue:
- I need to build a small C program on Linux CentOS where I have the
build environment, and copy the binary to AstLinux which doesn't
- the libraries are a bit different
- to save space, I'd like to use dynamic libraries instead of
compiling statically.

For instance, here's the LibC library:
============
[CentOS]# ll /lib/libc*
-rwxr-xr-x 1 root root 1586492 Dec 1 00:39 /lib/libc-2.5.so
lrwxrwxrwx 1 root root 11 Jan 22 02:49 /lib/libc.so.6 ->
libc-2.5.so
============
[AstLinux] # ll /lib/libc*
lrwxrwxrwx 1 root root 19 Jan 26 17:33 /lib/libc.so.0
-> libuClibc-0.9.28.so
============

And here's my program:
============
[CentOS]# cat check_cid.c
#include <stdio.h>
#include <stdlib.h>
#include <syslog.h>
#include <string.h>
//#include <cstdio>
#include <sqlite3.h>

int main(int argc, char *argv[])
{
//snip
return(EXIT_SUCCESS);
}
============

Is it possible to tell Gcc which filename to use as the DLL, so that
it doesn't complain when I copy the binary to AstLinux, and it will
gracefully load eg. libc.so.0 instead of libc.so.6?

Thank you.
 
S

santosh

Gilles said:
Hello

I don't have much experience with C, and have to solve the
following issue:
- I need to build a small C program on Linux CentOS where I have the
build environment, and copy the binary to AstLinux which doesn't
- the libraries are a bit different
- to save space, I'd like to use dynamic libraries instead of
compiling statically.

For instance, here's the LibC library:
============
[CentOS]# ll /lib/libc*
-rwxr-xr-x 1 root root 1586492 Dec 1 00:39 /lib/libc-2.5.so
lrwxrwxrwx 1 root root 11 Jan 22 02:49 /lib/libc.so.6 ->
libc-2.5.so
============
[AstLinux] # ll /lib/libc*
lrwxrwxrwx 1 root root 19 Jan 26 17:33 /lib/libc.so.0
-> libuClibc-0.9.28.so
============

And here's my program:
============
[CentOS]# cat check_cid.c
#include <stdio.h>
#include <stdlib.h>
#include <syslog.h>
#include <string.h>
//#include <cstdio>
#include <sqlite3.h>

int main(int argc, char *argv[])
{
//snip
return(EXIT_SUCCESS);

The brackets are not necessary.
}
============

Is it possible to tell Gcc which filename to use as the DLL,

The term "DLL" is, I believe Windows, terminology.
so that
it doesn't complain when I copy the binary to AstLinux, and it will
gracefully load eg. libc.so.0 instead of libc.so.6?

Thank you.

In addition to posting to the suggested group, please also search the
web for "cross compiling with gcc" or a similar string.
 
V

vippstar

Gilles said:
I don't have much experience with C, and have to solve the
following issue:
- I need to build a small C program on Linux CentOS where I have the
build environment, and copy the binary to AstLinux which doesn't
- the libraries are a bit different
- to save space, I'd like to use dynamic libraries instead of
compiling statically.

Please post to <where you will get
a much better response.


For instance, here's the LibC library:
============
[CentOS]# ll /lib/libc*
-rwxr-xr-x 1 root root 1586492 Dec 1 00:39 /lib/libc-2.5.so
lrwxrwxrwx 1 root root 11 Jan 22 02:49 /lib/libc.so.6 ->
libc-2.5.so
============
[AstLinux] # ll /lib/libc*
lrwxrwxrwx 1 root root 19 Jan 26 17:33 /lib/libc.so.0
-> libuClibc-0.9.28.so
============
And here's my program:
============
[CentOS]# cat check_cid.c
#include <stdio.h>
#include <stdlib.h>
#include <syslog.h>
#include <string.h>
//#include <cstdio>
#include <sqlite3.h>
int main(int argc, char *argv[])
{
//snip
return(EXIT_SUCCESS);

The brackets are not necessary.
Add to that that neither <syslog.h> or <sqlite3.h> are standard
headers.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top