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)
@echo Simple compiler named mycc has been
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) and all dependencies with `Pkg.build("Cxx")`
- build a single package by running its `deps/build.jl` script
================================================================================
This was the error I was receiving before installing julia from the source
code...
So no I am a bit confused how to handle this one...
Any ideas?
On Tuesday, July 14, 2015 at 9:50:14 PM UTC+2, Jeff Waller wrote:
>
> 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?
>