julia: system image file sys.ji not found
I ran into this issue after installing Julia v0.3.10 on a Windows machine and thought I'd post it in case it can help someone else.
When I ran julia.exe
it gave me the error message listed above.
Problem:
I had created a system environment variable called JULIA_HOME
and pointed it to the directory where Julia was installed. Then, I added %JULIA_HOME%\bin
to my PATH
.
Solution:
I pointed JULIA_HOME
to the \bin directory under the Julia install directory. Then, I added %JULIA_HOME%
to my PATH
Eclipse C++: having trouble with including a file with extension ji
jl_init_with_image
jl_init_with_image("pathtosysji", "sys.ji");
The path must be the abs path.
ie: /home/kostav/workspace/juli/Debug/../lib/x86_64-linux-gnu/julia/sys.ji
Julia version in Julia Studio
Julia Studio uses the julia-basic
executable. There is no julia
executable, per se. Rather there is julia-basic
and julia-readline
executables, the later of which has GNU Readline capabilities. The debug versions of the executables included debug symbols in the executable--it does not sound like you need those.
You can add processors in the REPL with addprocs
(link to docs). There is no requirement to define the number of processors up front when starting the Julia process.
Loading Flux and CuArrays in Different Orders Causes Errors
So after quite a bit of hair pulling, I was able to get it working by adding export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/cuda/lib64
to my .bashrc
file.
I believe that julia/Flux/CuArrays was just unbale to find the CUDNN Toolkit.
Compiling Julia embedded in C++ code
The example you are trying to compile is a little bit outdated. As already mentioned you need to give an exitcode
to the jl_atexit_hook()
function. The linker message is about missing functions defined in libraries. To get rid of distribution details I downloaded and build the tarball. Now the example can be build using this makefile:
JULIA_DIR:=julia-0.4.2
JULIA_LIB:=$(JULIA_DIR)/usr/lib
JULIA_SRC:=$(JULIA_DIR)/src
JULIA_INC:=$(JULIA_DIR)/usr/include
CPPFLAGS:=-I$(JULIA_INC) -I$(JULIA_SRC) -I$(JULIA_SRC)/support
LDFLAGS:=-L$(JULIA_LIB)
LDLIBS=-ljulia
export LD_LIBRARY_PATH:=$(JULIA_LIB):$(JULIA_LIB)/julia
all: main
run: main
@./main
clean:
rm -f main
If you now type make run
you will get the next error message about a wrong path the system image is searched in. As Thomas noted here the function jl_init() is creating a context that may fail in this case. We shall give the name and the path of the system image to the init function using jl_init_with_image("julia-0.4.2/usr/lib/julia", "sys.so")
instead. This is an ugly hard coded path and can surely be replaced. But for getting started with this example and to get this problem known, it is enough. The corrected example is this:
#include <julia.h>
#include <stdio.h>
int main(int argc, char *argv[]) {
/* required: setup the julia context */
jl_init_with_image("julia-0.4.2/usr/lib/julia", "sys.so");
/* 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(0);
putchar('\n');
return 0;
}
Running make run
will now be a quite complicated way to calculate the square root of 2 :-)
Have fun.
Related Topics
Store Passwords Required by a Linux Daemon
Why Pid of a Process Is Represented by Opaque Data Type
How to Run an Image Windows Docker on Ubuntu
Number of Subdirectories in a Directory
What Is The Minimal Nesesary File Subset, Required to Amd Opencl Work on Linux
Numa-Aware Named Shared Memory for Linux
How to Specify a Local Bond Interface to Multicast Socket in Haskell
Linux Module to Hook Process Functions
Is It Correct to Use The Rc.Local File to Start a Program When The System Starts
Cannot Get Qwindow::Fromwinid to Work Properly
Process Control Block in Linux
How to Write on Serial Port Using Qextserialport
Ansible - Winrm or Requests Is Not Installed
Code Behind Rstudio Server Export Function
End Perl Script Without Waiting for System Call to Return