Re: [C++-sig] Getting simple boost.python extension to work outside the test scripts - HELP!
Nope, doesn’t help. However, based on your input, I found install_name_tool and used it to modify hello_ext.so to point to the actual location. That works well, so at least I have a path forward with boost.python. I’m not sure the bjam approach is buying me much compared to Xcode or make, but at least I’ve got it to work. * Andy From: Cplusplus-sig on behalf of stefan Reply-To: Development of Python/C++ integration Date: Wednesday, May 22, 2019 at 11:36 AM To: "cplusplus-sig@python.org" Subject: Re: [C++-sig] Getting simple boost.python extension to work outside the test scripts - HELP! On 2019-05-22 2:30 p.m., Jones, Torrin A (US) wrote: You may need to set PYTHONPATH. Search for PYTHONPATH on this page for a description. https://docs.python.org/3/using/cmdline.html No, PYTHONPATH is used by the Python runtime to locate (Python) modules. It is not used to resolve shared library dependencies. [Stefan] -- ...ich hab' noch einen Koffer in Berlin... ___ Cplusplus-sig mailing list Cplusplus-sig@python.org https://mail.python.org/mailman/listinfo/cplusplus-sig
Re: [C++-sig] Getting simple boost.python extension to work outside the test scripts - HELP!
On 2019-05-22 2:30 p.m., Jones, Torrin A (US) wrote: You may need to set PYTHONPATH. Search for PYTHONPATH on this page for a description. https://docs.python.org/3/using/cmdline.html No, PYTHONPATH is used by the Python runtime to locate (Python) modules. It is not used to resolve shared library dependencies. Stefan -- ...ich hab' noch einen Koffer in Berlin... ___ Cplusplus-sig mailing list Cplusplus-sig@python.org https://mail.python.org/mailman/listinfo/cplusplus-sig
Re: [C++-sig] Getting simple boost.python extension to work outside the test scripts - HELP!
On 2019-05-22 2:28 p.m., Andrew Voelkel wrote: That is helpful. It might indeed be an issue with System Integrity Protection, now that I do the right google search. But that leads to the second question. It is possible to indicate within hello_ext.so where to look for the dylib. Then in theory this wouldn’t a problem, because I wouldn’t need to set DYLD_LIBRARY_PATH. Is this insertion of the path of libboost_python37.dylib into hello_ext.so something I can do with bjam, or am I going to have to figure out how to use a separate build system? I'm cross-posting this to the Boost.Build mailing list, since that's the best (only ?) place where you'll get an answer to this question. Stefan -- ...ich hab' noch einen Koffer in Berlin... ___ Cplusplus-sig mailing list Cplusplus-sig@python.org https://mail.python.org/mailman/listinfo/cplusplus-sig
Re: [C++-sig] Getting simple boost.python extension to work outside the test scripts - HELP!
You may need to set PYTHONPATH. Search for PYTHONPATH on this page for a description. https://docs.python.org/3/using/cmdline.html From: Cplusplus-sig [mailto:cplusplus-sig-bounces+torrin.jones=baesystems@python.org] On Behalf Of Andrew Voelkel Sent: Wednesday, May 22, 2019 10:56 AM To: Development of Python/C++ integration Subject: [C++-sig] Getting simple boost.python extension to work outside the test scripts - HELP! *** WARNING *** EXTERNAL EMAIL -- This message originates from outside our organization. Hi, I spent most of yesterday trying to get the simple tutorials and example to build from within the Boost example folders, and finally succeeded. It was not super straightforward as the instructions seem incomplete and out of date. But after finding a tutorial on Boost.Build and understanding how it works, I was able to debug the build process and get the test scripts to run successfully. Now I'd like to move to Spyder and run simple tests on the extension. However, when I try to execute a simple "import hello_ext" statement, I get an error trying to locate a dependent library. No amount of setting paths seem to help. (I copied libboost_python37.dylib to /Users/andy before running this script. I'm on Mac OS Mojave Commands: import os print(os.environ['PATH']) os.environ['PATH'] += ':/Users/andy' os.environ['DYLD_LIBRARY_PATH'] = '/Users/andy' print(os.environ['PATH']) print(os.environ['DYLD_LIBRARY_PATH']) import hello_ext Output: /Users/andy/anaconda3/bin:/Users/andy/anaconda3/condabin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin /Users/andy/anaconda3/bin:/Users/andy/anaconda3/condabin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/andy /Users/andy Traceback (most recent call last): File "", line 7, in import hello_ext ImportError: dlopen(/Users/andy/Dropbox (Personal)/Developer/boost_1_70_0/libs/python/example/tutorial/hello_ext.so, 2): Library not loaded: libboost_python37.dylib Referenced from: /Users/andy/Dropbox (Personal)/Developer/boost_1_70_0/libs/python/example/tutorial/hello_ext.so Reason: image not found What magic is the boost environment performing to make this work? What can I do to make my python extensions look for libboost_python37.dylib in the location where it lives? Thanks in advance for any help! - Andy ___ Cplusplus-sig mailing list Cplusplus-sig@python.org https://mail.python.org/mailman/listinfo/cplusplus-sig
Re: [C++-sig] Getting simple boost.python extension to work outside the test scripts - HELP!
That is helpful. It might indeed be an issue with System Integrity Protection, now that I do the right google search. But that leads to the second question. It is possible to indicate within hello_ext.so where to look for the dylib. Then in theory this wouldn’t a problem, because I wouldn’t need to set DYLD_LIBRARY_PATH. Is this insertion of the path of libboost_python37.dylib into hello_ext.so something I can do with bjam, or am I going to have to figure out how to use a separate build system? * Andy From: Cplusplus-sig on behalf of stefan Reply-To: Development of Python/C++ integration Date: Wednesday, May 22, 2019 at 11:07 AM To: "cplusplus-sig@python.org" Subject: Re: [C++-sig] Getting simple boost.python extension to work outside the test scripts - HELP! On 2019-05-22 1:55 p.m., Andrew Voelkel wrote: What magic is the boost environment performing to make this work? What can I do to make my python extensions look for libboost_python37.dylib in the location where it lives? Boost.Build does inject a variety of paths into the system-specific path variable (I believe on MacOS that would be DYLD_LIBRARY_PATH) such that test executables can locate any shared libs they require. But I also remember having seen cases where some OSX releases specifically would prevent that mechanism from working due to some security concerns. I'm not a Mac user, so all of this is second-hand information. Best, [Stefan] -- ...ich hab' noch einen Koffer in Berlin... ___ Cplusplus-sig mailing list Cplusplus-sig@python.org https://mail.python.org/mailman/listinfo/cplusplus-sig
Re: [C++-sig] Getting simple boost.python extension to work outside the test scripts - HELP!
On 2019-05-22 1:55 p.m., Andrew Voelkel wrote: What magic is the boost environment performing to make this work? What can I do to make my python extensions look for libboost_python37.dylib in the location where it lives? Boost.Build does inject a variety of paths into the system-specific path variable (I believe on MacOS that would be DYLD_LIBRARY_PATH) such that test executables can locate any shared libs they require. But I also remember having seen cases where some OSX releases specifically would prevent that mechanism from working due to some security concerns. I'm not a Mac user, so all of this is second-hand information. Best, Stefan -- ...ich hab' noch einen Koffer in Berlin... ___ Cplusplus-sig mailing list Cplusplus-sig@python.org https://mail.python.org/mailman/listinfo/cplusplus-sig