[julia-users] what path to set in jl_init

2015-01-31 Thread eric l

I am trying to compile and run embedding.c on a 10.9.5 OS X Mac.
Compile without a glitch 
but when I run the executable I get:

 ./embedd 

dyld: Library not loaded: @rpath/libjulia.dylib

  Referenced from: /Users/doe/./embedd

  Reason: image not found

Trace/BPT trap: 5

I have try with jl_init set to: NULL,  $JULIA_DIR/   $JULIA_DIR/bin 
 $JULIA_DIR/lib/julia

 (with $JULIA_DIR fully extended ;) 

and get the same error over and over...

So what path should I write in jl_init () or should I do something 
different? 

Thxs. 

PS: 

Julia Version 0.3.5

Commit a05f87b* (2015-01-08 22:33 UTC)

Platform Info:

  System: Darwin (x86_64-apple-darwin13.4.0)

  CPU: Intel(R) Core(TM) i7-4650U CPU @ 1.70GHz

  WORD_SIZE: 64

  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell)

  LAPACK: libopenblas

  LIBM: libopenlibm

  LLVM: libLLVM-3.3




Re: [julia-users] what path to set in jl_init

2015-01-31 Thread Jameson Nash
 you're executable seems to be compiled wrong and cannot be executed
(missing the @rpath attribute). try giving the
-Wl,-rpath,$JULIA_DIR/lib option
in your linker command where you passed `-ljulia`

On Sat Jan 31 2015 at 6:37:17 PM eric l cdg2...@gmail.com wrote:


 I am trying to compile and run embedding.c on a 10.9.5 OS X Mac.
 Compile without a glitch
 but when I run the executable I get:

  ./embedd

 dyld: Library not loaded: @rpath/libjulia.dylib

   Referenced from: /Users/doe/./embedd

   Reason: image not found

 Trace/BPT trap: 5

 I have try with jl_init set to: NULL,  $JULIA_DIR/   $JULIA_DIR/bin
  $JULIA_DIR/lib/julia

  (with $JULIA_DIR fully extended ;)

 and get the same error over and over...

 So what path should I write in jl_init () or should I do something
 different?

 Thxs.

 PS:

 Julia Version 0.3.5

 Commit a05f87b* (2015-01-08 22:33 UTC)

 Platform Info:

   System: Darwin (x86_64-apple-darwin13.4.0)

   CPU: Intel(R) Core(TM) i7-4650U CPU @ 1.70GHz

   WORD_SIZE: 64

   BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell)

   LAPACK: libopenblas

   LIBM: libopenlibm

   LLVM: libLLVM-3.3





Re: [julia-users] what path to set in jl_init

2015-01-31 Thread Jameson Nash
here’s what I get for debug info on embedding on 0.4-dev. since you are
still getting errors, you might want to check what you are getting, and
whether you’ve set JULIA_HOME correctly (it must point to the folder
containing the julia binary).

julia/usr/bin$ otool -l embedding  | grep -C4 RPATH
   time stamp 2 Wed Dec 31 19:00:02 1969
  current version 120.0.0
compatibility version 1.0.0
Load command 18
  cmd LC_RPATH
  cmdsize 48
 path @executable_path/../lib/julia (offset 12)
Load command 19
--
  cmdsize 48
 path @executable_path/../lib/julia (offset 12)
Load command 19
  cmd LC_RPATH
  cmdsize 40
 path @executable_path/../lib (offset 12)
Load command 20
  cmd LC_FUNCTION_STARTS
julia/usr/bin$ otool -L embedding
embedding:
@rpath/libjulia.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/lib/libffi.dylib (compatibility version 1.0.0, current version 1.0.0)
/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
version 1213.0.0)
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
(compatibility version 150.0.0, current version 1151.16.0)
/System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices
(compatibility version 1.0.0, current version 62.0.0)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.0.0)

On Sat Jan 31 2015 at 8:02:11 PM eric l cdg2...@gmail.com
http://mailto:cdg2...@gmail.com wrote:

Thx Jameson,

 By the way on OSX gcc default to this now:

 Apple LLVM version 6.0 (clang-600.0.51) (based on LLVM 3.5svn)

 Target: x86_64-apple-darwin13.4.0
 So I was able to make some progress:
 first I got:

 ./embedd

 System image file
 /Applications/Julia-0.3.5.app/Contents/Resources/julia/../lib/julia/sys.ji
 not found
 Which make sense as  the path should be julia/lib/julia/sys.ji
 So I simply created a dir  lib/julia/ under Resources/
 Then copied all the files in lib/julia into the new dir.

 I ran ./embedd again and got a long list of grievances and the expected
 output of embedding.c!
 All the unfounded lib are in the same directories as libjulia.dylib.
 Clearly something is not quite right with the compiler settings I am
 using...


 .embedd

 Warning: error initializing module LinAlg:

 ErrorException(error compiling __init__: error compiling check_blas:
 error compiling openblas_get_config: could not load module libopenblas:
 dlopen(libopenblas.dylib, 1): image not found)

 Entropy pool not available to seed RNG; using ad-hoc entropy sources.

 Warning: error initializing module Random:

 ErrorException(could not load module libdSFMT: dlopen(libdSFMT.dylib, 1):
 image not found)

 Warning: error initializing module GMP:

 ErrorException(error compiling __init__: could not load module libgmp:
 dlopen(libgmp.dylib, 1): image not found)

 Warning: error initializing module PCRE:

 ErrorException(ccall: could not find function pcre_jit_stack_alloc in
 library libpcre)

 sqrt(2.0) in C: 1.414214e+00

 sqrt(2.0) in C: 1.414214e+00

 x = [9.00e+00 8.00e+00 7.00e+00 6.00e+00 5.00e+00
 4.00e+00 3.00e+00 2.00e+00 1.00e+00 0.00e+00 ]

 my_func(5.0) = 10.00

 UndefVarError(:this_function_does_not_exist)




 On Saturday, January 31, 2015 at 4:18:59 PM UTC-8, Jameson wrote:

  you're executable seems to be compiled wrong and cannot be executed
 (missing the @rpath attribute). try giving the -Wl,-rpath,
 $JULIA_DIR/lib option in your linker command where you passed `-ljulia`



  ​


Re: [julia-users] what path to set in jl_init

2015-01-31 Thread Jeff Waller
Instead of jl_init, I use the following 


jl_init_with_image((char*)install_directory.c_str(),(char*)sys.ji);


where install_directory is the directory of libjulia (e.g. 
/usr/local/julia/lib/julia), but whatever corresponds to how you link using 
-Wl,rpath