Bug 101594 - dlopen cannot open libmyodbc.so
dlopen cannot open libmyodbc.so
Status: CLOSED NOTABUG
Product: Red Hat Linux
Classification: Retired
Component: gcc (Show other bugs)
9
i686 Linux
high Severity high
: ---
: ---
Assigned To: Jakub Jelinek
Brian Brock
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2003-08-04 11:39 EDT by Phillip Lee Thomas
Modified: 2005-10-31 17:00 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2003-08-06 18:57:35 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Phillip Lee Thomas 2003-08-04 11:39:18 EDT
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

Test program: 

# compile: gcc -o z -o z.c -ldl
#include <stdio.h>
#include "/usr/include/dlfcn.h"
 
int main()
{
   void *v = dlopen("/usr/lib/libmyodbc.so", RTLD_LAZY);
 
   printf("v = %p\n", v);
   exit(0);
}

Version-Release number of selected component (if applicable):


How reproducible:
Always

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.
3.
    

Actual Results:  Null pointer returned.

Expected Results:  address of library

Additional info:

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.
Comment 1 Jakub Jelinek 2003-08-04 16:40:19 EDT
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 ());
Comment 2 Jakub Jelinek 2003-08-06 18:57:35 EDT
> [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
solely).

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
days).
As a workaround, you can put LD_ASSUME_KERNEL=2.4.19 or earlier in the environment
and it should for now work.

Note You need to log in before you can comment on or make changes to this bug.