JL_GC_PUSH and JL_GC_POP cause undefined reference to `jl_tls_states'



Compile-time linking failed due to the error above. I am linking against libjulia.so. The program can compile if I remove those GC macro calls.

It seems jl_tls_states is defined in threading.c. Did I miss something to link against?


You’re probably missing a compiler flag. See if https://github.com/JuliaLang/julia/issues/18192 helps you.


Thanks. This does solve my problem. But I have trouble running julia-config.jl.

I built julia (0.5.1) from source and found julia-config.jl under contrib. When I tried running it, it reported error:

ERROR: LoadError: UndefVarError: is_unix not defined
in initDir at /home/ubuntu/julia-0.5.1/contrib/julia-config.jl:40
in main at /home/ubuntu/julia-0.5.1/contrib/julia-config.jl:84
while loading /home/ubuntu/julia-0.5.1/contrib/julia-config.jl, in expression starting on line 91

Was I supposed to “configure julia” somehow?


That sounds like the script is trying to be run by julia 0.4. Check your PATH?


Thanks! Problem solved!