After some digging, I found the relevant ticket number commits that are
causing this problem.  I am not sure how to reconcile the need to have
ctypes working, and the resolving of ticket #388.

http://www.pyinstaller.org/ticket/388

Commit: a22f9b9a02777ab815113a5aa3dd81a24f8f93b6  Nov 13, 2011


On Tue, May 7, 2013 at 12:30 PM, Daniel Hyams <[email protected]> wrote:

> With the latest (develop) version of PyInstaller, I suddenly started
> having problems loading a shared library via ctypes, meaning:
>
> my_dll = ctypes.CDLL('thelib.so')
>
>  would fail (the exception returned was dlopen failed).  After searching
> around in the bootloader, I found that the LD_LIBRARY_PATH, in the previous
> versions of pyinstaller, was set to the distribution path under all
> platforms, now it's not for OSX.  I've attached the code that I'm talking
> about at the end of this message...
>
> For the time being, I can fix the failing ctypes.CDLL() call by simply
> deactivating the "ifdef __APPLE__" part.
>
> I don't quite understand the reason for the change that's specific to OSX,
> but I thought that I'd let you know that is breaks importing "foreign"
> libraries in frozen code.
>
> I tried to grok the comment there, but it doesn't make sense to me...seems
> that if there are duplicate libraries between the dist directory and the
> system, the libs in the dist directory should always take precedence.
>
>
> bootloader/common/pyi_utils.c:
>
> int pyi_utils_set_environment(const ARCHIVE_STATUS *status)
>
> {
>
>     int rc = 0;
>
>
> #ifdef __APPLE__
>
>     /* On Mac OS X we do not use environment variables DYLD_LIBRARY_PATH
>
>      * or others to tell OS where to look for dynamic libraries.
>
>      * There were some issues with this approach. In some cases some
>
>      * system libraries were trying to load incompatible libraries from
>
>      * the dist directory. For instance this was experienced with macprots
>
>      * and PyQt4 applications.
>      *
>
>      * To tell the OS where to look for dynamic libraries we modify
>
>      * .so/.dylib files to use relative paths to other dependend
>
>      * libraries starting with @executable_path.
>      *
>      * For more information see:
>
>      * http://blogs.oracle.com/dipol/entry/dynamic_libraries_rpath_and_mac
>
>      * http://developer.apple.com/library/mac/#documentation/DeveloperTools/  
> \
>
>      *     
> Conceptual/DynamicLibraries/100-Articles/DynamicLibraryUsageGuidelines.html
>
>      */
>
>
>     /* For environment variable details see 'man dyld'. */
>
>
>       pyi_unsetenv("DYLD_FRAMEWORK_PATH");
>
>       pyi_unsetenv("DYLD_FALLBACK_FRAMEWORK_PATH");
>
>       pyi_unsetenv("DYLD_VERSIONED_FRAMEWORK_PATH");
>
>       pyi_unsetenv("DYLD_LIBRARY_PATH");
>
>       pyi_unsetenv("DYLD_FALLBACK_LIBRARY_PATH");
>
>       pyi_unsetenv("DYLD_VERSIONED_LIBRARY_PATH");
>
>       pyi_unsetenv("DYLD_ROOT_PATH");
>
>
> #else
>
>     /* Set library path to temppath. This is only for onefile mode.*/
>
>     if (status->temppath[0] != PYI_NULLCHAR) {
>
>         rc = set_dynamic_library_path(status->temppath);
>
>     }
>
>     /* Set library path to homepath. This is for default onedir mode.*/
>
>
>     else {
>
>         rc = set_dynamic_library_path(status->homepath);
>
>     }
> #endif
>
>     return rc;
>
> }
>
>
> --
> Daniel Hyams
> [email protected]
>



-- 
Daniel Hyams
[email protected]

-- 
You received this message because you are subscribed to the Google Groups 
"PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pyinstaller?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to