From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3.1) Gecko/20030530
Description of problem:
Cannot open libmyodbc.so using dlopen()
Worked under RedHat 8
# compile: gcc -o z -o z.c -ldl
void *v = dlopen("/usr/lib/libmyodbc.so", RTLD_LAZY);
printf("v = %p\n", v);
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Compile above program z.c with -ldl
2. Have tried under several libmyodbc.so versions, include MyODBC-2.50.36 and later.
Actual Results: Null pointer returned.
Expected Results: address of library
dlopen() works with some other libraries, but my MyODBC library can be loaded,
whether from RedHat site or MySQL site.
Bugzilla reports other dlopen() problems that may be the same or similar.
You should use dlerror function to see why dlopen has not been successful.
After dlopen add if (!v) printf ("dlopen failed with %s\n", dlerror ());
> [ptho@firefly projects]$ ./z
> v = (nil)
> dlopen failed with /usr/lib/libmysqlclient.so.10: symbol errno, version
> GLIBC_2.0 not defined in file libc.so.6 with link time reference
That means /usr/lib/libmysqlclient.so.10 has been built incorrectly.
Dunno what mysql you're using, certainly it doesn't look
like the one provided in RHL9 or its errata (that uses __errno_location
You should fix it (the fix is making sure there are no extern int errno;
in the sources, instead wherever errno is used #include <errno.h> preceedes
it - standards allow errno to be a macro and in glibc it is, since glibc 2.1.0
As a workaround, you can put LD_ASSUME_KERNEL=2.4.19 or earlier in the environment
and it should for now work.