开发者

Envrionmental Variables in info.plist don't work

I am using an info.plist in Xcode to set the Environmental Variables, DYLD_LIBRARY_PATH and DYLD_FRAMEWORK_PATH.

I am setting DYLD_LIBRARY_PATH to

$CONTENTS_FOLDER_PATH/runtime/1.1.0:$CONTENTS_FOLDER_PATH/modules/tiapp/1.1.0:$CONTENTS_FOLDER_PATH/modules/ticodec/1.1.0:$CONTENTS_FOLDER_PATH/modules/tidatabase/1.1.0:$CONTENTS_FOLDER_PATH/modules/tifilesystem/1.1.0:$CONTENTS_FOLDER_PATH/modules/timedia/1.1.0:$CONTENTS_FOLDER_PAT开发者_如何学GoH/modules/timonkey/1.1.0:$CONTENTS_FOLDER_PATH/modules/tinetwork/1.1.0:$CONTENTS_FOLDER_PATH/modules/tiplatform/1.1.0:$CONTENTS_FOLDER_PATH/modules/tiprocess/1.1.0:$CONTENTS_FOLDER_PATH/modules/tiui/1.1.0:$CONTENTS_FOLDER_PATH/modules/tiworker/1.1.0

and

DYLD_FRAMEWORK_PATH to

$CONTENTS_FOLDER_PATH/runtime/1.1.0

And when I double click my .app folder dlopen can't find any of my .dylib that are referenced in the folders above.

If I take the same exact variables and paths and place them in my Executable Arguments in Xcode, everything works fine, but only if I run the software through Xcode, and I need everything to work when you click on the .app folder.

What am I doing wrong in the info.plist? Does it not like the $CONTENTS_FOLDER_PATH? Does it need a different delimiter? Why does the same arguments work in the Executable Arguments but not in the info.plist file?

Thanks in advance.


What key are you using in Info.plist to set environment variables? Do you mean you're setting environment variables in Xcode's "Environment Variables" configuration (part of the Scheme in Xcode 4, part of the Custom Executable in Xcode 3), or do you mean you're just throwing key/values into Info.plist and expecting them to show up in the environment?

In the former case, even if this worked, it would only be useful while you were running Xcode, not when you shipped your product. In the latter case, Info.plist doesn't have a mechanism for adding environment variables to my knowledge.

Personally, rather than having this huge tree in your bundle, I'd have Xcode copy all of your dylibs into your bundle's plugin directory (PlugIns) and then use NSBundle (or CFBundle) to get the path to it. Or you could use another directory if these aren't really "plugins." But put them all in one directory inside your bundle. Don't search for them. (You are free to have them in many directories in your source tree; this is purely about the bundle.)


I ended up using the @rpath to find all my dylibs and frameworks. I rebuilt all frameworks and libraries with the install name of @rpath/-name of library or framework-.

Then I added in the main project's run search path settings relative path names like @loader_path/../runtime/1.1.0 and @loader_path/../modules/, etc...

This allows dlopen call to find the current path without using plist or executable arguments.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜