I work with embedded julia (I don't use julia interpreter, I use libjulia-* libraries directly) and due to certain problems (forced termination of the adopted thread (it makes with help of jl_adopt_thread() API, which executes julia code)
|
JL_DLLEXPORT jl_gcframe_t **jl_adopt_thread(void) |
It became necessary to reinitialize the code generation subsystem (calling jl_teardown_codegen() and jl_init_codegen()), since julia remained in an incorrect state when the thread was terminated (locks in the code generation subsystem were not released). However, the reinitialization fails due to the "Library already loaded" error in the sys::DynamicLibrary::addPermanentLibrary (
|
sys::DynamicLibrary libjulia_internal_dylib = sys::DynamicLibrary::addPermanentLibrary( |
|
jl_libjulia_internal_handle, &ErrorStr); |
|
if(!ErrorStr.empty()) |
|
report_fatal_error(llvm::Twine("FATAL: unable to dlopen libjulia-internal\n") + ErrorStr); |
), when trying to download
libjulia-internal (obviously, because it has already been loaded before) and as a result, abortion is called. Ignoring this error completely solves this problem. The documentation for the
addPermanentLibrary function says that it can be safely called many times for the same library.
My suggestion is to ignore this error on initialization step:
sys::DynamicLibrary libjulia_internal_dylib = sys::DynamicLibrary::addPermanentLibrary(
jl_libjulia_internal_handle, &ErrorStr);
if(!ErrorStr.empty())
if (ErrorStr != "Library already loaded")
report_fatal_error(llvm::Twine("FATAL: unable to dlopen libjulia-internal\n") + ErrorStr);
I work with embedded
julia(I don't use julia interpreter, I uselibjulia-*libraries directly) and due to certain problems (forced termination of the adopted thread (it makes with help ofjl_adopt_thread()API, which executes julia code)julia/src/threading.c
Line 436 in 7de5585
It became necessary to reinitialize the code generation subsystem (calling
jl_teardown_codegen()andjl_init_codegen()), since julia remained in an incorrect state when the thread was terminated (locks in the code generation subsystem were not released). However, the reinitialization fails due to the "Library already loaded" error in the sys::DynamicLibrary::addPermanentLibrary (julia/src/jitlayers.cpp
Lines 1945 to 1948 in 7de5585
libjulia-internal(obviously, because it has already been loaded before) and as a result, abortion is called. Ignoring this error completely solves this problem. The documentation for theaddPermanentLibraryfunction says that it can be safely called many times for the same library.My suggestion is to ignore this error on initialization step: