[julia-users] Re: Errors while trying to use cxx and embed Julia together

2015-08-01 Thread Tero Frondelius
I don't know if this helps, but we have been also learning the basics of 
Cxx. See here @ovainola implementation of a simple library:
https://github.com/JuliaFEM/MiniBall.jl/blob/master/src/MiniBall.jl

On Saturday, August 1, 2015 at 5:00:41 PM UTC+3, Kostas 
Tavlaridis-Gyparakis wrote:
>
> Hello again,
> I am experiencing the following difficulty.
> So I have the above mentioned header and cpp files that define
> the class ArrayMaker  on top of that I wrote a small main connected
> to this class that simply excecute its function:
>
> main.cpp:
>
> #include "ArrayMaker.h"
> #include 
> using namespace std;
>
> int main(int argc, char ** argv) {
> ArrayMaker* FI_CSP=new ArrayMaker();
> int a = 7;
> float b = 4;
> double z;
> z = FI_CSP->ArrayMak(a,b);
> cout< return 1;
> }
>
> Now I created for Arraymaker.cpp, Arraymaker.h and main.cpp a shared 
> library
> so that I can link it with a julia file.
> So on this point I do have a very noob question, but I couldn't work it 
> out from 
> the examples of cxx in its webpage. Say I have done the connection with the
> shared library properly inside a julia file to link with the above class 
> and main.
> That looks as the previous one like this:
>
> using Cxx
> # Importing shared library and header file
> const path_to_lib = "/home/kostav/Documents/Project/julia/cle" 
> addHeaderDir(path_to_lib, kind=C_System)
> Libdl.dlopen(path_to_lib * "/test.so", Libdl.RTLD_GLOBAL)
> cxxinclude("ArrayMaker.h")
>
> So my really noob question is how is the proper syntaxis so that in this
> julia file I can call and run the above mentioned main.cpp file?
>


[julia-users] Re: Errors while trying to use cxx and embed Julia together

2015-08-01 Thread Kostas Tavlaridis-Gyparakis
Hello again,
I am experiencing the following difficulty.
So I have the above mentioned header and cpp files that define
the class ArrayMaker  on top of that I wrote a small main connected
to this class that simply excecute its function:

main.cpp:

#include "ArrayMaker.h"
#include 
using namespace std;

int main(int argc, char ** argv) {
ArrayMaker* FI_CSP=new ArrayMaker();
int a = 7;
float b = 4;
double z;
z = FI_CSP->ArrayMak(a,b);
cout<

[julia-users] Re: Errors while trying to use cxx and embed Julia together

2015-07-31 Thread Kostas Tavlaridis-Gyparakis
Ok, this did solve my problem.
Now I will proceed with trying to connect a big c++ project with julia and
see what happens there, in the very optimistic case where I proceed without
any problems I will let you know just for reference, otherwise I will 
return with
the new errors and mistakes I receive.
Thanks a lot for all the help and suggestions so far!

On Thursday, July 30, 2015 at 11:47:27 PM UTC+2, Jeff Waller wrote:
>
>
> Specifically I think this will not work because of the following: 
>  
>
>> double ArrayMaker::ArrayMak(int iNum, float fNum) {
>>
>> jl_init(JULIA_INIT_DIR);
>>
>>
>> jl_atexit_hook();
>> return sol;
>> }
>> }
>>
>>
> What this is doing it starting up a 2nd julia engine inside of the 
> original julia engine, and that can only work if julia has
> no globals that must only be initialized once and all mutual exclusive 
> sections protected by mutex, (i.e. thread safe),
> and currently it is not. 
>
> In other words you're going beyond the question can Julia be embedded in 
> C++ as well as can C++ be embedded
> in Julia simultaneously; answer is yes.  You're asking can Julia be 
> embedded within itself, and I think the answer is
> no.
>
> But from what you're describing as the problem you're attempting to 
>  solve, you don't really to accomplish Julia inside
> Julia. You just need to call C++ from Julia.
>
> What happens if you just simply leave out the calls to jl_init and 
> jl_atexit_hook?
>
>

[julia-users] Re: Errors while trying to use cxx and embed Julia together

2015-07-30 Thread Jeff Waller

Specifically I think this will not work because of the following: 
 

> double ArrayMaker::ArrayMak(int iNum, float fNum) {
>
> jl_init(JULIA_INIT_DIR);
>
>
> jl_atexit_hook();
> return sol;
> }
> }
>
>
What this is doing it starting up a 2nd julia engine inside of the original 
julia engine, and that can only work if julia has
no globals that must only be initialized once and all mutual exclusive 
sections protected by mutex, (i.e. thread safe),
and currently it is not. 

In other words you're going beyond the question can Julia be embedded in 
C++ as well as can C++ be embedded
in Julia simultaneously; answer is yes.  You're asking can Julia be 
embedded within itself, and I think the answer is
no.

But from what you're describing as the problem you're attempting to  solve, 
you don't really to accomplish Julia inside
Julia. You just need to call C++ from Julia.

What happens if you just simply leave out the calls to jl_init and 
jl_atexit_hook?



[julia-users] Re: Errors while trying to use cxx and embed Julia together

2015-07-30 Thread Kostas Tavlaridis-Gyparakis
Hello again,
After following the above mentioned instructions of Jeff managed to make 
Cxx working properly in the julia version
installed via (make install), yet again the original problem persists.
Just to remind you:

I have the following c++ class:

1) cpp.file:
#include "ArrayMaker.h"
#include 

using namespace std;


ArrayMaker::ArrayMaker() {
// TODO Auto-generated constructor stub

}

ArrayMaker::~ArrayMaker() {
// TODO Auto-generated destructor stub
}


double ArrayMaker::ArrayMak(int iNum, float fNum) {

jl_init(JULIA_INIT_DIR);

   jl_load("/home/kostav/.julia/v0.4/loleee/src/loleee.jl");
   jl_value_t * mod = (jl_value_t*)jl_eval_string("loleee");
   jl_function_t * func = 
jl_get_function((jl_module_t*)mod,"funior");


jl_value_t * argument = jl_box_float64(2.0);
jl_value_t * argument2 = jl_box_float64(3.0);
jl_value_t * ret = jl_call2(func, argument, argument2);

sol =  jl_unbox_float64(ret);

jl_atexit_hook();
return sol;
}
}

2) header file:
#ifndef ARRAYMAKER_H
#define ARRAYMAKER_H

#include 

class ArrayMaker
{
public:
ArrayMaker();
virtual ~ArrayMaker();
double ArrayMak(int, float);
};
#endif

Which are called isnide this small julia file:

using Cxx

# Importing shared library and header file
const path_to_lib = "/home/kostav/Documents/Project/julia/cle"   
  
addHeaderDir(path_to_lib, kind=C_System)
Libdl.dlopen(path_to_lib * "/test.so", Libdl.RTLD_GLOBAL)

cxxinclude("ArrayMaker.h")
maker = @cxxnew ArrayMaker()

a = @cxx maker->ArrayMak(5, 2.0)
 println("return value is: ", a)


As described above what I am trying is to call the c++ function ArrayMak 
from julia file,
where inside this function I call an other julia function (called name 
"funior") that just receives
two numbers as arguments and returns their sum.
More or less want to verify that I can have the following process:
Julia file -> Calling C++ classes -> calling inside them other julia 
functions -> returning arguments from the C++ classes to the original julia 
file.
So when I run the julia file everything works until the moment that the c++ 
function needs to return the argument to julia file, I have checked
and confirmed that until that point everything works proprely:
1) C++ function ArrayMak is called
2) Function funior is receiving the arguments properly and returns to the 
variable sol the sum of the two arguments
But when the value of sol needs to be returned to the julia function 
everythins stucks.
Judging from the example in the cxx web-site in order to return arguments 
from c++ functions to julia you don't need to do anything complicated
or different from what is shown here:


arr = @cxx maker->fillArr() (where fillArr is supposed to return an array)

So, I am not sure what is going wrong here...




On Wednesday, July 22, 2015 at 9:33:00 AM UTC+2, Kostas 
Tavlaridis-Gyparakis wrote:
>
> Any help/further suggestions please?
>
> On Tuesday, July 21, 2015 at 3:27:10 PM UTC+2, Kostas Tavlaridis-Gyparakis 
> wrote:
>>
>> Hello again,
>> Unfortunately and let me apologize in advance I still find myself 
>> confused on how to make things 
>> work properly.
>>
>>> Here are the symbolic links.  I believe with some simple changes to Cxx, 
>>> the need for these
>>> will disappear, but for now there's where it searches.
>>>
>>> /usr/local/julia/lib
>>>
>>> bizarro% ls -l
>>>
>>> total 16
>>>
>>> drwxr-xr-x   4 jeffw  staff   136 Jul 18 18:26 clang
>>>
>>> lrwxr-xr-x   1 root   staff10 Jul 19 03:16 include -> ../include
>>>
>>> drwxr-xr-x  49 jeffw  staff  1666 Jul 18 20:11 julia
>>>
>>> lrwxr-xr-x   1 root   staff 1 Jul 19 03:16 lib -> .
>>>
>>
>> If I get this right does it mean that for all the files that are included 
>> in the list "  * DirectoryLayout* 
>> 
>> "
>> I need to create a soft link to link them with the directory 
>> "/usr/local/julia/lib" (which doesn't exist
>> in my system)?
>> Aslo regarding the instructions of part "*BuildJuliaLLVMforCXX* 
>> "
>>  
>> where you present the files that
>> need to be cp to the directory julia-f428392003 in my system I face the 
>> following problems:
>>
>> 1) The image files (sys.ji, sys.dylib,sys-debug.dylib) don't exist 
>> anywhere in my system
>> 2) The folder llvm-svn (in the source julia directory) has completely 
>> different structure in my system,
>> In my julia (source code) folder there are two folders with the name 
>> llvm-svn the one has a structure
>> that you can look in the attach picture called name (llvmsn), while the 
>> second one is located in the
>> path "/home/kostav/julia/usr-staging/llvm-svn" and has a single folder 
>> named "build_Release+Asserts".
>>
>> All in all I am confused on how to follow your instructions (for which I 
>> do really appreciate the effort you
>> put to prov

[julia-users] Re: Errors while trying to use cxx and embed Julia together

2015-07-22 Thread Kostas Tavlaridis-Gyparakis
Any help/further suggestions please?

On Tuesday, July 21, 2015 at 3:27:10 PM UTC+2, Kostas Tavlaridis-Gyparakis 
wrote:
>
> Hello again,
> Unfortunately and let me apologize in advance I still find myself confused 
> on how to make things 
> work properly.
>
>> Here are the symbolic links.  I believe with some simple changes to Cxx, 
>> the need for these
>> will disappear, but for now there's where it searches.
>>
>> /usr/local/julia/lib
>>
>> bizarro% ls -l
>>
>> total 16
>>
>> drwxr-xr-x   4 jeffw  staff   136 Jul 18 18:26 clang
>>
>> lrwxr-xr-x   1 root   staff10 Jul 19 03:16 include -> ../include
>>
>> drwxr-xr-x  49 jeffw  staff  1666 Jul 18 20:11 julia
>>
>> lrwxr-xr-x   1 root   staff 1 Jul 19 03:16 lib -> .
>>
>
> If I get this right does it mean that for all the files that are included 
> in the list "  * DirectoryLayout* 
> 
> "
> I need to create a soft link to link them with the directory 
> "/usr/local/julia/lib" (which doesn't exist
> in my system)?
> Aslo regarding the instructions of part "*BuildJuliaLLVMforCXX* 
> "
>  
> where you present the files that
> need to be cp to the directory julia-f428392003 in my system I face the 
> following problems:
>
> 1) The image files (sys.ji, sys.dylib,sys-debug.dylib) don't exist 
> anywhere in my system
> 2) The folder llvm-svn (in the source julia directory) has completely 
> different structure in my system,
> In my julia (source code) folder there are two folders with the name 
> llvm-svn the one has a structure
> that you can look in the attach picture called name (llvmsn), while the 
> second one is located in the
> path "/home/kostav/julia/usr-staging/llvm-svn" and has a single folder 
> named "build_Release+Asserts".
>
> All in all I am confused on how to follow your instructions (for which I 
> do really appreciate the effort you
> put to provide me with). Is what I have to do:
>
> 1) Try to copy paste the folders as presented in "*BuildJuliaLLVMforCXX* 
> 
> "?
> 2) Create links for all the files listed * "DirectoryLayout" * 
> towards
>  
> the folder "/usr/local/julia/lib"?
>
>
> On Sunday, July 19, 2015 at 10:44:07 PM UTC+2, Jeff Waller wrote:
>>
>>
>>> Symbolic links to link which files though?
>>> Sorry if the questions I raise are already answered by the git, I just 
>>> failed to understand it properly so that's
>>> why I come back with these questions now.
>>>  
>>>
>>
>> I've added a listing of the entire directory structure 
>> 
>>  
>>
>> Here are the symbolic links.  I believe with some simple changes to Cxx, 
>> the need for these
>> will disappear, but for now there's where it searches.
>>
>> /usr/local/julia/lib
>>
>> bizarro% ls -l
>>
>> total 16
>>
>> drwxr-xr-x   4 jeffw  staff   136 Jul 18 18:26 clang
>>
>> lrwxr-xr-x   1 root   staff10 Jul 19 03:16 include -> ../include
>>
>> drwxr-xr-x  49 jeffw  staff  1666 Jul 18 20:11 julia
>>
>> lrwxr-xr-x   1 root   staff 1 Jul 19 03:16 lib -> .
>>
>

[julia-users] Re: Errors while trying to use cxx and embed Julia together

2015-07-21 Thread Kostas Tavlaridis-Gyparakis
Hello again,
Unfortunately and let me apologize in advance I still find myself confused 
on how to make things 
work properly.

> Here are the symbolic links.  I believe with some simple changes to Cxx, 
> the need for these
> will disappear, but for now there's where it searches.
>
> /usr/local/julia/lib
>
> bizarro% ls -l
>
> total 16
>
> drwxr-xr-x   4 jeffw  staff   136 Jul 18 18:26 clang
>
> lrwxr-xr-x   1 root   staff10 Jul 19 03:16 include -> ../include
>
> drwxr-xr-x  49 jeffw  staff  1666 Jul 18 20:11 julia
>
> lrwxr-xr-x   1 root   staff 1 Jul 19 03:16 lib -> .
>

If I get this right does it mean that for all the files that are included 
in the list "  * DirectoryLayout* 
"
I need to create a soft link to link them with the directory 
"/usr/local/julia/lib" (which doesn't exist
in my system)?
Aslo regarding the instructions of part "*BuildJuliaLLVMforCXX* 
"
 
where you present the files that
need to be cp to the directory julia-f428392003 in my system I face the 
following problems:

1) The image files (sys.ji, sys.dylib,sys-debug.dylib) don't exist anywhere 
in my system
2) The folder llvm-svn (in the source julia directory) has completely 
different structure in my system,
In my julia (source code) folder there are two folders with the name 
llvm-svn the one has a structure
that you can look in the attach picture called name (llvmsn), while the 
second one is located in the
path "/home/kostav/julia/usr-staging/llvm-svn" and has a single folder 
named "build_Release+Asserts".

All in all I am confused on how to follow your instructions (for which I do 
really appreciate the effort you
put to provide me with). Is what I have to do:

1) Try to copy paste the folders as presented in "*BuildJuliaLLVMforCXX* 

"?
2) Create links for all the files listed * "DirectoryLayout" * 
towards
 
the folder "/usr/local/julia/lib"?


On Sunday, July 19, 2015 at 10:44:07 PM UTC+2, Jeff Waller wrote:
>
>
>> Symbolic links to link which files though?
>> Sorry if the questions I raise are already answered by the git, I just 
>> failed to understand it properly so that's
>> why I come back with these questions now.
>>  
>>
>
> I've added a listing of the entire directory structure 
> 
>  
>
> Here are the symbolic links.  I believe with some simple changes to Cxx, 
> the need for these
> will disappear, but for now there's where it searches.
>
> /usr/local/julia/lib
>
> bizarro% ls -l
>
> total 16
>
> drwxr-xr-x   4 jeffw  staff   136 Jul 18 18:26 clang
>
> lrwxr-xr-x   1 root   staff10 Jul 19 03:16 include -> ../include
>
> drwxr-xr-x  49 jeffw  staff  1666 Jul 18 20:11 julia
>
> lrwxr-xr-x   1 root   staff 1 Jul 19 03:16 lib -> .
>


[julia-users] Re: Errors while trying to use cxx and embed Julia together

2015-07-19 Thread Jeff Waller

>
>
> Symbolic links to link which files though?
> Sorry if the questions I raise are already answered by the git, I just 
> failed to understand it properly so that's
> why I come back with these questions now.
>  
>

I've added a listing of the entire directory structure 
 

Here are the symbolic links.  I believe with some simple changes to Cxx, 
the need for these
will disappear, but for now there's where it searches.

/usr/local/julia/lib

bizarro% ls -l

total 16

drwxr-xr-x   4 jeffw  staff   136 Jul 18 18:26 clang

lrwxr-xr-x   1 root   staff10 Jul 19 03:16 include -> ../include

drwxr-xr-x  49 jeffw  staff  1666 Jul 18 20:11 julia

lrwxr-xr-x   1 root   staff 1 Jul 19 03:16 lib -> .


[julia-users] Re: Errors while trying to use cxx and embed Julia together

2015-07-19 Thread Kostas Tavlaridis-Gyparakis
Hello,
Once again I really appreciate all the effort you put and the help you 
provide.
I assume that since you made things work properly now we do havea working
solution.
Yet again as I am not really good with programming in general sth things I 
still
unfortunately need to ask on how to follow your directions.
So,


Step 1.  Build and run make install
> Step 2.  While still in the top level source directory, install Cxx as per 
> the Cxx webpage
> Step 3.  Take the installed directory structure and put it in an installed 
> location.
>

These three steps I have already done, I have compiled the source code and 
installed Cxx
accordingly for the source code and I also have copied the installed 
directory (the one with the big 
number that is created after make install) in a seperate file from which I 
run julia.

Step 4.  There are additional include files that Cxx needs access to after 
> it has built whenever c++ source needs to be compiled, 
> they can be found in the following directories relative to the source tree 
> root.
>
> usr/include/{clang,llvm,llvm-c}
> usr/lib/clang/
>
> Cxx attempts to access the files in these directories when it gets 
> imported, and although addIncludeDir is supposed to help here, 
> I could not make it work like that, so i ended up copying all of this to 
> the installed directory (see the gist).
>

Here I am a bit confused what to do. I did cp the abve mentioned 
directories:

cp -a /usr/lib/clang /home/kostav/Julian/julia-f428392003/lib
cp -a /usr/include/{clang,llvm-3.6,llvm-c-3.6} 
/home/kostav/Julian/julia-f428392003/include

But then in the gist I see you do cp a bunch of other files which I am not 
sure I do have them all anyway.
Does this mean that instead of copying the above mentioned directories I 
included I need to copy the spe-
cific files you point out in the first session of the git ( i.e. 
*BuildJuliaLLVMforCXX* 

)?

Step 5.  In addition for embedding the relative paths are off, so a couple of 
symbolic links need to be added.
>
>
Symbolic links to link which files though?
Sorry if the questions I raise are already answered by the git, I just 
failed to understand it properly so that's
why I come back with these questions now.
 

  )
 



[julia-users] Re: Errors while trying to use cxx and embed Julia together

2015-07-19 Thread Jeff Waller
So I built and installed Cxx and then attempted to use it with embedded 
Julia and was successful.  The tricky part is pretty tricky especially for
someone not familiar how the whole thing is laid out,  I've put most of 
what I did in this gist 


Step 1.  Build and run make install
Step 2.  While still in the top level source directory, install Cxx as per 
the Cxx webpage
Step 3.  Take the installed directory structure and put it in an installed 
location.
Step 4.  There are additional include files that Cxx needs access to after 
it has built whenever c++ source needs to be compiled, they can be found
in the following directories relative to the source tree root.

usr/include/{clang,llvm,llvm-c}

usr/lib/clang/

Cxx attempts to access the files in these directories when it gets imported, 
and although addIncludeDir is supposed to help here, I could not make it work 
like that, so i ended up copying all of this to the installed directory (see 
the gist).

Step 5.  In addition for embedding the relative paths are off, so a couple of 
symbolic links need to be added.

Step 6 access Cxx from embedding framework and I have some show and tell here 
for that

Consider the following file (index.js) this is taken from the Cxx example page, 
I simplified
it to merely good ol' hello world


var julia = require('node-julia');
 
julia.eval('using Cxx');
julia.eval('cxx""" #include """');
julia.eval('cxx""" void mycppfunction() { std::cout << "hello world" << 
std::endl; } """');
julia.eval('julia_function() = @cxx mycppfunction()');
 
 
julia.exec('julia_function');


and when run:

bizarro% node index.js 

hello world
So that's JITed-C++ within JITed-Julia within JITed-Javascript, which I 
think is a first.
It's pretty slow because of all of the compiling going on, and there's a 
bunch of eval
where there could be something else, but I think pre-compilation will fix 
that.

Pretty exciting.




Re: [julia-users] Re: Errors while trying to use cxx and embed Julia together

2015-07-18 Thread Isaiah Norton
You are still picking up the f42... version.
On Jul 18, 2015 6:41 PM, "Kostas Tavlaridis-Gyparakis" <
kostas.tavlari...@gmail.com> wrote:

> So, in case it will be of any help to you here is the exact message I
> receive:
>
> julia> Pkg.build("Cxx")
> INFO: Building Cxx
> Tuning for julia installation at: /home/kostav/Julian/julia-f428392003/bin
> BuildBootstrap.Makefile:2:
> /home/kostav/Julian/julia-f428392003/bin/../../deps/Versions.make: No such
> file or directory
> BuildBootstrap.Makefile:3:
> /home/kostav/Julian/julia-f428392003/bin/../../Make.inc: No such file or
> directory
> make: *** No rule to make target
> '/home/kostav/Julian/julia-f428392003/bin/../../Make.inc'.  Stop.
> =[ ERROR: Cxx
> ]=
>
> LoadError: failed process: Process(`make -f BuildBootstrap.Makefile
> JULIA_HOME=/home/kostav/Julian/julia-f428392003/bin`, ProcessExited(2)) [2]
> while loading /home/kostav/.julia/v0.4/Cxx/deps/build.jl, in expression
> starting on line 16
>
>
> 
>
> [ BUILD ERRORS
> ]
>
> WARNING: Cxx had build errors.
>
>  - packages with build errors remain installed in /home/kostav/.julia/v0.4
>  - build the package(s) and all dependencies with `Pkg.build("Cxx")`
>  - build a single package by running its `deps/build.jl` script
>
>
> 
>
>
> On Saturday, July 18, 2015 at 11:35:32 PM UTC+2, Jeff Waller wrote:
>>
>>
>>
>> On Saturday, July 18, 2015 at 5:24:33 AM UTC-4, Kostas
>> Tavlaridis-Gyparakis wrote:
>>>
>>> Hello again and thanks a lot for the suggestions.
>>> Thing is, I went back to the source version of Julia where Cxx is
>>> already built and
>>> runs properly, so there wasn't much for me to do, I run in terminal also
>>> the command of:
>>>
>>> "addHeaderDir("/home/kostav/julia/src/")"
>>>
>>> Then proceeded again with make install and run the version of julia from
>>> this folder but
>>> still not being able to use or install Cxx. So, maybe I didn't
>>> understand properly what you
>>> were suggesting for me to do in the source version of Julia...
>>> Or maybe there is sth else I should try..?
>>>
>>
>> Well it's guesswork on my part, the exact failure would be helpful.
>> However, I'm going
>> to try to do this as well.  Not exactly the thing you're doing but
>> related, you're more
>> familiar with Cxx, and I'm more familiar with embed, let's see what can
>> be done.
>>
>


[julia-users] Re: Errors while trying to use cxx and embed Julia together

2015-07-18 Thread Kostas Tavlaridis-Gyparakis
So, in case it will be of any help to you here is the exact message I 
receive:

julia> Pkg.build("Cxx")
INFO: Building Cxx
Tuning for julia installation at: /home/kostav/Julian/julia-f428392003/bin
BuildBootstrap.Makefile:2: 
/home/kostav/Julian/julia-f428392003/bin/../../deps/Versions.make: No such 
file or directory
BuildBootstrap.Makefile:3: 
/home/kostav/Julian/julia-f428392003/bin/../../Make.inc: No such file or 
directory
make: *** No rule to make target 
'/home/kostav/Julian/julia-f428392003/bin/../../Make.inc'.  Stop.
=[ ERROR: Cxx 
]=

LoadError: failed process: Process(`make -f BuildBootstrap.Makefile 
JULIA_HOME=/home/kostav/Julian/julia-f428392003/bin`, ProcessExited(2)) [2]
while loading /home/kostav/.julia/v0.4/Cxx/deps/build.jl, in expression 
starting on line 16



[ BUILD ERRORS 
]

WARNING: Cxx had build errors.

 - packages with build errors remain installed in /home/kostav/.julia/v0.4
 - build the package(s) and all dependencies with `Pkg.build("Cxx")`
 - build a single package by running its `deps/build.jl` script




On Saturday, July 18, 2015 at 11:35:32 PM UTC+2, Jeff Waller wrote:
>
>
>
> On Saturday, July 18, 2015 at 5:24:33 AM UTC-4, Kostas 
> Tavlaridis-Gyparakis wrote:
>>
>> Hello again and thanks a lot for the suggestions.
>> Thing is, I went back to the source version of Julia where Cxx is already 
>> built and
>> runs properly, so there wasn't much for me to do, I run in terminal also 
>> the command of:
>>
>> "addHeaderDir("/home/kostav/julia/src/")"
>>
>> Then proceeded again with make install and run the version of julia from 
>> this folder but
>> still not being able to use or install Cxx. So, maybe I didn't understand 
>> properly what you
>> were suggesting for me to do in the source version of Julia...
>> Or maybe there is sth else I should try..?
>>
>
> Well it's guesswork on my part, the exact failure would be helpful. 
>  However, I'm going
> to try to do this as well.  Not exactly the thing you're doing but 
> related, you're more
> familiar with Cxx, and I'm more familiar with embed, let's see what can be 
> done. 
>


[julia-users] Re: Errors while trying to use cxx and embed Julia together

2015-07-18 Thread Jeff Waller


On Saturday, July 18, 2015 at 5:24:33 AM UTC-4, Kostas Tavlaridis-Gyparakis 
wrote:
>
> Hello again and thanks a lot for the suggestions.
> Thing is, I went back to the source version of Julia where Cxx is already 
> built and
> runs properly, so there wasn't much for me to do, I run in terminal also 
> the command of:
>
> "addHeaderDir("/home/kostav/julia/src/")"
>
> Then proceeded again with make install and run the version of julia from 
> this folder but
> still not being able to use or install Cxx. So, maybe I didn't understand 
> properly what you
> were suggesting for me to do in the source version of Julia...
> Or maybe there is sth else I should try..?
>

Well it's guesswork on my part, the exact failure would be helpful. 
 However, I'm going
to try to do this as well.  Not exactly the thing you're doing but related, 
you're more
familiar with Cxx, and I'm more familiar with embed, let's see what can be 
done. 


[julia-users] Re: Errors while trying to use cxx and embed Julia together

2015-07-18 Thread Kostas Tavlaridis-Gyparakis
Hello again and thanks a lot for the suggestions.
Thing is, I went back to the source version of Julia where Cxx is already 
built and
runs properly, so there wasn't much for me to do, I run in terminal also 
the command of:

"addHeaderDir("/home/kostav/julia/src/")"

Then proceeded again with make install and run the version of julia from 
this folder but
still not being able to use or install Cxx. So, maybe I didn't understand 
properly what you
were suggesting for me to do in the source version of Julia...
Or maybe there is sth else I should try..?

On Friday, July 17, 2015 at 10:31:16 PM UTC+2, Jeff Waller wrote:
>
>
>
> On Friday, July 17, 2015 at 1:44:41 PM UTC-4, Kostas Tavlaridis-Gyparakis 
> wrote:
>>
>> Hello,
>> Just to be sure that I am understanding correctly what your proposal.
>> You suggest I should:
>>
>> 1) Completely uninstall Julia
>>
>  
>
>> 2) Recompile the source code (i.e. run make)
>>
>
> heh no need for 1,2, the current source tree build should be fine.
>  
>
>> 3) Then try using julia from the source code build cxx package
>>
>
> Yea like Isaiah says, originally this built by pointing to the source 
> tree, 
> it's still there.
>  
>
>> 4) Then perform the make install and link the version of julia of the 
>> decaxemical folder with my system
>> And hopefully this will work?
>>
>
> The tricky part.  There's a reasonable change it will just work, and 
> likewise there's a good
> chance it won't and it all revolves around what Cxx expects from Julia and 
> does Julia make install
> copy whatever that is into the install directory.
>  
>
>> I am just asking to be sure before I proceed with any attempt, as the 
>> make command is really time con-
>> suming, so want first to be sure that I am doing what you are actually 
>> suggesting (:
>>
>> On Friday, July 17, 2015 at 6:24:21 PM UTC+2, Jeff Waller wrote:
>>>
>>> Yea I think what you're seeing is that Cxx needs to use the source tree
>>> for example Make.inc only exists in the source tree while embedding 
>>> assumes the installed tree.
>>>
>>> How to reconcile this the best way I'm not sure yet.  I myself found Cxx
>>> interesting enough to try, but the build failed a couple of times and I
>>> haven't had a chance to pick it back up.  But here's what I assume 
>>> could be done.
>>>
>>> Don't attempt to do them at the same time but first Cxx (using source)
>>> and then embed second (using install).
>>>
>>> Build Cxx following the Cxx instructions.
>>>
>>> Then install (this is the tricky part and only something I can guess at
>>> right now).  You might find that a number of things necessary for Cxx
>>> to function are not installed by default, or it will all go smoothly.  I 
>>> think
>>> though that Cxx is going to need clang in some way and that is definitely
>>> NOT installed by default.  I'm not sure how much Julia must/can provide
>>> and how much the Cxx package can/must provide.
>>>
>>> Then build embed against installed stuff.
>>>
>>> Report errors, they may require multiple iterations.
>>>
>>

[julia-users] Re: Errors while trying to use cxx and embed Julia together

2015-07-17 Thread Jeff Waller


On Friday, July 17, 2015 at 1:44:41 PM UTC-4, Kostas Tavlaridis-Gyparakis 
wrote:
>
> Hello,
> Just to be sure that I am understanding correctly what your proposal.
> You suggest I should:
>
> 1) Completely uninstall Julia
>
 

> 2) Recompile the source code (i.e. run make)
>

heh no need for 1,2, the current source tree build should be fine.
 

> 3) Then try using julia from the source code build cxx package
>

Yea like Isaiah says, originally this built by pointing to the source tree, 
it's still there.
 

> 4) Then perform the make install and link the version of julia of the 
> decaxemical folder with my system
> And hopefully this will work?
>

The tricky part.  There's a reasonable change it will just work, and 
likewise there's a good
chance it won't and it all revolves around what Cxx expects from Julia and 
does Julia make install
copy whatever that is into the install directory.
 

> I am just asking to be sure before I proceed with any attempt, as the make 
> command is really time con-
> suming, so want first to be sure that I am doing what you are actually 
> suggesting (:
>
> On Friday, July 17, 2015 at 6:24:21 PM UTC+2, Jeff Waller wrote:
>>
>> Yea I think what you're seeing is that Cxx needs to use the source tree
>> for example Make.inc only exists in the source tree while embedding 
>> assumes the installed tree.
>>
>> How to reconcile this the best way I'm not sure yet.  I myself found Cxx
>> interesting enough to try, but the build failed a couple of times and I
>> haven't had a chance to pick it back up.  But here's what I assume 
>> could be done.
>>
>> Don't attempt to do them at the same time but first Cxx (using source)
>> and then embed second (using install).
>>
>> Build Cxx following the Cxx instructions.
>>
>> Then install (this is the tricky part and only something I can guess at
>> right now).  You might find that a number of things necessary for Cxx
>> to function are not installed by default, or it will all go smoothly.  I 
>> think
>> though that Cxx is going to need clang in some way and that is definitely
>> NOT installed by default.  I'm not sure how much Julia must/can provide
>> and how much the Cxx package can/must provide.
>>
>> Then build embed against installed stuff.
>>
>> Report errors, they may require multiple iterations.
>>
>

Re: [julia-users] Re: Errors while trying to use cxx and embed Julia together

2015-07-17 Thread Isaiah Norton
Somehow your setup has regressed here. Cxx.jl was loading fine in your
original email, so go back to that version and call:

addHeaderDir("/home/kostav/julia/src/")

because that is where julia.h lives.

On Fri, Jul 17, 2015 at 1:44 PM, Kostas Tavlaridis-Gyparakis <
kostas.tavlari...@gmail.com> wrote:

> Hello,
> Just to be sure that I am understanding correctly what your proposal.
> You suggest I should:
>
> 1) Completely uninstall Julia
> 2) Recompile the source code (i.e. run make)
> 3) Then try using julia from the source code build cxx package
> 4) Then perform the make install and link the version of julia of the
> decaxemical folder with my system
> And hopefully this will work?
> I am just asking to be sure before I proceed with any attempt, as the make
> command is really time con-
> suming, so want first to be sure that I am doing what you are actually
> suggesting (:
>
>
> On Friday, July 17, 2015 at 6:24:21 PM UTC+2, Jeff Waller wrote:
>>
>> Yea I think what you're seeing is that Cxx needs to use the source tree
>> for example Make.inc only exists in the source tree while embedding
>> assumes the installed tree.
>>
>> How to reconcile this the best way I'm not sure yet.  I myself found Cxx
>> interesting enough to try, but the build failed a couple of times and I
>> haven't had a chance to pick it back up.  But here's what I assume
>> could be done.
>>
>> Don't attempt to do them at the same time but first Cxx (using source)
>> and then embed second (using install).
>>
>> Build Cxx following the Cxx instructions.
>>
>> Then install (this is the tricky part and only something I can guess at
>> right now).  You might find that a number of things necessary for Cxx
>> to function are not installed by default, or it will all go smoothly.  I
>> think
>> though that Cxx is going to need clang in some way and that is definitely
>> NOT installed by default.  I'm not sure how much Julia must/can provide
>> and how much the Cxx package can/must provide.
>>
>> Then build embed against installed stuff.
>>
>> Report errors, they may require multiple iterations.
>>
>


[julia-users] Re: Errors while trying to use cxx and embed Julia together

2015-07-17 Thread Kostas Tavlaridis-Gyparakis
Hello,
Just to be sure that I am understanding correctly what your proposal.
You suggest I should:

1) Completely uninstall Julia
2) Recompile the source code (i.e. run make)
3) Then try using julia from the source code build cxx package
4) Then perform the make install and link the version of julia of the 
decaxemical folder with my system
And hopefully this will work?
I am just asking to be sure before I proceed with any attempt, as the make 
command is really time con-
suming, so want first to be sure that I am doing what you are actually 
suggesting (:

On Friday, July 17, 2015 at 6:24:21 PM UTC+2, Jeff Waller wrote:
>
> Yea I think what you're seeing is that Cxx needs to use the source tree
> for example Make.inc only exists in the source tree while embedding 
> assumes the installed tree.
>
> How to reconcile this the best way I'm not sure yet.  I myself found Cxx
> interesting enough to try, but the build failed a couple of times and I
> haven't had a chance to pick it back up.  But here's what I assume 
> could be done.
>
> Don't attempt to do them at the same time but first Cxx (using source)
> and then embed second (using install).
>
> Build Cxx following the Cxx instructions.
>
> Then install (this is the tricky part and only something I can guess at
> right now).  You might find that a number of things necessary for Cxx
> to function are not installed by default, or it will all go smoothly.  I 
> think
> though that Cxx is going to need clang in some way and that is definitely
> NOT installed by default.  I'm not sure how much Julia must/can provide
> and how much the Cxx package can/must provide.
>
> Then build embed against installed stuff.
>
> Report errors, they may require multiple iterations.
>


[julia-users] Re: Errors while trying to use cxx and embed Julia together

2015-07-17 Thread Jeff Waller
Yea I think what you're seeing is that Cxx needs to use the source tree
for example Make.inc only exists in the source tree while embedding 
assumes the installed tree.

How to reconcile this the best way I'm not sure yet.  I myself found Cxx
interesting enough to try, but the build failed a couple of times and I
haven't had a chance to pick it back up.  But here's what I assume 
could be done.

Don't attempt to do them at the same time but first Cxx (using source)
and then embed second (using install).

Build Cxx following the Cxx instructions.

Then install (this is the tricky part and only something I can guess at
right now).  You might find that a number of things necessary for Cxx
to function are not installed by default, or it will all go smoothly.  I 
think
though that Cxx is going to need clang in some way and that is definitely
NOT installed by default.  I'm not sure how much Julia must/can provide
and how much the Cxx package can/must provide.

Then build embed against installed stuff.

Report errors, they may require multiple iterations.


[julia-users] Re: Errors while trying to use cxx and embed Julia together

2015-07-17 Thread Kostas Tavlaridis-Gyparakis
Hello again,
Latest news are the next:
Following the advice of the previous thread I am now running julia from the 
path where
I copy-pasted the directory that was created from make-install (the one 
with the big number)
this did solve the issue of being able to call julia functions from inside 
c++ initializing with 
the command: jl_init(JULIA_INIT_DIR);
And by having in the makefile the following commands:

CFLAGS   += $(shell /home/kostav/julian/julia-f428392003/bin/julia  
/home/kostav/julian/julia-f428392003/share/julia/julia-config.jl --cflags)
CXXFLAGS += $(shell /home/kostav/julian/julia-f428392003/bin/julia  
/home/kostav/julian/julia-f428392003/share/julia/julia-config.jl --cflags)
LDFLAGS  += $(shell /home/kostav/julian/julia-f428392003/bin/julia  
/home/kostav/julian/julia-f428392003/share/julia/julia-config.jl --ldflags)
LDLIBS   += $(shell /home/kostav/julian/julia-f428392003/bin/julia  
/home/kostav/julian/julia-f428392003/share/julia/julia-config.jl --ldlibs)

Now I also run and compiled the above code of ArrayMake.cpp, ArrayMake.h 
and main.cpp with a make file that included these dependencies:

LDLIBS   += $(shell /home/kostav/julian/julia-f428392003/bin/julia  
/home/kostav/julian/julia-f428392003/share/julia/julia-config.jl --ldlibs)
#
# 'make depend' uses makedepend to automatically generate dependencies 
#   (dependencies are added to end of Makefile)
# 'make'build executable file 'mycc'
# 'make clean'  removes all .o and executable files
#

# define the C compiler to use
CC = g++

# define any compile-time flags
CFLAGS += $(shell /home/kostav/julian/julia-f428392003/bin/julia  
/home/kostav/julian/julia-f428392003/share/julia/julia-config.jl --cflags)

LDFLAGS += $(shell /home/kostav/julian/julia-f428392003/bin/julia  
/home/kostav/julian/julia-f428392003/share/julia/julia-config.jl --ldflags)
# define any directories containing header files other than /usr/include
#

# define library paths in addition to /usr/lib
#   if I wanted to include libraries not in /usr/lib I'd specify
#   their path using -Lpath, something like:
LFLAGS += $(shell /home/kostav/julian/julia-f428392003/bin/julia  
/home/kostav/julian/julia-f428392003/share/julia/julia-config.jl --ldlibs) 

# define any libraries to link into executable:
#   if I want to link in libraries (libx.so or libx.a) I use the -llibname 
#   option, something like (this will link in libmylib.so and libm.so:
LIBS = -ljulia -lLLVM-3.7svn

# define the C source files
SRCS = main.cpp ArrayMaker.cpp

# define the C object files 
#
# This uses Suffix Replacement within a macro:
#   $(name:string1=string2)
# For each word in 'name' replace 'string1' with 'string2'
# Below we are replacing the suffix .c of all words in the macro SRCS
# with the .o suffix
#
OBJS = $(SRCS:.c=.o)

# define the executable file 
MAIN = test

#
# The following part of the makefile is generic; it can be used to 
# build any executable just by changing the definitions above and by
# deleting dependencies appended to the file from 'make depend'
#

.PHONY: depend clean

all:$(MAIN)
@echoSimplecompilernamedmycchasbeen
compiled

$(MAIN): $(OBJS) 
$(CC) $(CFLAGS) $(INCLUDES) -o $(MAIN) $(OBJS) $(LFLAGS) $(LIBS) 
$(LDFLAGS)

# this is a suffix replacement rule for building .o's from .c's
# it uses automatic variables $<: the name of the prerequisite of
# the rule(a .c file) and $@: the name of the target of the rule (a .o 
file) 
# (see the gnu make manual section about automatic variables)
.c.o:
$(CC) $(CFLAGS) $(INCLUDES) -c $<  -o $@

clean:
$(RM) *.o *~ $(MAIN)

depend: $(SRCS)
makedepend $(INCLUDES) $^
# DO NOT DELETE THIS LINE -- make depend needs it


And until that point everything works smoothly. Yet agian the problem is 
that the Cxx is not installed in this julia directory
and when I try to install it I receive the following error:

Pkg.build("Cxx")
INFO: Building Cxx
Tuning for julia installation at: /home/kostav/julian/julia-f428392003/bin
BuildBootstrap.Makefile:2: 
/home/kostav/julian/julia-f428392003/bin/../../deps/Versions.make: No such 
file or directory
BuildBootstrap.Makefile:3: 
/home/kostav/julian/julia-f428392003/bin/../../Make.inc: No such file or 
directory
make: *** No rule to make target 
'/home/kostav/julian/julia-f428392003/bin/../../Make.inc'.  Stop.
=[ ERROR: Cxx 
]=

LoadError: failed process: Process(`make -f BuildBootstrap.Makefile 
JULIA_HOME=/home/kostav/julian/julia-f428392003/bin`, ProcessExited(2)) [2]
while loading /home/kostav/.julia/v0.4/Cxx/deps/build.jl, in expression 
starting on line 16



[ BUILD ERRORS 
]

WARNING: Cxx had build errors.

 - packages with build errors remain installed in /home/kostav/.julia/v0.4
 - build the package(s

[julia-users] Re: Errors while trying to use cxx and embed Julia together

2015-07-14 Thread Jeff Waller
Some notes

I think a gist might be better and then we can annotate and stuff in place. 
 Google groups is just a mailing
list and is bad for extended debugging info don't worry about it too much 
just a suggestion.

1)

 jl_value_t * ret = jl_call2(func, argument, argument2);
sol =  jl_unbox_float64(ret);

this is ok for this example and testing and the fact you are very confident 
it wont fail, but in general you always
want to follow this up with 

jl_value_t *ex = jl_exception_occurred();
because something could go wrong and then all bets are off.

2)
CFLAGS = -fPIC -Wall -g -Wl,-rpath,/home/kostav/julia/usr/lib 

-Wl,-rpath,/home/kostav/julia/usr/lib<---  Strictly speaking these are 
flags for the linker they might be being applied incorrectly here

3)

#include("/home/kostav/julia/src/julia.h")
cxxinclude("ArrayMaker.h")
maker = @cxxnew ArrayMaker()

Ooh, I don't know about that.  Because you are starting julia, and then 
using Cxx to create ArrayMaker which starts
embedded Julia and so you have Julia running inside Julia, I feel that's a 
little too crazy for Julia in its current state 
to handle.  Perhaps that explains the "never returns" behavior.

4)

Did you see my comments at the end of the previous thread.  I see you're 
using Cxx here
and I think that has some requirements on using the source tree since it 
needs access a
bunch of LLVM libs not normally distributed, and probably some other things 
as well.  

I wonder if those things could be copied into the distribution tree 
manually for this and it would
end up helping?