lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

> ------------------------------
> Message: 6
> Date: Tue, 14 Jun 2011 21:38:21 +0200
> From: Dirk <>
> Subject: Lua with xcode 4 and c++
> To:
> Message-ID: <>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
> Hi,
> I hope I am asking this on the right place, sorry if not.
> I am an advanced c++ windows programmer and have used LUA for years now. 
> I use lua in almost all my C++ projects (currently a 3d game engine).
> Now that I am trying to port to Mac OS, I want to get lua working on a 
> simple xcode test project (I want to use xcode 4 to build, I am not good 
> with command line things).
> I have tried to simply use the libraries and includes for mac os from 
>, I could my my project 
> compile and link but when running, I get from the debugger:
> dyld: Library not loaded: liblua5.1.dylib
>   Referenced from: 
> /Users/dirk/Library/Developer/Xcode/DerivedData/luaTest-baatbabovkeyxadjtjiknwmhoykz/Build/Products/Debug/
>   Reason: image not found
> and the program won't continue.

Hi Dirk, I'll give you a few things to google on!

Xcode likes to use the dylib where possible...otool -L on the dylib shows its path as being liblua5.1.dylib I like to have it as @executable_path/../Frameworks.  You can change this using install_name_tool (man install_name_tool) 


cd /DirWithLibs
install_name_tool -id "@executable_path/../Frameworks/liblua5.1.dylib" ./lua5_1_4_MacOS106_lib/liblua5.1.dylib
Then otool -L shows that indeed it'll be looking in your app's Framworks folder(you can add a copy phase to Xcode and/or just copy the dylib into the Frameworks folder by right clicking on the app and show package contents)

Or if linking statically is an option for you remove the dylib from the directory and tell xcode to use the .a file when linking.

otool -L is your friend you can use it on your application as well to ensure all your link paths(like Dependancy Walker!)

Hope that helps