Few... It's working with *jl_init_with_image()*, but only using
*sys-debug.dylib
*instead of the release version... A bug? With *sys.dylib *there is some
absolute paths, I'm getting a long error in the console, which starts wtih:
*signal (11): Segmentation fault: 11*
*jl_enter_handler at
/Users/osx/buildbot/slave/package_osx10_9-x64/build/src/builtins.c:191*
...
Anyway here is the steps how to embed Julia in a Xcode project:
1. Copy /include/ and /lib/ directories from Julia.app to your Xcode's
project directory. Also I've changed directory structure from the
/lib/julia/ and /include/julia/ to just /lib/ and /include/, so in my
project's directory it's in /julia/lib and /julia/include/;
2. Change paths for libraries *libccalltest.dylib*, *libgit2.dylib*,
*libpcre2-posix.0.dylib*, *libpcre2-8.0.dylib *using install_name_tool
to *@rpath/libname.dylib *(note that some of this libraries also has
different name);
3. In the Build Settings add* $(PROJECT_DIR)/julia/lib* (/julia/lib is
relative to my project directory structure) to Runpath Search Path (this
and the first steps is required if you're planning to share your project,
in other case you can add libraries from the Julia.app);
4. In the Build Phases add all the libraries to the Link Binary With
Libraries phase;
5. Add a Copy Files phase and add all the headers and libraries to
Resources destination (here destination can be different, also you could
use different copy phase for the headers and the libraries);
6. Initialize Julia with *jl_init_with_image("Your.app/contents/directory",
"path/to/sys-debug.dylib")*
суббота, 12 декабря 2015 г., 17:06:09 UTC+3 пользователь Ales Tsurko
написал:
>
> Looks like I've found it. I've added sys.dylib using *jl_init_with_image()
> (*that symbol was in the sys.dylib). And it looks like I have to add all
> the libraries from the Julia.app to my project. Also some of them searching
> in specific paths that can be changed using install_name_tool. I guess it
> should solve the problem. But I'm still not sure if I do it right.
>
> суббота, 12 декабря 2015 г., 15:50:57 UTC+3 пользователь Ales Tsurko
> написал:
>>
>> Thanks to this thread:
>> https://groups.google.com/forum/#!topic/julia-users/RFsP21thyBI I've
>> solved the problem regarding to sys.dylib.
>> If someone in the future would looking for the solution of the problem,
>> use *jl_init_with_image*(*<JULIA_HOME>*,*<PATH_TO_JULIA_IMAGE>*) (
>> https://groups.google.com/d/msg/julia-users/RFsP21thyBI/FenpD-tPAgAJ)
>>
>> But now I have the next problem:
>>
>> *ERROR: could not load symbol "jl_sysimg_cpu_target"*
>>
>> *dlsym(0x600000162580, jl_sysimg_cpu_target): symbol not found*
>>
>> Could someone explain or at least give me a direction how to solve this
>> problem? Sorry if it's a basic question, I have no much experience with
>> linking and using dylibs.
>>
>> вторник, 8 декабря 2015 г., 0:25:05 UTC+3 пользователь Ales Tsurko
>> написал:
>>>
>>> A huge thanks for the direction! It's helped me a lot with understanding
>>> of my problem! But now I can't find from where sys.dylib is calling. I've
>>> checked out the dependencies, but didn't found why the path is
>>> ../lib/julia/sys.dylib Also the path for sys.dylib is @rpath/sys.dylib,
>>> which is the same as for libjulia.dylib, but I've no problems with the
>>> libjulia only with sys.dylib... It's blowing my mind. Where did this come
>>> from?
>>>
>>> понедельник, 7 декабря 2015 г., 20:33:01 UTC+3 пользователь Isaiah
>>> написал:
>>>>
>>>> You can change the lookup path using `install_name_tool`. See e.g. [1]
>>>> and check other answers on StackOverflow.
>>>>
>>>> [1]
>>>> http://thecourtsofchaos.com/2013/09/16/how-to-copy-and-relink-binaries-on-osx/
>>>>
>>>> On Sun, Dec 6, 2015 at 9:05 AM, Ales Tsurko <[email protected]> wrote:
>>>>
>>>>> Hello there! I'm trying to embed Julia in Xcode project. And what I
>>>>> don't understand is how to link Julia without installing Julia.
>>>>> Currently I've done this steps:
>>>>>
>>>>>
>>>> 1. Copied /include/ and /lib/ directories from Julia.app to my Xcode's
>>>>> project directory. Also I've changed directory structure from /lib/julia/
>>>>> and /include/julia/ to just /lib/ and /include/, so in my project's
>>>>> directory it's in /julia/lib and /julia/include/ ;
>>>>> 2. Linked libjulia.dylib;
>>>>> 3. In the Build Settings added $(PROJECT_DIR)/julia/lib to Runpath
>>>>> Search Path;
>>>>> 4. Added copy files phase with julia.h to Build Phases.
>>>>>
>>>>> And I get this error:
>>>>>
>>>>> *ERROR: system image file
>>>>>> "/Users/alestsurko/Library/Developer/Xcode/DerivedData/AUJulia-cudsforcspcktlaicnqzwclmzbye/Build/Products/Debug/AUJulia.app/Contents/MacOS/../lib/julia/sys.dylib"
>>>>>>
>>>>>> not found*
>>>>>
>>>>>
>>>>> It looks like something search library as if it was in the Julia.app
>>>>> directory structure. But I don't know how to change it. Is it possible at
>>>>> all or installing Julia is the required step?
>>>>>
>>>>
>>>>