简体   繁体   中英

Compile Ada sources without the shared libraries

How can I compile the Hello World program from here on a glibc environment and run it on a uclibc environment?

localhost:~$ readelf -d /home/localhost/hello | grep NEEDED
0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]

Have a look at dlopen() library set of functions. You'll need to load the libraries from the source file itself. The following code is in C, but you can use Interafaces.C in Ada to interoperate with C libraries:

lib_handle = dlopen("/opt/lib/libctest.so", RTLD_LAZY);
if (!lib_handle) 
{
   fprintf(stderr, "%s\n", dlerror());
   exit(1);
}

Visit this link for help. This man page dlopen(3) should also help.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM