About DYLIB search path

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

About DYLIB search path

Thales Luis Rodrigues Sabino
I was able to build and use luabind within my applications without problems but I have one question.

In order to test LuaBind I created a command line tool using XCode 4.2. I add libluabind.dylib in the "link binaries with" area and add a copy phase in order to copy the dylib to the same directory where the executable resides. Using otool to grab information about the executable dependencies I get the following

LuaBindExample:
bin/darwin/release/libluabind.dylib (compatibility version 0.0.0, current version 0.0.0)
/opt/local/lib/liblua.dylib (compatibility version 5.1.0, current version 5.1.4)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.9.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.11)


My question is why the dylib path for luabind starts with bin/?

I copy the dylib file in the executable directory but if I run the program it gives the following error

dyld: Library not loaded: bin/darwin/release/libluabind.dylib
  Referenced from: /Users/tluisrs/Library/Developer/Xcode/DerivedData/LuaBindExamples-fnnpnobfkchkzdemmonixfvtemzl/Build/Products/Debug/./LuaBindExample
  Reason: image not found
Trace/BPT trap

Which I can understand. I was able to solve this problem exporting the dylib path in the environment variable DYLD_LIBRARY_PATH. But I was trying to create a stand alone "bundle" in order to distribute my application without having to configure the environment every single time.

To build luabind I use bjam. I did not find any information about how to change the search path for a dylib within an executable. 

Does anyone have a clue?

Thanks.

--
Anyday, anytime.

http://www.capimlokura.com.br

Thales Luis Rodrigues Sabino
TLuisRS

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
luabind-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user
Reply | Threaded
Open this post in threaded view
|

Re: About DYLIB search path

liam mail
On 30 April 2012 18:49, Thales Luis Rodrigues Sabino <[hidden email]> wrote:

> I was able to build and use luabind within my applications without problems
> but I have one question.
>
> In order to test LuaBind I created a command line tool using XCode 4.2. I
> add libluabind.dylib in the "link binaries with" area and add a copy phase
> in order to copy the dylib to the same directory where the executable
> resides. Using otool to grab information about the executable dependencies I
> get the following
>
> LuaBindExample:
> bin/darwin/release/libluabind.dylib (compatibility version 0.0.0, current
> version 0.0.0)
> /opt/local/lib/liblua.dylib (compatibility version 5.1.0, current version
> 5.1.4)
> /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version
> 7.9.0)
> /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version
> 125.2.11)
>
>
> My question is why the dylib path for luabind starts with bin/?
>
> I copy the dylib file in the executable directory but if I run the program
> it gives the following error
>
> dyld: Library not loaded: bin/darwin/release/libluabind.dylib
>   Referenced from:
> /Users/tluisrs/Library/Developer/Xcode/DerivedData/LuaBindExamples-fnnpnobfkchkzdemmonixfvtemzl/Build/Products/Debug/./LuaBindExample
>   Reason: image not found
> Trace/BPT trap
>
> Which I can understand. I was able to solve this problem exporting the dylib
> path in the environment variable DYLD_LIBRARY_PATH. But I was trying to
> create a stand alone "bundle" in order to distribute my application without
> having to configure the environment every single time.
>
> To build luabind I use bjam. I did not find any information about how to
> change the search path for a dylib within an executable.
>
> Does anyone have a clue?
>
> Thanks.
>
> --
> Anyday, anytime.
>
> http://www.capimlokura.com.br
>
> Thales Luis Rodrigues Sabino
> TLuisRS
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> luabind-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/luabind-user
>

I do not know how to accomplish this with bjam yet this information may help.
Using the gcc or xcode you can achieve this by setting the
installpath(INSTALL_PATH) which will be prefixed to the dylib or
installname (LD_DYLIB_INSTALL_NAME )which is the path an dylib name.
If you want to change the name after you have compiled then you should
use max_path_install when compiling and change it via the command line
tool install_name_tool.

Liam

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
luabind-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user
Reply | Threaded
Open this post in threaded view
|

Re: About DYLIB search path

Thales Luis Rodrigues Sabino
What are you suggesting is to build luabind using xcode and set INSTALL_PATH or build my application with this variable configured?

On Mon, Apr 30, 2012 at 3:27 PM, liam mail <[hidden email]> wrote:
On 30 April 2012 18:49, Thales Luis Rodrigues Sabino <[hidden email]> wrote:
> I was able to build and use luabind within my applications without problems
> but I have one question.
>
> In order to test LuaBind I created a command line tool using XCode 4.2. I
> add libluabind.dylib in the "link binaries with" area and add a copy phase
> in order to copy the dylib to the same directory where the executable
> resides. Using otool to grab information about the executable dependencies I
> get the following
>
> LuaBindExample:
> bin/darwin/release/libluabind.dylib (compatibility version 0.0.0, current
> version 0.0.0)
> /opt/local/lib/liblua.dylib (compatibility version 5.1.0, current version
> 5.1.4)
> /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version
> 7.9.0)
> /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version
> 125.2.11)
>
>
> My question is why the dylib path for luabind starts with bin/?
>
> I copy the dylib file in the executable directory but if I run the program
> it gives the following error
>
> dyld: Library not loaded: bin/darwin/release/libluabind.dylib
>   Referenced from:
> /Users/tluisrs/Library/Developer/Xcode/DerivedData/LuaBindExamples-fnnpnobfkchkzdemmonixfvtemzl/Build/Products/Debug/./LuaBindExample
>   Reason: image not found
> Trace/BPT trap
>
> Which I can understand. I was able to solve this problem exporting the dylib
> path in the environment variable DYLD_LIBRARY_PATH. But I was trying to
> create a stand alone "bundle" in order to distribute my application without
> having to configure the environment every single time.
>
> To build luabind I use bjam. I did not find any information about how to
> change the search path for a dylib within an executable.
>
> Does anyone have a clue?
>
> Thanks.
>
> --
> Anyday, anytime.
>
> http://www.capimlokura.com.br
>
> Thales Luis Rodrigues Sabino
> TLuisRS
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> luabind-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/luabind-user
>

I do not know how to accomplish this with bjam yet this information may help.
Using the gcc or xcode you can achieve this by setting the
installpath(INSTALL_PATH) which will be prefixed to the dylib or
installname (LD_DYLIB_INSTALL_NAME )which is the path an dylib name.
If you want to change the name after you have compiled then you should
use max_path_install when compiling and change it via the command line
tool install_name_tool.

Liam

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
luabind-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user



--
Anyday, anytime.

http://www.capimlokura.com.br

Thales Luis Rodrigues Sabino
TLuisRS

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
luabind-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user