Thanks a lot for the answer.
I have located the path of julia-config (/home/kostav/julia/contrib) and I
did try to run it with setting this path.
Both by just writing the command in the terminal:
/home/kostav/julia/contrib/julia-config.jl --cflags --ldflags --ldlibs |
xargs gcc embed_example.c
But I do receive error saying that: fatal error: julia.h: No such file or
directory #include <julia.h>
Or via the makefile, which I change accordingly into this:
CFLAGS += $(shell $/home/kostav/julia/contrib/julia-config.jl --cflags)
CXXFLAGS += $(shell $/home/kostav/julia/contrib/julia-config.jl --cflags)
LDFLAGS += $(shell $/home/kostav/julia/contrib/julia-config.jl --ldflags)
LDLIBS += $(shell $/home/kostav/julia/contrib/julia-config.jl --ldlibs)
all: embed_example
And I receive the following errors:
make: home/kostav/julia/contrib/julia-config.jl: Command not found
make: home/kostav/julia/contrib/julia-config.jl: Command not found
make: home/kostav/julia/contrib/julia-config.jl: Command not found
cc embed_example.c -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
Let me just remind you that in the case where I use jl_init(NULL);
and I run in terminal this command:
gcc -o test main.c -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
Program does compile and the error comes when I try to run the program
where I receive msg saying that:
error while loading shared libraries: libjulia.so: cannot open shared
object file: No such file or directory
So, maybe it would be simpler to try to solve this one?
I don't know, again any suggestions would be really welcome!
On Monday, July 13, 2015 at 3:56:23 PM UTC+2, Isaiah wrote:
>
> 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 <
> [email protected] <javascript:>> 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
>>>
>>
>