# Seg fault when using julia (pakcage installation, profiling)

**URL:** <https://discourse.julialang.org/t/seg-fault-when-using-julia-pakcage-installation-profiling/133991>\
**Category:** General Usage\
**Tags:** question, bug, error, segfault\
**Created:** [November 19, 2025, 2:02pm UTC](https://discourse.julialang.org/t/seg-fault-when-using-julia-pakcage-installation-profiling/133991 "2025-11-19T14:02:13Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ahmed\_ALKAF](https://avatars.discourse-cdn.com/v4/letter/a/3e96dc/32.png) [@Ahmed\_ALKAF](https://discourse.julialang.org/u/Ahmed_ALKAF)\
**Post date:** [November 19, 2025, 2:02pm UTC](https://discourse.julialang.org/t/seg-fault-when-using-julia-pakcage-installation-profiling/133991/1 "2025-11-19T14:02:14Z")

</div>

Hello,

I’m new to Julia so I don’t know if seg faults are a classic thing but anyway, I have one and I don’t know why.

I installed Julia using Juliaup

I’m on linux, so I just ran the command

```julia-auto
curl -fsSL https://install.julialang.org | sh

```

While trying to understand somethings, I wanted to run the following code, which is a simple profiling code :

```julia-auto
using Profile

function myfunc()
    A = rand(200, 200, 400)
    max_val = maximum(A)
    return max_val
end

println("function def ok") 

# First run to compile first 
myfunc()

println("first run ok") 

Profile.clear()

println("Profile clear ok") 

@profile for i in 1:5
    myfunc()
end

println("profiling ok") 

Profile.print()

```

When I tried to execute the code, by doing “julia code.jl” I got a seg fault.

Here’s the exact output :

```julia-auto
function def ok
first run ok
Profile clear ok
Segmentation fault (core dumped)

```

As you can see, the execution reached the point where the profiling starts.

So I wanted to try another method for profiling and found a package called BenchmarkTools. When installing the package I also got a seg fault :

```julia-auto
julia> import Pkg; Pkg.add("BenchmarkTools")
  Installing known registries into `~/.julia`
Segmentation fault (core dumped)

```

Even simple commands such as “pkg\> st --manifest” give a seg fault :

```julia-auto
(@v1.12) pkg> st --manifest
  Installing known registries into `~/.julia`
Segmentation fault (core dumped)

```

I’m using Julia version 1.12.1 (2025-10-17), installed using Juliaup  
I’m on Ubuntu 24.04.2 LTS

Please tell me if you need more info, and thanks in advance for any help.

---

<div class="post-metadata">

**Author:** ![WalterMadelim](https://avatars.discourse-cdn.com/v4/letter/w/3e96dc/32.png) [@WalterMadelim](https://discourse.julialang.org/u/WalterMadelim)\
**Post date:** [November 19, 2025, 2:26pm UTC](https://discourse.julialang.org/t/seg-fault-when-using-julia-pakcage-installation-profiling/133991/2 "2025-11-19T14:26:56Z")

</div>

> [@Ahmed\_ALKAF](#):
>
> When I tried to execute the code, by doing “julia code.jl” I got a seg fault.

Your code can be run without any error on my linux machine. And I also installed julia via juliaup (the recommended way of installing).

Segfaults are not usual for me when writing daily code.

---

<div class="post-metadata">

**Author:** ![GunnarFarneback](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gunnarfarneback/32/1827_2.png) [@GunnarFarneback](https://discourse.julialang.org/u/GunnarFarneback)\
**Post date:** [November 19, 2025, 2:33pm UTC](https://discourse.julialang.org/t/seg-fault-when-using-julia-pakcage-installation-profiling/133991/3 "2025-11-19T14:33:42Z")

</div>

There is nothing normal about this.

It seems to me like a common factor for your segmentation faults are attempts to write files, possibly to `/tmp`. Can you successfully perform

```julia
julia> write("/tmp/test.txt", "test")

```

and

```julia
julia> write(expanduser("~/.julia/test.txt"), "test")

```

?

---

<div class="post-metadata">

**Author:** ![Ahmed\_ALKAF](https://avatars.discourse-cdn.com/v4/letter/a/3e96dc/32.png) [@Ahmed\_ALKAF](https://discourse.julialang.org/u/Ahmed_ALKAF)\
**Post date:** [November 19, 2025, 5:32pm UTC](https://discourse.julialang.org/t/seg-fault-when-using-julia-pakcage-installation-profiling/133991/4 "2025-11-19T17:32:45Z")

</div>

Hi,

Thanks for the replay.

When I executed the commands that you gave me, I got ‘4’ for each, which means the commands that you gave me worked 'since write function returns the number of bytes that have been written :

```julia-auto
julia> write("/tmp/test.txt", "test")
4

julia> write(expanduser("~/.julia/test.txt"), "test")
4

```

Like you said, there’s nothing normal about this.

A colleague of mine suggested that it might be related to the C libraries that I have in my machine and the possibility that they are not compatible with what julia uses but everything else that I use that uses the C libs works fine so I don’t know.

---

<div class="post-metadata">

**Author:** ![GunnarFarneback](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gunnarfarneback/32/1827_2.png) [@GunnarFarneback](https://discourse.julialang.org/u/GunnarFarneback)\
**Post date:** [November 19, 2025, 6:14pm UTC](https://discourse.julialang.org/t/seg-fault-when-using-julia-pakcage-installation-profiling/133991/5 "2025-11-19T18:14:21Z")

</div>

Yes, that disproves my hypothesis. I also rather doubt that C libs should have anything to do with it. Ubuntu 24.04 is a very common platform to run Julia on.

You could try to run Julia in a debugger or with `strace` and see if that provides any hints.

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [November 19, 2025, 6:29pm UTC](https://discourse.julialang.org/t/seg-fault-when-using-julia-pakcage-installation-profiling/133991/6 "2025-11-19T18:29:35Z")

</div>

Perhaps that is a hardware issue, either with your RAM or with your HD drive?

I’m not sure how to debug that, though. Are you overclocking your PC?

---

<div class="post-metadata">

**Author:** ![Zentrik](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/zentrik/32/35409_2.png) [@Zentrik](https://discourse.julialang.org/u/Zentrik)\
**Post date:** [November 20, 2025, 1:57am UTC](https://discourse.julialang.org/t/seg-fault-when-using-julia-pakcage-installation-profiling/133991/7 "2025-11-20T01:57:58Z")

</div>

Can you run `versioninfo(true)` in Julia and send the result

---

<div class="post-metadata">

**Author:** ![Ahmed\_ALKAF](https://avatars.discourse-cdn.com/v4/letter/a/3e96dc/32.png) [@Ahmed\_ALKAF](https://discourse.julialang.org/u/Ahmed_ALKAF)\
**Post date:** [November 21, 2025, 10:59am UTC](https://discourse.julialang.org/t/seg-fault-when-using-julia-pakcage-installation-profiling/133991/8 "2025-11-21T10:59:22Z")

</div>

No, l’m not overclocking the cpu.

It should be noted that the seg fault doesn’t happen with everything, so far it happened when trying to install any package and when running code that profiles a function, not always though.

---

<div class="post-metadata">

**Author:** ![Ahmed\_ALKAF](https://avatars.discourse-cdn.com/v4/letter/a/3e96dc/32.png) [@Ahmed\_ALKAF](https://discourse.julialang.org/u/Ahmed_ALKAF)\
**Post date:** [November 21, 2025, 11:00am UTC](https://discourse.julialang.org/t/seg-fault-when-using-julia-pakcage-installation-profiling/133991/9 "2025-11-21T11:00:58Z")

</div>

Ok, thanks for the advice.

I’ll use a debugger and keep you updated.

---

<div class="post-metadata">

**Author:** ![Ahmed\_ALKAF](https://avatars.discourse-cdn.com/v4/letter/a/3e96dc/32.png) [@Ahmed\_ALKAF](https://discourse.julialang.org/u/Ahmed_ALKAF)\
**Post date:** [November 21, 2025, 11:03am UTC](https://discourse.julialang.org/t/seg-fault-when-using-julia-pakcage-installation-profiling/133991/10 "2025-11-21T11:03:09Z")

</div>

So I ran the exact code that you gave but got an error saying that the method versioninfo doesn’t take any arguments. So I ran the method without ‘true’, here are the outputs (for the method with and without true) :

```julia-auto
julia> versioninfo(true)
ERROR: MethodError: no method matching versioninfo(::Bool)
The function `versioninfo` exists, but no method is defined for this combination of argument types.

Closest candidates are:
  versioninfo(; ...)
   @ InteractiveUtils ~/.julia/juliaup/julia-1.12.1+0.x64.linux.gnu/share/julia/stdlib/v1.12/InteractiveUtils/src/InteractiveUtils.jl:103
  versioninfo(::IO; verbose)
   @ InteractiveUtils ~/.julia/juliaup/julia-1.12.1+0.x64.linux.gnu/share/julia/stdlib/v1.12/InteractiveUtils/src/InteractiveUtils.jl:103

Stacktrace:
 [1] top-level scope
   @ REPL[1]:1

julia> versioninfo()
Julia Version 1.12.1
Commit ba1e628ee49 (2025-10-17 13:02 UTC)
Build Info:
  Official https://julialang.org release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 20 × Intel(R) Core(TM) i5-14500
  WORD_SIZE: 64
  LLVM: libLLVM-18.1.7 (ORCJIT, alderlake)
  GC: Built with stock GC
Threads: 1 default, 1 interactive, 1 GC (on 20 virtual cores)
Environment:
  LD_LIBRARY_PATH = /usr/lib/x86_64-linux-gnu/:/usr/lib/i386-linux-gnu/:/usr/lib/:/usr/local/lib/

```

---

<div class="post-metadata">

**Author:** ![mancolric](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mancolric/32/21799_2.png) [@mancolric](https://discourse.julialang.org/u/mancolric)\
**Post date:** [November 21, 2025, 11:45am UTC](https://discourse.julialang.org/t/seg-fault-when-using-julia-pakcage-installation-profiling/133991/11 "2025-11-21T11:45:20Z")

</div>

I just had the same problem: trying to install a new package yields a segmentation fault. In my case, it is because julia was installed in `/opt` folder, for which you need sudo permissions to write. Installing the package after doing `sudo julia` was successful. Maybe this has nothing to do with your problem, but just in case…

---

<div class="post-metadata">

**Author:** ![GunnarFarneback](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gunnarfarneback/32/1827_2.png) [@GunnarFarneback](https://discourse.julialang.org/u/GunnarFarneback)\
**Post date:** [November 21, 2025, 11:53am UTC](https://discourse.julialang.org/t/seg-fault-when-using-julia-pakcage-installation-profiling/133991/12 "2025-11-21T11:53:41Z")

</div>

> [@Ahmed\_ALKAF](#):
>
> ```julia-auto
> Environment:
> LD_LIBRARY_PATH = /usr/lib/x86_64-linux-gnu/:/usr/lib/i386-linux-gnu/:/usr/lib/:/usr/local/lib/
> 
> ```

There is your problem. Get rid of that environment variable.

---

<div class="post-metadata">

**Author:** ![mancolric](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mancolric/32/21799_2.png) [@mancolric](https://discourse.julialang.org/u/mancolric)\
**Post date:** [November 21, 2025, 12:16pm UTC](https://discourse.julialang.org/t/seg-fault-when-using-julia-pakcage-installation-profiling/133991/14 "2025-11-21T12:16:41Z")

</div>

That works for me.

However, what can we do instead if we need to set `LD_LIBRARY_PATH` in order to call external libraries?

---

<div class="post-metadata">

**Author:** ![Ahmed\_ALKAF](https://avatars.discourse-cdn.com/v4/letter/a/3e96dc/32.png) [@Ahmed\_ALKAF](https://discourse.julialang.org/u/Ahmed_ALKAF)\
**Post date:** [November 21, 2025, 1:42pm UTC](https://discourse.julialang.org/t/seg-fault-when-using-julia-pakcage-installation-profiling/133991/15 "2025-11-21T13:42:12Z")

</div>

Wow, that worked.

Thank you very much.

Although, I would like to understand why that environment variable caused the seg faults ?

Also, I want to add I did some tests before solving the issue and found that Julia works when used with the flag --compile=no or --compile=min, but it becomes so slow obviously.

---

<div class="post-metadata">

**Author:** ![Ahmed\_ALKAF](https://avatars.discourse-cdn.com/v4/letter/a/3e96dc/32.png) [@Ahmed\_ALKAF](https://discourse.julialang.org/u/Ahmed_ALKAF)\
**Post date:** [November 21, 2025, 1:45pm UTC](https://discourse.julialang.org/t/seg-fault-when-using-julia-pakcage-installation-profiling/133991/16 "2025-11-21T13:45:31Z")

</div>

In my case, I need the `LD_LIBRARY_PATH` for an application called Libero SoC.

The variable `LD_LIBRARY_PATH` used to be in bashrc but I removed it so I can run julia.  
Now every time I need to run Libero, I just do an export of `LD_LIBRARY_PATH` with the value that I need, this works and it doesn’t affect julia.

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [November 21, 2025, 2:56pm UTC](https://discourse.julialang.org/t/seg-fault-when-using-julia-pakcage-installation-profiling/133991/17 "2025-11-21T14:56:15Z")

</div>

> [@Ahmed\_ALKAF](#):
>
> Although, I would like to understand why that environment variable caused the seg faults ?

Because the wrong versions of some libraries that Julia needs are loaded. Same library name, but from a different directory.

Could be any of these libraries, that are shipped with Julia:

```julia-auto
ufechner@framework:~/.julia/juliaup/julia-1.12.1+0.x64.linux.gnu/lib/julia$ ls
libamd.so libcurl.so libldl.so.3 libssh2.so
libamd.so.3 libcurl.so.4 libldl.so.3.3.2 libssh2.so.1
libamd.so.3.3.3 libcurl.so.4.8.0 libLLVM-18jl.so libssh2.so.1.0.1
libatomic.so libdSFMT.so libllvmcalltest.so libssl.so
libatomic.so.1 libgcc_s.so.1 libLLVM.so libssl.so.3
libatomic.so.1.2.0 libgfortran.so libLLVM.so.18.1jl libssp.so
libblastrampoline.so libgfortran.so.5 libmpfr.so libssp.so.0
libblastrampoline.so.5 libgfortran.so.5.0.0 libmpfr.so.6 libssp.so.0.0.0
libblastrampoline.so.5.15.0 libgit2.so libmpfr.so.6.2.2 libstdc++.so
libbtf.so libgit2.so.1.9 libnghttp2.so libstdc++.so.6
libbtf.so.2 libgit2.so.1.9.0 libnghttp2.so.14 libstdc++.so.6.0.33
libbtf.so.2.3.2 libgmp.so libnghttp2.so.14.28.3 libsuitesparseconfig.so
libcamd.so libgmp.so.10 libopenblas64_.0.3.29.so libsuitesparseconfig.so.7
libcamd.so.3 libgmp.so.10.5.0 libopenblas64_.so libsuitesparseconfig.so.7.8.3
libcamd.so.3.3.3 libgmpxx.so libopenblas64_.so.0 libumfpack.so
libccalllazybar.so libgmpxx.so.4 libopenlibm.so libumfpack.so.6
libccalllazyfoo.so libgmpxx.so.4.7.0 libopenlibm.so.4 libumfpack.so.6.3.5
libccalltest.so libgomp.so libopenlibm.so.4.0 libunwind.so
libccalltest.so.debug libgomp.so.1 libpcre2-8.so libunwind.so.8
libccolamd.so libgomp.so.1.0.0 libpcre2-8.so.0 libunwind.so.8.1.0
libccolamd.so.3 libjulia-codegen.so libpcre2-8.so.0.13.0 libuv.so
libccolamd.so.3.3.4 libjulia-codegen.so.1.12 libquadmath.so libuv.so.2
libcholmod.so libjulia-codegen.so.1.12.1 libquadmath.so.0 libuv.so.2.0.0
libcholmod.so.5 libjulia-internal.so libquadmath.so.0.0.0 libz.so
libcholmod.so.5.3.0 libjulia-internal.so.1.12 librbio.so libz.so.1
libcolamd.so libjulia-internal.so.1.12.1 librbio.so.4 libz.so.1.3.1
libcolamd.so.3 libklu.so librbio.so.4.3.4 sys.so
libcolamd.so.3.3.4 libklu.so.2 libspqr.so
libcrypto.so libklu.so.2.3.5 libspqr.so.4
libcrypto.so.3 libldl.so libspqr.so.4.3.4

```
