# Some strange linking behavior in Julia

**URL:** <https://discourse.julialang.org/t/some-strange-linking-behavior-in-julia/117182>\
**Category:** General Usage\
**Created:** [July 18, 2024, 10:09am UTC](https://discourse.julialang.org/t/some-strange-linking-behavior-in-julia/117182 "2024-07-18T10:09:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dmitry-kabanov](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dmitry-kabanov/32/52639_2.png) [@dmitry-kabanov](https://discourse.julialang.org/u/dmitry-kabanov)\
**Post date:** [July 18, 2024, 10:09am UTC](https://discourse.julialang.org/t/some-strange-linking-behavior-in-julia/117182/1 "2024-07-18T10:09:20Z")

</div>

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:

```shell
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.

---

<div class="post-metadata">

**Author:** ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Post date:** [July 18, 2024, 11:42am UTC](https://discourse.julialang.org/t/some-strange-linking-behavior-in-julia/117182/2 "2024-07-18T11:42:03Z")

</div>

Can you provide steps to reproduce?

---

<div class="post-metadata">

**Author:** ![dmitry-kabanov](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dmitry-kabanov/32/52639_2.png) [@dmitry-kabanov](https://discourse.julialang.org/u/dmitry-kabanov)\
**Post date:** [July 19, 2024, 10:42am UTC](https://discourse.julialang.org/t/some-strange-linking-behavior-in-julia/117182/3 "2024-07-19T10:42:20Z")

</div>

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:

```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:

```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](https://e.pcloud.link/publink/show?code=XZEFhgZcL741dPT5FFbQwlQMaB3apPEkcwV)

It has a lot of errors like these:

```julia
    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)

```
