Some strange linking behavior in Julia

Hi, I have some code that embeds Julia and uses OrdinaryDiffEqs.jl. I am also having unit tests, which are organized in such what that the OrdinaryDiffEqs.jl package gets reloaded, while Julia is kept between tests, because finalizing Julia and initializing again does not work.

Due to a (somewhat related) linking problem, I was running these unit tests with LD_DEBUG=files, and I have noticed that there some fatal errors, although the unit tests pass:

WARNING: replacing module JlDiffEq.
831702:
<>/.julia/juliaup/julia-1.10.4+0.x64.linux.gnu/lib/julia/libjulia-internal.so.1.10:
error: symbol lookup error: undefined symbol: ijl_symbol_name (fatal)

JlDiffEq in the first line above is basically a Julia module that wraps OrdinaryDiffEq.jl.

I am not sure if it is a bug because the unit tests pass, but still decided to report it.

Can you provide steps to reproduce?

Probably, a completely false alarm, as there are a lot of fatal errors in the linker debug info, but it still works anyway even for the simplest Hello-World program.

main.c:

#include <stdio.h>
#include <julia.h>


int main(void)
{
    jl_init();

    jl_value_t *result = jl_eval_string("2 * 2");

    int result_c = jl_unbox_int64(result);
    printf("2 * 2 = %d\n", result_c + 1);
    return 0;
}

Makefile:

JL_SHARE = $(shell julia -e 'print(joinpath(Sys.BINDIR, 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

After compiling (make), run with LD_DEBUG=files ./main. As I said before, there are a lot of fatal errors but it still works somehow. When I was reporting this I had a problem with a much more complicated program, that’s why I’ve reported it.

This is the debug info file from my machine: https://e.pcloud.link/publink/show?code=XZEFhgZcL741dPT5FFbQwlQMaB3apPEkcwV

It has a lot of errors like these:

    277036:     opening file=/home/dima/.julia/juliaup/julia-1.10.4+0.x64.linux.gnu/lib/julia/libjulia-codegen.so.1.10 [0]; direct_opencount=1
    277036:
    277036:     /home/dima/.julia/juliaup/julia-1.10.4+0.x64.linux.gnu/lib/libjulia.so.1.10: error: symbol lookup error: undefined symbol: jl_get_pgcstack_static (fatal)
    277036:     /home/dima/.julia/juliaup/julia-1.10.4+0.x64.linux.gnu/lib/libjulia.so.1.10: error: symbol lookup error: undefined symbol: jl_pgcstack_addr_static (fatal)
    277036:     /home/dima/.julia/juliaup/julia-1.10.4+0.x64.linux.gnu/lib/libjulia.so.1.10: error: symbol lookup error: undefined symbol: jl_pgcstack_static_semaphore (fatal)