Bug 101594 - dlopen cannot open libmyodbc.so
Summary: dlopen cannot open libmyodbc.so
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: gcc
Version: 9
Hardware: i686
OS: Linux
high
high
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Brian Brock
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2003-08-04 15:39 UTC by Phillip Lee Thomas
Modified: 2005-10-31 22:00 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2003-08-06 22:57:35 UTC
Embargoed:


Attachments (Terms of Use)

Description Phillip Lee Thomas 2003-08-04 15:39:18 UTC
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 20:40:19 UTC
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 22:57:35 UTC
> [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.