Bug #23923 Cannot open library: './libmyodbc3.so' is not a valid load module: Bad magic num
Submitted: 3 Nov 2006 9:05 Modified: 8 Nov 2006 15:55
Reporter: sreenivasulu Gelle Email Updates:
Status: Not a Bug Impact on me:
None 
Category:Connector / ODBC Severity:S1 (Critical)
Version:mysql-connector-odbc-3.51.12-HPUX11.23-i OS:HP/UX (Hp-UX Itanium)
Assigned to: CPU Architecture:Any

[3 Nov 2006 9:05] sreenivasulu Gelle
Description:
Downloaded binaries for mysql-connector-odbc-3.51.12-HPUX11.23-ia64-64bit.
while loading library I'm getting Cannot open library: './libmyodbc3.so' is not a valid load module: Bad magic number.

My sample program is : test.cpp
#include <iostream.h>
#include <dlfcn.h>
int main()
{
 void* handle = dlopen("./libmyodbc3.so",RTLD_LAZY);
 if (!handle)
 {
 cerr << "Cannot open library: " << dlerror() << '\n';
 return 1;
 }
 else
 {
 cout << "Closing library...\n";
 dlclose(handle);
 return 0;
 }

}

Compiled with aCC -mt -lpthread -ldl test.cpp
executed ./a.out

How to repeat:
compile and run test.cpp
[8 Nov 2006 15:54] Bogdan Degtyariov
The problem can be resolved when use +DD64 compiler option. By default aCC generates 32-bit executables that cannot load 64-bit shared libs.

so the linking string should look as follows:
aCC +DD64 -mt -lpthread -ldl test.cpp -o test