Re: [julia-users] Re: Embedding Julia with C++

2015-07-14 Thread Kostas Tavlaridis-Gyparakis
Hello,
Sorry for the delay in my answer.



*Could you run /home/kostav/julia/contrib/julia-config.jl  --ldlibs and 
tell me what it returns?*It returns: -Wl,-rpath,/home/kostav/julia/usr/lib 
-ljulia

***Did you do a make install of Julia itself and are running out of that*
*installed directory or are you running out of where it compiled or 
possibly*
*simply copied the directories? That script assumes the former and I think*

*maybe you're doing the latter.*
I downloaded the source code in folder (home/julia) and run inside this 
file make 
and make install of Julia inside.

***/home/kostav/julia/bin/julia  /home/kostav/julia/contrib/*julia-config.jl 
 --ldlibs

I actually don't have any bin folder inside my julia folder, so I can't do 
any of
the suggested modifications.
What could I do different in this case?







On Monday, July 13, 2015 at 7:55:10 PM UTC+2, Jeff Waller wrote:




 


 On Monday, July 13, 2015 at 11:36:34 AM UTC-4, Kostas Tavlaridis-Gyparakis 
 wrote:

 Ok, my current Julia version (that I installed via running the source 
 code) is: 
 *Version 0.4.0-dev+5841 (2015-07-07 14:58 UTC)*So, what should I do 
 different so that -I flag gets the proper value?


 Could you run /home/kostav/julia/contrib/julia-config.jl  --ldlibs and 
 tell me what it returns?

 Did you do a make install of Julia itself and are running out of that
 installed directory or are you running out of where it compiled or possibly
 simply copied the directories? That script assumes the former and I think
 maybe you're doing the latter.

 If so you can still use it, but you have to specify which julia so 
 something like this

 /home/kostav/julia/bin/julia  /home/kostav/julia/contrib/julia-config.jl 
  --ldlibs

 is there any difference?  To get something working, cut-paste the output 
 to the
 semi-working step above

 to use in a Makefile modify to 

 $(shell /home/kostav/julia/bin/julia 
 /home/kostav/julia/contrib/julia-config.jl --cflags) 

 etc



Re: [julia-users] Re: Embedding Julia with C++

2015-07-14 Thread Kostas Tavlaridis-Gyparakis



*Related, what's in the directory /home/kostav/julia/usr/lib*When I run 
the following command: 

g++ -o test main.cpp -Wl,-rpath,/home/kostav/julia/usr/lib -I 
/home/kostav/julia/src -I /home/kostav/julia/usr/include -I 
/home/kostav/julia/src/support -L/home/kostav/julia/usr/lib -ljulia 
-lLLVM-3.7svn

And I also initialize julia inside c++ with the following command:

jl_init_with_image(/home/kostav/julia/usr/lib/julia, sys.so);

It does work properly finally!



*Where is it?  Use that instead.*It's located at 
/home/kostav/julia/usr/bin/julia

Yet again when I upgrade the makefile accordingly and it does look like 
this:

CFLAGS   += $(shell /home/kostav/julia/usr/bin/julia  
/home/kostav/julia/contrib/julia-config.jl --cflags)
CXXFLAGS += $(shell /home/kostav/julia/usr/bin/julia  
/home/kostav/julia/contrib/julia-config.jl --cflags)
LDFLAGS  += $(shell /home/kostav/julia/usr/bin/julia  
/home/kostav/julia/contrib/julia-config.jl --ldflags)
LDLIBS   += $(shell /home/kostav/julia/usr/bin/julia  
/home/kostav/julia/contrib/julia-config.jl --ldlibs)
all: embed_example

I do receive the following error:

cc -DJULIA_INIT_DIR=\/home/kostav/julia/usr/lib\ 
-I/home/kostav/julia/usr/include/julia  -L/home/kostav/julia/usr/lib  
embed_example.c  -Wl,-rpath,/home/kostav/julia/usr/lib -ljulia -o 
embed_example
embed_example.c:1:19: fatal error: julia.h: No such file or directory
 #include julia.h
   ^
compilation terminated.
builtin: recipe for target 'embed_example' failed
make: *** [embed_example] Error 1



Re: [julia-users] Re: Embedding Julia with C++

2015-07-14 Thread Jeff Waller


It returns: -Wl,-rpath,/home/kostav/julia/usr/lib -ljulia


Ok next test, what happens when you paste that into the almost working
step above (the one the works except for when you run it, it can't find 
libjulia?
make sure that -ljulia and -lLLVM3.7svn come after the -Wl,rpath directives

Related, what's in the directory /home/kostav/julia/usr/lib
 



 ***Did you do a make install of Julia itself and are running out of that*
 *installed directory or are you running out of where it compiled or 
 possibly*
 *simply copied the directories? That script assumes the former and I 
 think*

 *maybe you're doing the latter.*
 I downloaded the source code in folder (home/julia) and run inside this 
 file make 
 and make install of Julia inside.


This should result in a directory with a hex-number associated, didn't it?
 


 ***/home/kostav/julia/bin/julia  /home/kostav/julia/contrib/*julia-config.jl 
  --ldlibs

 I actually don't have any bin folder inside my julia folder, so I can't do 
 any of
 the suggested modifications.
 What could I do different in this case?


Where is it?  Use that instead.
 








 On Monday, July 13, 2015 at 7:55:10 PM UTC+2, Jeff Waller wrote:




  


 On Monday, July 13, 2015 at 11:36:34 AM UTC-4, Kostas 
 Tavlaridis-Gyparakis wrote:

 Ok, my current Julia version (that I installed via running the source 
 code) is: 
 *Version 0.4.0-dev+5841 (2015-07-07 14:58 UTC)*So, what should I do 
 different so that -I flag gets the proper value?


 Could you run /home/kostav/julia/contrib/julia-config.jl  --ldlibs and 
 tell me what it returns?

 Did you do a make install of Julia itself and are running out of that
 installed directory or are you running out of where it compiled or 
 possibly
 simply copied the directories? That script assumes the former and I think
 maybe you're doing the latter.

 If so you can still use it, but you have to specify which julia so 
 something like this

 /home/kostav/julia/bin/julia  /home/kostav/julia/contrib/julia-config.jl 
  --ldlibs

 is there any difference?  To get something working, cut-paste the output 
 to the
 semi-working step above

 to use in a Makefile modify to 

 $(shell /home/kostav/julia/bin/julia 
 /home/kostav/julia/contrib/julia-config.jl --cflags) 

 etc



Re: [julia-users] Re: Embedding Julia with C++

2015-07-14 Thread Scott Jones
Your path for includes doesn't have julia/src, which is where julia.h lives.

On Tuesday, July 14, 2015 at 7:13:27 AM UTC-4, Kostas Tavlaridis-Gyparakis 
wrote:




 *Related, what's in the directory /home/kostav/julia/usr/lib*When I run 
 the following command: 

 g++ -o test main.cpp -Wl,-rpath,/home/kostav/julia/usr/lib -I 
 /home/kostav/julia/src -I /home/kostav/julia/usr/include -I 
 /home/kostav/julia/src/support -L/home/kostav/julia/usr/lib -ljulia 
 -lLLVM-3.7svn

 And I also initialize julia inside c++ with the following command:

 jl_init_with_image(/home/kostav/julia/usr/lib/julia, sys.so);

 It does work properly finally!



 *Where is it?  Use that instead.*It's located at 
 /home/kostav/julia/usr/bin/julia

 Yet again when I upgrade the makefile accordingly and it does look like 
 this:

 CFLAGS   += $(shell /home/kostav/julia/usr/bin/julia  
 /home/kostav/julia/contrib/julia-config.jl --cflags)
 CXXFLAGS += $(shell /home/kostav/julia/usr/bin/julia  
 /home/kostav/julia/contrib/julia-config.jl --cflags)
 LDFLAGS  += $(shell /home/kostav/julia/usr/bin/julia  
 /home/kostav/julia/contrib/julia-config.jl --ldflags)
 LDLIBS   += $(shell /home/kostav/julia/usr/bin/julia  
 /home/kostav/julia/contrib/julia-config.jl --ldlibs)
 all: embed_example

 I do receive the following error:

 cc -DJULIA_INIT_DIR=\/home/kostav/julia/usr/lib\ 
 -I/home/kostav/julia/usr/include/julia  -L/home/kostav/julia/usr/lib  
 embed_example.c  -Wl,-rpath,/home/kostav/julia/usr/lib -ljulia -o 
 embed_example
 embed_example.c:1:19: fatal error: julia.h: No such file or directory
  #include julia.h
^
 compilation terminated.
 builtin: recipe for target 'embed_example' failed
 make: *** [embed_example] Error 1



Re: [julia-users] Re: Embedding Julia with C++

2015-07-14 Thread Jeff Waller


 Your path for includes doesn't have julia/src, which is where julia.h 
 lives.


This is in part true, but is not the whole story.  Yes it is true that 
julia.h is found
in src in the source directory tree, but the file julia.h as well as julia 
the executable,
libjulia, etc get copied into the installed directory structure when 
make install
is executed.  It's that structure that should be used (and optionally 
lifted/copied
out of the build and put somewhere else) and in that tree, the src 
directory does
not exist. Nor does it exist in any packaged version of Julia, so it would 
be
better to assume that structure as this whole approach can eventually be 
applied
to releases, nightly builds, etc.

I think what is going on is even though Kostas is performing a make 
install he's 
continuing to use the source directory structure instead of the installed
directory structure which is causing confusion -- for both julia-config and 
me.

 jl_init_with_image(/home/kostav/julia/usr/lib/julia, sys.so);

This is unfortunate if required, it should not be required.

It's good that something is working now, however, can we try one more thing

Perform make install again, and note the directory (it will be something 
like julia-)
where  is some hexadecimal number that all of this gets installed
to as described above, and copy that entire tree elsewhere (using cp -a), 
 you can change
the name if you want, it's not necessary to preserve the name of the 
directory.  Once that is done
change the PATH and/or use symbolic links if that's more convenient so that 
julia is
the julia in THAT directory not the one in the source tree.

Then revert back to the cut-and-paste Makefile version rather than this 
modified
version but keep the old one around somewhere just in case it does't work 
out
so you don't have to re-create it from scratch.  That way if this attempt 
ultimately
fails, you can as least have something going with what you have now by 
switching
PATH back to what it is now.


Re: [julia-users] Re: Embedding Julia with C++

2015-07-13 Thread Jeff Waller


 This is the problem, or part of it anyway. That file lives under 
 `julia/contrib` in a source build.


Hmm  this should be bundled into all 0.4, oh oh.


Re: [julia-users] Re: Embedding Julia with C++

2015-07-13 Thread Kostas Tavlaridis-Gyparakis
Any ideas on how to fix the compile error: julia.h: No such file or 
directory  #include julia.h compilation terminated.?


This is the problem, or part of it anyway. That file lives under 
 `julia/contrib` in a source build.


 Hmm  this should be bundled into all 0.4, oh oh.



Re: [julia-users] Re: Embedding Julia with C++

2015-07-13 Thread Isaiah Norton

 make: /home/kostav/julia/usr/bin/../share/julia/julia-config.jl: Command
 not found


This is the problem, or part of it anyway. That file lives under
`julia/contrib` in a source build.

The shell is your friend:
http://www.cyberciti.biz/faq/search-for-files-in-bash/

On Mon, Jul 13, 2015 at 6:46 AM, Kostas Tavlaridis-Gyparakis 
kostas.tavlari...@gmail.com wrote:

 Hello thanks a lot for your answer.
 You assumed correctly I do use version 0.4.
 If I got right your proposal about the linking error is to use
 the command jl_inti(JULIA_INIT_DIR) as shown in this
 http://julia.readthedocs.org/en/latest/manual/embedding/#example
 example and use a makefile where I just copy paste the
 commands shown in the example, so the makefile looks like that:

 JL_SHARE = $(shell julia -e
 'print(joinpath(JULIA_HOME,Base.DATAROOTDIR,julia))')
 CFLAGS   += $(shell $(JL_SHARE)/julia-config.jl --cflags)
 CXXFLAGS += $(shell $(JL_SHARE)/julia-config.jl --cflags)
 LDFLAGS  += $(shell $(JL_SHARE)/julia-config.jl --ldflags)
 LDLIBS   += $(shell $(JL_SHARE)/julia-config.jl --ldlibs)

 all: main


 and my source code looks like that:

 #include julia.h

 int main(int argc, char *argv[])
 {
 /* required: setup the julia context */
 jl_init(JULIA_INIT_DIR);

 /* run julia commands */
 jl_eval_string(print(sqrt(2.0)));

 /* strongly recommended: notify julia that the
  program is about to terminate. this allows
  julia time to cleanup pending write requests
  and run all finalizers
 */
 jl_atexit_hook();
 return 0;
 }

 Yet again when I try to compile I receive the following errors:

 make: /home/kostav/julia/usr/bin/../share/julia/julia-config.jl: Command
 not found
 make: /home/kostav/julia/usr/bin/../share/julia/julia-config.jl: Command
 not found
 make: /home/kostav/julia/usr/bin/../share/julia/julia-config.jl: Command
 not found
 cc main.c   -o main
 main.c:1:19: fatal error: julia.h: No such file or directory
  #include julia.h
^
 compilation terminated.
 builtin: recipe for target 'main' failed
 make: *** [main] Error 1


 Note that I have really no experience with makefiles so I can not really
 handle them
 properly, but I assumed that I should be working if I did all it was
 saying in the example.
 Yet again I receive the above errors.





 On Monday, July 13, 2015 at 9:30:33 AM UTC+2, Jeff Waller wrote:

 It's not clear to me which version you are using?  Depending on the
 version, It is referred
 to in the URL you linked...

 I'll just cut to the chase use 0.4 and julia_config.jl as described in
 the doc, create a
 Makefile just cut-and-paste the example, and augment with your source.
 All but
 one of your errors is a result of the wrong compile/link flags.

 The last error is that main() is either not being compiled or linked,
 that's just straight-up
 C programming, and has nothing to do with Julia.

 As far as eclipse goes, I'm confident it's possible, I can't imagine
 eclipse not supporting
 compilation using Makefiles, but even if it doesn't you can still
 automate things, but just
 get something working first and you can embellish later.

 TL;DR

 0.4,  julia_config, cut-paste Makefile, add your source, done




Re: [julia-users] Re: Embedding Julia with C++

2015-07-13 Thread Jeff Waller
Ok this is turning into kind of a debugging session, but 
/home/kostav/julia/contrib/julia-config.jl --cflags

just run it on the command line.  What's the output?

What version of 0.4?  Is it current as of a few days ago?  In the version 
I'm using
all is well. I will obtain/compile the latest


Re: [julia-users] Re: Embedding Julia with C++

2015-07-13 Thread Jeff Waller


 CFLAGS   += $(shell $/home/kostav/julia/contrib/julia-config.jl --cflags)


take out the 2nd $

CFLAGS   += $(shell /home/kostav/julia/contrib/julia-config.jl --cflags) 

what results?


Re: [julia-users] Re: Embedding Julia with C++

2015-07-13 Thread Kostas Tavlaridis-Gyparakis
Thanks a lot, that fixed this error, but now it returns me the same error 
that I get when I just run the compile command
in terminal:

fatal error: julia.h: No such file or directory  #include julia.h 
compilation terminated.

On Monday, July 13, 2015 at 4:34:24 PM UTC+2, Jeff Waller wrote:

 CFLAGS   += $(shell $/home/kostav/julia/contrib/julia-config.jl --cflags)


 take out the 2nd $

 CFLAGS   += $(shell /home/kostav/julia/contrib/julia-config.jl --cflags) 

 what results?



Re: [julia-users] Re: Embedding Julia with C++

2015-07-13 Thread Jeff Waller


On Monday, July 13, 2015 at 11:36:34 AM UTC-4, Kostas Tavlaridis-Gyparakis 
wrote:

 Ok, my current Julia version (that I installed via running the source 
 code) is: 
 *Version 0.4.0-dev+5841 (2015-07-07 14:58 UTC)*So, what should I do 
 different so that -I flag gets the proper value?


Could you run /home/kostav/julia/contrib/julia-config.jl  --ldlibs and tell 
me what it returns?

Did you do a make install of Julia itself and are running out of that
installed directory or are you running out of where it compiled or possibly
simply copied the directories? That script assumes the former and I think
maybe you're doing the latter.

If so you can still use it, but you have to specify which julia so 
something like this

/home/kostav/julia/bin/julia  /home/kostav/julia/contrib/julia-config.jl 
 --ldlibs

is there any difference?  To get something working, cut-paste the output to 
the
semi-working step above

to use in a Makefile modify to 

$(shell /home/kostav/julia/bin/julia 
/home/kostav/julia/contrib/julia-config.jl --cflags) 

etc


Re: [julia-users] Re: Embedding Julia with C++

2015-07-13 Thread Kostas Tavlaridis-Gyparakis
Ok, my current Julia version (that I installed via running the source code) 
is: 
*Version 0.4.0-dev+5841 (2015-07-07 14:58 UTC)*So, what should I do 
different so that -I flag gets the proper value?





On Monday, July 13, 2015 at 5:15:04 PM UTC+2, Jeff Waller wrote:



 On Monday, July 13, 2015 at 10:54:57 AM UTC-4, Kostas Tavlaridis-Gyparakis 
 wrote:

 Any ideas on how to fix the compile error: julia.h: No such file or 
 directory  #include julia.h compilation terminated.?


 Yea of course.  This is a result of the -I flag having the wrong value.  

 There was a space of time that this command (julia_config.jl) was not 
 working
 as a result of the new use of  sys.so instead of sys.ji, but that has 
 sense been fixed, so
 that's why I'm asking what version it was.  It would be working in the 
 newest version, but
 I am verifying that now.

 The cause of libjulia.so not found is the link step is missing -Wl,-rpath, 
 which julia_config gives you
 that's why I keep coming back to it.



Re: [julia-users] Re: Embedding Julia with C++

2015-07-13 Thread Jeff Waller


On Monday, July 13, 2015 at 10:54:57 AM UTC-4, Kostas Tavlaridis-Gyparakis 
wrote:

 Any ideas on how to fix the compile error: julia.h: No such file or 
 directory  #include julia.h compilation terminated.?


Yea of course.  This is a result of the -I flag having the wrong value.  

There was a space of time that this command (julia_config.jl) was not 
working
as a result of the new use of  sys.so instead of sys.ji, but that has sense 
been fixed, so
that's why I'm asking what version it was.  It would be working in the 
newest version, but
I am verifying that now.

The cause of libjulia.so not found is the link step is missing -Wl,-rpath, 
which julia_config gives you
that's why I keep coming back to it.


Re: [julia-users] Re: Embedding Julia with C++

2015-06-24 Thread Isaiah Norton
You probably need to call `jl_init(NULL)` at the beginning of the program.
If you have not done so yet, I would suggest to read the embedding
documentation:

http://docs.julialang.org/en/release-0.3/manual/embedding/

and start with the embedding example in the source:

https://github.com/JuliaLang/julia/blob/master/examples/embedding.c




On Wed, Jun 24, 2015 at 9:05 AM, Kostas Tavlaridis-Gyparakis 
kostas.tavlari...@gmail.com wrote:

 I did download the 0.4 nightbuilt which includes the above mentioned files
 in the proper location, but now Eclipse is throwing me a different
 error I can not sort out how to overcome. When I try to run a small cpp
 file with a few julia comands Eclipse is compiling the file but when I
 try to run it it throws me the following message:

 System image file
 /home/kostas/workspace/juli/Debug/../lib/x86_64-linux-gnu/julia/sys.ji
 not found 

 Futhermore since I am really new to Julia I am not sure and I don't know a
 lot of the existing tools, is it possible to write a function in julia
 that takes as an argument some data creates a model and solves it and call
 this function from inside my c++ project?
 I am asking this as in the example in the link
 http://docs.julialang.org/en/release-0.3/manual/calling-c-and-fortran-code/#passing-julia-callback-functions-to-c
 attached by Isaiah with the qsort, the whole process is done inside julia
 framework.
 Whereas in my case I would be interested to write a julia program, like
 the one described above that I would be able to call as a function
 (I want it to solve a subproblem actually) inside my c++ project in
 eclipse.
 Is this relatively easy to be done?
 Because I think this would be the best approach for my case.

 On Tuesday, June 23, 2015 at 8:20:56 AM UTC+2, Jeff Waller wrote:

 Embedded Julia is of particular interest to me. To answer your question,
 everything in Julia is available via embedded Julia.

 I would very much discourage use of version 0.3.2; avoid it if you can.
 I think that particular version has the uv.h problem which is fixed in
 later versions. Can you gain root on this host?  If so you can get 0.3.9
 via PPA.  Or even better if you can get ahold of one of the nightly builds,
 then 0.4.x comes with julia_config.jl, which figures out all of the right
 compile flags automatically.  You just have to cut and paste in a
 Makefile.  But if no makefile, you can run it and know the necessary
 compile time flags.




Re: [julia-users] Re: Embedding Julia with C++

2015-06-24 Thread Isaiah Norton
I guess this is still a distro path issue. The following suggestion is not
very general, but to at least get going, you could try:

jl_init(/home/kostas/workspace/juli/Debug/../lib/x86_64-linux-gnu/julia/)

On Wed, Jun 24, 2015 at 9:38 AM, Kostas Tavlaridis-Gyparakis 
kostas.tavlari...@gmail.com wrote:

 I am simply trying to run the first example attached in the embedding
 documantation which is the following block of code:

 #include iostream
 #include julia.h
 using namespace std;

 int main() {
   /* required: setup the julia context */
 jl_init(NULL);

 /* run julia commands */
 jl_eval_string(print(sqrt(2.0)));

 /* strongly recommended: notify julia that the
  program is about to terminate. this allows
  julia time to cleanup pending write requests
  and run all finalizers
 */
 jl_atexit_hook();

 return 0;
 }

 And when I try to run the program in eclipse (after having linked the
 library and defined the path of the header file) the above mentioned
 error message appeas which says:

 - System image file
 /home/kostas/workspace/juli/Debug/../lib/x86_64-linux-gnu/julia/sys.ji
 not found

 On Wednesday, June 24, 2015 at 3:31:50 PM UTC+2, Isaiah wrote:

 You probably need to call `jl_init(NULL)` at the beginning of the
 program. If you have not done so yet, I would suggest to read the embedding
 documentation:

 http://docs.julialang.org/en/release-0.3/manual/embedding/

 and start with the embedding example in the source:

 https://github.com/JuliaLang/julia/blob/master/examples/embedding.c




 On Wed, Jun 24, 2015 at 9:05 AM, Kostas Tavlaridis-Gyparakis 
 kostas.t...@gmail.com wrote:

 I did download the 0.4 nightbuilt which includes the above mentioned
 files in the proper location, but now Eclipse is throwing me a different
 error I can not sort out how to overcome. When I try to run a small cpp
 file with a few julia comands Eclipse is compiling the file but when I
 try to run it it throws me the following message:

 System image file
 /home/kostas/workspace/juli/Debug/../lib/x86_64-linux-gnu/julia/sys.ji
 not found 

 Futhermore since I am really new to Julia I am not sure and I don't know
 a lot of the existing tools, is it possible to write a function in julia
 that takes as an argument some data creates a model and solves it and
 call this function from inside my c++ project?
 I am asking this as in the example in the link
 http://docs.julialang.org/en/release-0.3/manual/calling-c-and-fortran-code/#passing-julia-callback-functions-to-c
 attached by Isaiah with the qsort, the whole process is done inside julia
 framework.
 Whereas in my case I would be interested to write a julia program, like
 the one described above that I would be able to call as a function
 (I want it to solve a subproblem actually) inside my c++ project in
 eclipse.
 Is this relatively easy to be done?
 Because I think this would be the best approach for my case.

 On Tuesday, June 23, 2015 at 8:20:56 AM UTC+2, Jeff Waller wrote:

 Embedded Julia is of particular interest to me. To answer your
 question, everything in Julia is available via embedded Julia.

 I would very much discourage use of version 0.3.2; avoid it if you
 can.  I think that particular version has the uv.h problem which is fixed
 in later versions. Can you gain root on this host?  If so you can get 0.3.9
 via PPA.  Or even better if you can get ahold of one of the nightly builds,
 then 0.4.x comes with julia_config.jl, which figures out all of the right
 compile flags automatically.  You just have to cut and paste in a
 Makefile.  But if no makefile, you can run it and know the necessary
 compile time flags.





Re: [julia-users] Re: Embedding Julia with C++

2015-06-24 Thread Kostas Tavlaridis-Gyparakis
Didn't manage to make the code run. I am really wondering what I am missing 
here...

On Wednesday, June 24, 2015 at 3:59:47 PM UTC+2, Isaiah wrote:

 I guess this is still a distro path issue. The following suggestion is not 
 very general, but to at least get going, you could try:

 jl_init(/home/kostas/workspace/juli/Debug/../lib/x86_64-linux-gnu/
 julia/)

 On Wed, Jun 24, 2015 at 9:38 AM, Kostas Tavlaridis-Gyparakis 
 kostas.t...@gmail.com javascript: wrote:

 I am simply trying to run the first example attached in the embedding 
 documantation which is the following block of code:

 #include iostream
 #include julia.h
 using namespace std;

 int main() {
   /* required: setup the julia context */
 jl_init(NULL);

 /* run julia commands */
 jl_eval_string(print(sqrt(2.0)));

 /* strongly recommended: notify julia that the
  program is about to terminate. this allows
  julia time to cleanup pending write requests
  and run all finalizers
 */
 jl_atexit_hook();

 return 0;
 }

 And when I try to run the program in eclipse (after having linked the 
 library and defined the path of the header file) the above mentioned
 error message appeas which says:

 - System image file 
 /home/kostas/workspace/juli/Debug/../lib/x86_64-linux-gnu/julia/sys.ji 
 not found 

 On Wednesday, June 24, 2015 at 3:31:50 PM UTC+2, Isaiah wrote:

 You probably need to call `jl_init(NULL)` at the beginning of the 
 program. If you have not done so yet, I would suggest to read the embedding 
 documentation:

 http://docs.julialang.org/en/release-0.3/manual/embedding/

 and start with the embedding example in the source:

 https://github.com/JuliaLang/julia/blob/master/examples/embedding.c




 On Wed, Jun 24, 2015 at 9:05 AM, Kostas Tavlaridis-Gyparakis 
 kostas.t...@gmail.com wrote:

 I did download the 0.4 nightbuilt which includes the above mentioned 
 files in the proper location, but now Eclipse is throwing me a different
 error I can not sort out how to overcome. When I try to run a small cpp 
 file with a few julia comands Eclipse is compiling the file but when I
 try to run it it throws me the following message:

 System image file 
 /home/kostas/workspace/juli/Debug/../lib/x86_64-linux-gnu/julia/sys.ji 
 not found 

 Futhermore since I am really new to Julia I am not sure and I don't 
 know a lot of the existing tools, is it possible to write a function in 
 julia
 that takes as an argument some data creates a model and solves it and 
 call this function from inside my c++ project?
 I am asking this as in the example in the link 
 http://docs.julialang.org/en/release-0.3/manual/calling-c-and-fortran-code/#passing-julia-callback-functions-to-c
  
 attached by Isaiah with the qsort, the whole process is done inside julia 
 framework.
 Whereas in my case I would be interested to write a julia program, like 
 the one described above that I would be able to call as a function 
 (I want it to solve a subproblem actually) inside my c++ project in 
 eclipse.
 Is this relatively easy to be done?
 Because I think this would be the best approach for my case.

 On Tuesday, June 23, 2015 at 8:20:56 AM UTC+2, Jeff Waller wrote:

 Embedded Julia is of particular interest to me. To answer your 
 question, everything in Julia is available via embedded Julia.

 I would very much discourage use of version 0.3.2; avoid it if you 
 can.  I think that particular version has the uv.h problem which is fixed 
 in later versions. Can you gain root on this host?  If so you can get 
 0.3.9 
 via PPA.  Or even better if you can get ahold of one of the nightly 
 builds, 
 then 0.4.x comes with julia_config.jl, which figures out all of the right 
 compile flags automatically.  You just have to cut and paste in a 
 Makefile.  But if no makefile, you can run it and know the necessary 
 compile time flags.





Re: [julia-users] Re: Embedding Julia with C++

2015-06-24 Thread Kostas Tavlaridis-Gyparakis
I am simply trying to run the first example attached in the embedding 
documantation which is the following block of code:

#include iostream
#include julia.h
using namespace std;

int main() {
  /* required: setup the julia context */
jl_init(NULL);

/* run julia commands */
jl_eval_string(print(sqrt(2.0)));

/* strongly recommended: notify julia that the
 program is about to terminate. this allows
 julia time to cleanup pending write requests
 and run all finalizers
*/
jl_atexit_hook();

return 0;
}

And when I try to run the program in eclipse (after having linked the 
library and defined the path of the header file) the above mentioned
error message appeas which says:

- System image file 
/home/kostas/workspace/juli/Debug/../lib/x86_64-linux-gnu/julia/sys.ji 
not found 

On Wednesday, June 24, 2015 at 3:31:50 PM UTC+2, Isaiah wrote:

 You probably need to call `jl_init(NULL)` at the beginning of the program. 
 If you have not done so yet, I would suggest to read the embedding 
 documentation:

 http://docs.julialang.org/en/release-0.3/manual/embedding/

 and start with the embedding example in the source:

 https://github.com/JuliaLang/julia/blob/master/examples/embedding.c




 On Wed, Jun 24, 2015 at 9:05 AM, Kostas Tavlaridis-Gyparakis 
 kostas.t...@gmail.com javascript: wrote:

 I did download the 0.4 nightbuilt which includes the above mentioned 
 files in the proper location, but now Eclipse is throwing me a different
 error I can not sort out how to overcome. When I try to run a small cpp 
 file with a few julia comands Eclipse is compiling the file but when I
 try to run it it throws me the following message:

 System image file 
 /home/kostas/workspace/juli/Debug/../lib/x86_64-linux-gnu/julia/sys.ji 
 not found 

 Futhermore since I am really new to Julia I am not sure and I don't know 
 a lot of the existing tools, is it possible to write a function in julia
 that takes as an argument some data creates a model and solves it and 
 call this function from inside my c++ project?
 I am asking this as in the example in the link 
 http://docs.julialang.org/en/release-0.3/manual/calling-c-and-fortran-code/#passing-julia-callback-functions-to-c
  
 attached by Isaiah with the qsort, the whole process is done inside julia 
 framework.
 Whereas in my case I would be interested to write a julia program, like 
 the one described above that I would be able to call as a function 
 (I want it to solve a subproblem actually) inside my c++ project in 
 eclipse.
 Is this relatively easy to be done?
 Because I think this would be the best approach for my case.

 On Tuesday, June 23, 2015 at 8:20:56 AM UTC+2, Jeff Waller wrote:

 Embedded Julia is of particular interest to me. To answer your question, 
 everything in Julia is available via embedded Julia.

 I would very much discourage use of version 0.3.2; avoid it if you can.  
 I think that particular version has the uv.h problem which is fixed in 
 later versions. Can you gain root on this host?  If so you can get 0.3.9 
 via PPA.  Or even better if you can get ahold of one of the nightly builds, 
 then 0.4.x comes with julia_config.jl, which figures out all of the right 
 compile flags automatically.  You just have to cut and paste in a 
 Makefile.  But if no makefile, you can run it and know the necessary 
 compile time flags.