Re: Customers Machines missing /usr/lib/libltdl.3.dylib
Re: Customers Machines missing /usr/lib/libltdl.3.dylib
- Subject: Re: Customers Machines missing /usr/lib/libltdl.3.dylib
- From: Matteo Centro <email@hidden>
- Date: Thu, 19 Feb 2009 17:49:19 +0100
On Feb 19, 2009, at 4:02 AM, Peter O'Gorman wrote:
Matteo Centro wrote:
Hi,
I have an application that needs to use an external opensource
library,
libp11 (http://www.opensc-project.org/libp11) I managed to compile it
(./configure and make) and to include it in my XCode Project as a
static
library so it should work on any machine with no need to install it
separately... I tested on many machines (all with DevTools installed)
and it's working perfectly.
The problem arises when I try it on a "virgin" machine with no
DevTools
installed! It complains about a missing /usr/lib/libltdl.3.dylib
IMO this is a bug, the real library does not belong in the devSDK.
I investigated and libp11 is using libltdl, the library is
apparently on
the SDK (both 10.4 and 10.5) but it is not installed on machines
without
dev tools. I assume I have to recompile libp11 to use a local libltdl
but I don't know how to do it. Can I fix something in XCode or the
only
option is to recompile libp11?
Any help would be appreciated! Thanks!
In this case, rather than linking with the static libltdl.a, I would
just remove the libltdl requirement. The attached patch should work
along with make LTLIB_LIBS="" (to remove the -ltdl from the link
line).
Note that I have not actually tested this :)
Tested, it works!
Thank you Peter, you saved my day!!
Matteo
Peter
--
Peter O'Gorman
http://pogma.com
--- src/libpkcs11.c~ 2008-07-31 07:06:24.000000000 -0500
+++ src/libpkcs11.c 2009-02-18 20:27:29.000000000 -0600
@@ -27,14 +27,14 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <ltdl.h>
+#include <dlfcn.h>
#include "libp11-int.h"
#define MAGIC 0xd00bed00
struct sc_pkcs11_module {
unsigned int _magic;
- lt_dlhandle handle;
+ void* handle;
};
typedef struct sc_pkcs11_module sc_pkcs11_module_t;
@@ -52,19 +52,16 @@
if (mspec == NULL)
return NULL;
- if (lt_dlinit() != 0)
- return NULL;
-
mod = (sc_pkcs11_module_t *) calloc(1, sizeof(*mod));
mod->_magic = MAGIC;
- mod->handle = lt_dlopen(mspec);
+ mod->handle = dlopen(mspec,RTLD_GLOBAL);
if (mod->handle == NULL)
goto failed;
/* Get the list of function pointers */
c_get_function_list = (CK_RV (*)(CK_FUNCTION_LIST_PTR_PTR))
- lt_dlsym(mod->handle, "C_GetFunctionList");
+ dlsym(mod->handle, "C_GetFunctionList");
if (!c_get_function_list)
goto failed;
rv = c_get_function_list(funcs);
@@ -89,13 +86,11 @@
if (!mod || mod->_magic != MAGIC)
return CKR_ARGUMENTS_BAD;
- if (lt_dlclose(mod->handle) < 0)
+ if (dlclose(mod->handle) < 0)
return CKR_FUNCTION_FAILED;
memset(mod, 0, sizeof(*mod));
free(mod);
- lt_dlexit();
-
return CKR_OK;
}
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden