# Julia optimizations causing crash on ubuntu while sorting multidim arrays

**URL:** <https://discourse.julialang.org/t/julia-optimizations-causing-crash-on-ubuntu-while-sorting-multidim-arrays/42388>\
**Category:** General Usage\
**Created:** [July 1, 2020, 5:27pm UTC](https://discourse.julialang.org/t/julia-optimizations-causing-crash-on-ubuntu-while-sorting-multidim-arrays/42388 "2020-07-01T17:27:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kkylin](https://avatars.discourse-cdn.com/v4/letter/k/dec6dc/32.png) [@kkylin](https://discourse.julialang.org/u/kkylin)\
**Post date:** [July 1, 2020, 5:27pm UTC](https://discourse.julialang.org/t/julia-optimizations-causing-crash-on-ubuntu-while-sorting-multidim-arrays/42388/1 "2020-07-01T17:27:37Z")

</div>

Hi all,

I’ve been using Julia on Macs for years and just got a Linux box. After installing Julia (via apt) recently, I am getting crashes sorting multidim arrays with -O2 and -O3, but not with -O0 and -O1. (Details below.)

I may be googling the wrong terms, but I haven’t found anything directly relevant. I also haven’t tried building from source yet, which I don’t mind doing but am hoping to avoid it. (Life is just easier if I can maintain Julia through apt.) Has someone seen something like this before? Is this an issue with LLVM or related library?

Thanks!

Kevin

===================

In more detail:

lsb\_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04 LTS Release: 20.04 Codename: focal julia -O0 \_  
\_ \_ _(_)\_ | Documentation: [snip]  
(_) | (_) (_) |  
\_ \_ | | \_\_ \_ | Type “?” for help, “]?” for Pkg help.  
| | | | | | |/ ` | |  
| | || | | | (_| | | Version 1.4.1  
_/ |\ __‘_|_|_|\__ ’\_| | Ubuntu ⛬ julia/1.4.1+dfsg-1  
|\_\_/ |

┌ Warning: Terminal not fully functional  
└ @ Base client.jl:374  
julia\> using InteractiveUtils

julia\> versioninfo()  
Julia Version 1.4.1  
Platform Info:  
OS: Linux (x86\_64-linux-gnu)  
CPU: Intel(R) Core™ i9-10940X CPU @ 3.30GHz  
WORD\_SIZE: 64  
LIBM: libopenlibm  
LLVM: libLLVM-8.0.1 (ORCJIT, skylake)  
Environment:  
JULIA\_EDITOR = [snip]

julia\> sort(randn(3,3);dims=1)  
3×3 Array{Float64,2}:  
-0.940945 -0.210062 -1.03662  
-0.68858 0.331558 -0.943664  
0.184526 0.510515 0.286935

julia\> sort(randn(3,3);dims=2)  
3×3 Array{Float64,2}:  
-1.82729 -0.0977983 0.113575  
0.038866 0.0777665 0.129551  
-1.66876 1.27607 2.14418

julia\>  
$ julia -O2  
\_  
\_ \_ _(_)\_ | Documentation: [snip]  
(_) | (_) (_) |  
\_ \_ | | \_\_ \_ | Type “?” for help, “]?” for Pkg help.  
| | | | | | |/ ` | |  
| | || | | | (_| | | Version 1.4.1  
_/ |\ __‘_|_|_|\__ ’\_| | Ubuntu ⛬ julia/1.4.1+dfsg-1  
|\_\_/ |

┌ Warning: Terminal not fully functional  
└ @ Base client.jl:374  
julia\> sort(randn(3,3);dims=1)  
3×3 Array{Float64,2}:  
0.742523 -1.35216 -0.814475  
1.31338 -0.944469 0.00899153  
2.07566 -0.720284 1.34964

julia\> sort(randn(3,3);dims=2)  
Illegal inttoptr  
%37 = ptrtoint double addrspace(13)\* %36 to i64  
Illegal inttoptr  
%56 = inttoptr i64 %55 to i8 addrspace(13)\*

signal (6): Aborted  
in expression starting at none:1  
gsignal at /usr/bin/…/lib/x86\_64-linux-gnu/libc.so.6 (unknown line)  
abort at /usr/bin/…/lib/x86\_64-linux-gnu/libc.so.6 (unknown line)  
unknown function (ip: 0x7f7f21886d04)  
\_ZN4llvm13FPPassManager13runOnFunctionERNS\_8FunctionE at /usr/bin/…/lib/x86\_64-linux-gnu/libLLVM-8.so.1 (unknown line)  
\_ZN4llvm13FPPassManager11runOnModuleERNS\_6ModuleE at /usr/bin/…/lib/x86\_64-linux-gnu/libLLVM-8.so.1 (unknown line)  
\_ZN4llvm6legacy15PassManagerImpl3runERNS\_6ModuleE at /usr/bin/…/lib/x86\_64-linux-gnu/libLLVM-8.so.1 (unknown line)  
unknown function (ip: 0x7f7f21970ac1)  
unknown function (ip: 0x7f7f219732d8)  
unknown function (ip: 0x7f7f219738cd)  
unknown function (ip: 0x7f7f218aeb4a)  
unknown function (ip: 0x7f7f218e0082)  
unknown function (ip: 0x7f7f2190584b)  
jl\_apply\_generic at /usr/bin/…/lib/x86\_64-linux-gnu/libjulia.so.1 (unknown line)  
#sort#13 at ./sort.jl:1033  
unknown function (ip: 0x7f7ef7089532)  
sort##kw at ./sort.jl:1028  
unknown function (ip: 0x7f7ef7088fb5)  
unknown function (ip: 0x7f7f2191875b)  
unknown function (ip: 0x7f7f21918389)  
unknown function (ip: 0x7f7f219188f0)  
unknown function (ip: 0x7f7f219199c8)  
unknown function (ip: 0x7f7f2191a616)  
unknown function (ip: 0x7f7f21932e08)  
unknown function (ip: 0x7f7f219333c8)  
jl\_toplevel\_eval\_in at /usr/bin/…/lib/x86\_64-linux-gnu/libjulia.so.1 (unknown line)  
eval at ./boot.jl:331  
eval\_user\_input at /build/julia-98cBbp/julia-1.4.1+dfsg/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:86  
macro expansion at /build/julia-98cBbp/julia-1.4.1+dfsg/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:118 [inlined]  
#26 at ./task.jl:358  
unknown function (ip: 0x7f7f2191dcbb)  
unknown function (ip: (nil))  
Allocations: 2738799 (Pool: 2738051; Big: 748); GC: 3  
Aborted (core dumped)

---

<div class="post-metadata">

**Author:** ![rdeits](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rdeits/32/286_2.png) [@rdeits](https://discourse.julialang.org/u/rdeits)\
**Post date:** [July 1, 2020, 5:33pm UTC](https://discourse.julialang.org/t/julia-optimizations-causing-crash-on-ubuntu-while-sorting-multidim-arrays/42388/2 "2020-07-01T17:33:08Z")

</div>

I don’t think the apt sources are officially supported in any way. There’s no need to build from source; the generic linux binaries from [Download Julia](https://julialang.org/downloads/) work correctly and don’t have this issue at any optimization level.

---

<div class="post-metadata">

**Author:** ![kkylin](https://avatars.discourse-cdn.com/v4/letter/k/dec6dc/32.png) [@kkylin](https://discourse.julialang.org/u/kkylin)\
**Post date:** [July 1, 2020, 5:51pm UTC](https://discourse.julialang.org/t/julia-optimizations-causing-crash-on-ubuntu-while-sorting-multidim-arrays/42388/3 "2020-07-01T17:51:21Z")

</div>

Thank you! I didn’t appreciate that there may be a difference betweenthe apt version and the one from [julialang.org](http://julialang.org). I’ll try that.

---

<div class="post-metadata">

**Author:** ![kkylin](https://avatars.discourse-cdn.com/v4/letter/k/dec6dc/32.png) [@kkylin](https://discourse.julialang.org/u/kkylin)\
**Post date:** [July 1, 2020, 6:57pm UTC](https://discourse.julialang.org/t/julia-optimizations-causing-crash-on-ubuntu-while-sorting-multidim-arrays/42388/4 "2020-07-01T18:57:26Z")

</div>

Just to confirm for anyone else reading this: the binary distribution works perfectly.
