JuliaInterop / Cxx.jl

The Julia C++ Interface
Other
757 stars 108 forks source link

`int a = 1;` segfaults under Julia Official v1.1.1 with Centos 7 / CERN CC7 #427

Open JonathanAnderson opened 5 years ago

JonathanAnderson commented 5 years ago

Thanks. I haven't been using Cxx for awhile because I haven't been able to get it to work. I've decided to put on my big boy pants and actually write an issue and after . I've installed Julia from official sources and I removed my ~/.julia folder for the following experiment.

❯ julia
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.1.1 (2019-05-16)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

(v1.1) pkg> st
    Status `~/.julia/environments/v1.1/Project.toml`
  (empty environment)

(v1.1) pkg> add Cxx.jl
   Cloning default registries into `~/.julia`
   Cloning registry from "https://github.com/JuliaRegistries/General.git"
     Added registry `General` to `~/.julia/registries/General`
 Resolving package versions...
 Installed BinaryProvider ─ v0.5.4
 Installed Cxx ──────────── v0.3.2
  Updating `~/.julia/environments/v1.1/Project.toml`
  [a0b5b9ef] + Cxx v0.3.2
  Updating `~/.julia/environments/v1.1/Manifest.toml`
  [b99e7846] + BinaryProvider v0.5.4
  [a0b5b9ef] + Cxx v0.3.2
  [2a0f44e3] + Base64
  [b77e0a4c] + InteractiveUtils
  [8f399da3] + Libdl
  [d6f4376e] + Markdown
  [3fa0cd96] + REPL
  [ea8e919c] + SHA
  [6462fe0b] + Sockets
  Building Cxx → `~/.julia/packages/Cxx/vxYtJ/deps/build.log`

(v1.1) pkg> build Cxx
  Building Cxx → `~/.julia/packages/Cxx/vxYtJ/deps/build.log`

julia> using Cxx
[ Info: Precompiling Cxx [a0b5b9ef-44b7-5148-a2d1-f6db19f3c3d2]

C++ > 1+1
signal (11): Segmentation fault
in expression starting at no file:0
__exchange_and_add at /src/gcc-7.3.0_build/x86_64-pc-linux-gnu/libstdc++-v3/include/ext/atomicity.h:49 [inlined]
__exchange_and_add_dispatch at /src/gcc-7.3.0_build/x86_64-pc-linux-gnu/libstdc++-v3/include/ext/atomicity.h:82 [inlined]
_M_dispose at /src/gcc-7.3.0_build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/basic_string.h:3247 [inlined]
~basic_string at /src/gcc-7.3.0_build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/basic_string.h:3621
unknown function (ip: 0x2aaad8e5557a)
unknown function (ip: 0x2aaad8e55391)
unknown function (ip: 0x2aaad8e5534b)
unknown function (ip: 0x2aaad8e55301)
unknown function (ip: 0x2aaad8e54f6a)
unknown function (ip: 0xffffffffffffffff)
Allocations: 19224097 (Pool: 19221524; Big: 2573); GC: 40
zsh: segmentation fault  /home/janders/root/usr/install/julia/bin/julia -O3

after reading issue #410, I figured that was it and I tried restarting and working from Cxx#master...

               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.1.1 (2019-05-16)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

(v1.1) pkg> st
    Status `~/.julia/environments/v1.1/Project.toml`
  (empty environment)

(v1.1) pkg> add Cxx#master
   Cloning default registries into `~/.julia`
   Cloning registry from "https://github.com/JuliaRegistries/General.git"
     Added registry `General` to `~/.julia/registries/General`
   Cloning git-repo `https://github.com/JuliaInterop/Cxx.jl.git`
  Updating git-repo `https://github.com/JuliaInterop/Cxx.jl.git`
 Resolving package versions...
 Installed BinaryProvider ─ v0.5.4
  Updating `~/.julia/environments/v1.1/Project.toml`
  [a0b5b9ef] + Cxx v0.3.2 #master (https://github.com/JuliaInterop/Cxx.jl.git)
  Updating `~/.julia/environments/v1.1/Manifest.toml`
  [b99e7846] + BinaryProvider v0.5.4
  [a0b5b9ef] + Cxx v0.3.2 #master (https://github.com/JuliaInterop/Cxx.jl.git)
  [2a0f44e3] + Base64
  [b77e0a4c] + InteractiveUtils
  [8f399da3] + Libdl
  [d6f4376e] + Markdown
  [3fa0cd96] + REPL
  [ea8e919c] + SHA
  [6462fe0b] + Sockets
  Building Cxx → `~/.julia/packages/Cxx/v5d2P/deps/build.log`

julia> using Cxx
[ Info: Precompiling Cxx [a0b5b9ef-44b7-5148-a2d1-f6db19f3c3d2]

C++ > 1+1
signal (11): Segmentation fault
in expression starting at no file:0
__exchange_and_add at /src/gcc-7.3.0_build/x86_64-pc-linux-gnu/libstdc++-v3/include/ext/atomicity.h:49 [inlined]
__exchange_and_add_dispatch at /src/gcc-7.3.0_build/x86_64-pc-linux-gnu/libstdc++-v3/include/ext/atomicity.h:82 [inlined]
_M_dispose at /src/gcc-7.3.0_build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/basic_string.h:3247 [inlined]
~basic_string at /src/gcc-7.3.0_build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/basic_string.h:3621
unknown function (ip: 0x2aaad6e5a46a)
unknown function (ip: 0x2aaad6e5a281)
unknown function (ip: 0x2aaad6e5a23b)
unknown function (ip: 0x2aaad6e5a1f1)
unknown function (ip: 0x2aaad6e59e5a)
unknown function (ip: 0xffffffffffffffff)
Allocations: 18840264 (Pool: 18838025; Big: 2239); GC: 39
zsh: segmentation fault  /home/janders/root/usr/install/julia/bin/julia -O3
Gnimuc commented 5 years ago

Could you try a legal C++ expression? Those tests on CI got passed on Julia 1.1.1: https://travis-ci.org/JuliaInterop/Cxx.jl/jobs/543536827

oschulz commented 5 years ago

I also had no success with using the REPL, it's seems completely broken at the moment. Anything I type in there seems to result in a segfault, e.g.

julia> using Cxx

C++ > int i = 1;
signal (11): Segmentation fault
in expression starting at REPL[1]:0

It's only in the REPL, though, e.g.

julia> cxx"int i = 1;"
true

runs just fine.

So it's not really a problem in actual code - but then, the C++ REPL has come in very handy in the past, as an impressive thing to show off when advocating for Julia.

P.S.: Thanks a lot again to @Gnimuc and the others who ported Cxx.jl to Julia 1.x!

Gnimuc commented 5 years ago

I cannot reproduce this in a clean ubuntu18.04 environment, could you post some system details? Thanks for the feedback.

(v1.1) pkg> add Cxx
   Cloning default registries into `~/.julia`
   Cloning registry from "https://github.com/JuliaRegistries/General.git"
     Added registry `General` to `~/.julia/registries/General`
 Resolving package versions...
 Installed BinaryProvider ─ v0.5.4
 Installed Cxx ──────────── v0.3.2
  Updating `~/.julia/environments/v1.1/Project.toml`
  [a0b5b9ef] + Cxx v0.3.2
  Updating `~/.julia/environments/v1.1/Manifest.toml`
  [b99e7846] + BinaryProvider v0.5.4
  [a0b5b9ef] + Cxx v0.3.2
  [2a0f44e3] + Base64 
  [b77e0a4c] + InteractiveUtils 
  [8f399da3] + Libdl 
  [d6f4376e] + Markdown 
  [3fa0cd96] + REPL 
  [ea8e919c] + SHA 
  [6462fe0b] + Sockets 
  Building Cxx → `~/.julia/packages/Cxx/vxYtJ/deps/build.log`

julia> using Cxx
[ Info: Precompiling Cxx [a0b5b9ef-44b7-5148-a2d1-f6db19f3c3d2]

C++ > int a = 1;

julia> versioninfo()
Julia Version 1.1.1
Commit 55e36cc308 (2019-05-16 04:10 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Core(TM) i5-6267U CPU @ 2.90GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.1 (ORCJIT, skylake)
oschulz commented 5 years ago

Hm, indeed, on Ubuntu everything seems fine, I also can't reproduce on Ubuntu 16.04. However, on CentOS-7, the problem is reproducible:

julia> versioninfo()
Julia Version 1.1.1
Commit 55e36cc308 (2019-05-16 04:10 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Xeon(R) CPU E5-2683 v4 @ 2.10GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.1 (ORCJIT, broadwell)
Environment:
  JULIA_DEPOT_PATH = /tmp/oschulz/juliadir-1.1.1
  JULIA_PKGDIR = /tmp/oschulz/juliadir-1.1.1
  JULIA_PKG_DEVDIR = /tmp/oschulz/juliadir-1.1.1/dev

julia> using Cxx

C++ > int a = 1;
signal (11): Segmentation fault
in expression starting at no file:0
__exchange_and_add at /src/gcc-7.3.0_build/x86_64-pc-linux-gnu/libstdc++-v3/include/ext/atomicity.h:49 [inlined]
__exchange_and_add_dispatch at /src/gcc-7.3.0_build/x86_64-pc-linux-gnu/libstdc++-v3/include/ext/atomicity.h:82 [inlined]
_M_dispose at /src/gcc-7.3.0_build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/basic_string.h:3247 [inlined]
~basic_string at /src/gcc-7.3.0_build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/basic_string.h:3621

Here's some system info:

$ cat /etc/redhat-release 
CentOS Linux release 7.6.1810 (Core) 
$ uname -a
Linux mppui4 3.10.0-957.10.1.el7.x86_64 #1 SMP Mon Mar 18 15:06:45 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

It's not the Linux kernel version: The error is also reproducible in a CentOS container (running on, e.g., Ubuntu). If you want to try, you can use my Docker image mppmu/julia-anaconda:julia11-anaconda3201903:

$ docker run -it --rm mppmu/julia-anaconda:julia11-anaconda3201903
[root@... ~]# julia
(v1.1) pkg> add Cxx
[...]

julia> using Cxx
[ Info: Precompiling Cxx [...]

C++ > int a = 1;
signal (11): Segmentation fault
in expression starting at no file:0
__exchange_and_add at /src/gcc-7.3.0_build/x86_64-pc-linux-gnu/libstdc++-v3/include/ext/atomicity.h:49 [inlined]
__exchange_and_add_dispatch at /src/gcc-7.3.0_build/x86_64-pc-linux-gnu/libstdc++-v3/include/ext/atomicity.h:82 [inlined]
_M_dispose at /src/gcc-7.3.0_build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/basic_string.h:3247 [inlined]
~basic_string at /src/gcc-7.3.0_build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/basic_string.h:3621
unknown function (ip: 0x7f8f60a240ea)
unknown function (ip: 0x7f8f60a23f01)
unknown function (ip: 0x7f8f60a23ebb)
unknown function (ip: 0x7f8f60a23e71)
unknown function (ip: 0x7f8f60a23ada)
unknown function (ip: 0xffffffffffffffff)
Allocations: 17479567 (Pool: 17477481; Big: 2086); GC: 36
Segmentation fault (core dumped)
Gnimuc commented 5 years ago

Not 100% sure, but this is likely due to the fact that Cxx.jl currently doesn't ship binaries with all different ABI configurations.

parallels@parallels-Parallels-Virtual-Platform:~/.julia/packages/Cxx/vxYtJ/deps/usr/lib$ ldd libcxxffi.so
    linux-vdso.so.1 (0x00007ffc202b6000)
    libjulia.so.1 => not found
    libLLVM-6.0.so => /home/parallels/.julia/packages/Cxx/vxYtJ/deps/usr/lib/./libLLVM-6.0.so (0x00007f898314f000)
    libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f8982dc6000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f8982a28000)
    libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f8982810000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f898241f000)
    librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f8982217000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f8982013000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f8981df4000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f89884b6000)
oschulz commented 5 years ago

But shouldn't cxx" int a = 1;" fail too, if that's the reason? That's what's confusing me: Everything that I tried so far works fine, except for REPL mode.

JonathanAnderson commented 5 years ago

verified that the cxx" int a = 1;" works... from a clean install of julia

   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.1.1 (2019-05-16)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

(v1.1) pkg> st
    Status `~/.julia/environments/v1.1/Project.toml`
  (empty environment)

(v1.1) pkg> add Cxx#master
   Cloning default registries into `~/.julia`
   Cloning registry from "https://github.com/JuliaRegistries/General.git"
     Added registry `General` to `~/.julia/registries/General`
   Cloning git-repo `https://github.com/JuliaInterop/Cxx.jl.git`
  Updating git-repo `https://github.com/JuliaInterop/Cxx.jl.git`
 Resolving package versions...
 Installed BinaryProvider ─ v0.5.4
  Updating `~/.julia/environments/v1.1/Project.toml`
  [a0b5b9ef] + Cxx v0.3.2 #master (https://github.com/JuliaInterop/Cxx.jl.git)
  Updating `~/.julia/environments/v1.1/Manifest.toml`
  [b99e7846] + BinaryProvider v0.5.4
  [a0b5b9ef] + Cxx v0.3.2 #master (https://github.com/JuliaInterop/Cxx.jl.git)
  [2a0f44e3] + Base64
  [b77e0a4c] + InteractiveUtils
  [8f399da3] + Libdl
  [d6f4376e] + Markdown
  [3fa0cd96] + REPL
  [ea8e919c] + SHA
  [6462fe0b] + Sockets
  Building Cxx → `~/.julia/packages/Cxx/z6h8p/deps/build.log`

julia> using Cxx
[ Info: Precompiling Cxx [a0b5b9ef-44b7-5148-a2d1-f6db19f3c3d2]

julia> cxx" int a = 1;"
true

C++ > int b = 2;
signal (11): Segmentation fault
in expression starting at no file:0
__exchange_and_add at /src/gcc-7.3.0_build/x86_64-pc-linux-gnu/libstdc++-v3/include/ext/atomicity.h:49 [inlined]
__exchange_and_add_dispatch at /src/gcc-7.3.0_build/x86_64-pc-linux-gnu/libstdc++-v3/include/ext/atomicity.h:82 [inlined]
_M_dispose at /src/gcc-7.3.0_build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/basic_string.h:3247 [inlined]
~basic_string at /src/gcc-7.3.0_build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/basic_string.h:3621
unknown function (ip: 0x2aaad8e5f92a)
unknown function (ip: 0x2aaad8e5f741)
unknown function (ip: 0x2aaad8e5f6fb)
unknown function (ip: 0x2aaad8e5f6b1)
unknown function (ip: 0x2aaad8e5f31a)
unknown function (ip: 0xffffffffffffffff)
Allocations: 18983804 (Pool: 18981537; Big: 2267); GC: 39
zsh: segmentation fault  /home/janders/root/usr/install/julia/bin/julia -O3

and some systeminfo

$ hostnamectl
   Static hostname: rdx-ws-044
         Icon name: computer-desktop
           Chassis: desktop
        Machine ID: e27c96ba49f34b0682d9f5282c6ba65f
           Boot ID: 3d1f8084e64540b5a5ddc8148ecf31f4
  Operating System: CentOS Linux 7 (Core)
       CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 3.10.0-862.14.4.el7.x86_64
      Architecture: x86-64

$ cat /etc/redhat-release
CentOS Linux release 7.5.1804 (Core)

$ uname -a
Linux rdx-ws-044 3.10.0-862.14.4.el7.x86_64 #1 SMP Wed Sep 26 15:12:11 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
oschulz commented 5 years ago

Yes, same for me, cxx works, but Cxx REPL crashes.

$ julia

(v1.1) pkg> status
    Status `[...]/environments/v1.1/Project.toml`
  (empty environment)

(v1.1) pkg> add Cxx#master
[...]

julia> using Cxx
[ Info: Precompiling Cxx [a0b5b9ef-44b7-5148-a2d1-f6db19f3c3d2]

julia> cxx" int a = 1;"
true

C++ > int a = 1;
signal (11): Segmentation fault
in expression starting at no file:0
[...]

System info:

% hostnamectl
   Static hostname: mppui4
[...]
  Operating System: CentOS Linux 7 (Core)
       CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 3.10.0-957.10.1.el7.x86_64
      Architecture: x86-64
c-wicklein commented 5 years ago

There is necessarily a problem using the pre-built libcxxffi.so for Linux on CentOS 7. The pre-built DSOs require CXXABI_1.3.9, but CentOS 7 only provides CXXABI_1.3.7. I needed to build libcxxffi.so myself. Also, because I'm using g++ from devtoolset-8, Cxx doesn't find C++ headers without help. Here are the two main considerations to get Cxx working from the Julia REPL on CentOS 7:

(1) Cxx doesn't want to build libcxxffi.so if Julia is running from an installed executable, so bootstrap Cxx by running julia from the Julia build tree, i.e. julia/usr/bin/julia, and from the REPL add Cxx then using Cxx. This wasn't too onerous in my case because I was already building Julia from source to use the Intel MKL library, but it is a little clunky. NB that users of devtoolset-8 have an updated version of GCC, but the new tool chain is still built for the old C++ ABI. To use Cxx on CentOS 7, I foresee having to keep a site version of Cxx which has some alternate BinaryProvider configuration to grab a site-local libcxxffi.so build.

(2) Cxx looks for C++ headers in a bunch of places, but it doesn't look where they're installed with devtoolset-8. The fix is to set the environment variable CXXJL_ROOTDIR to /opt/rh/devtoolset-8/root.

c-wicklein commented 5 years ago

Regarding (2), the tool chain can be used to figure out where headers are installed. From https://gcc.gnu.org/onlinedocs/cpp/Search-Path.html via https://stackoverflow.com/questions/17939930/finding-out-what-the-gcc-include-path-is :

$ cpp -v /dev/null -o /dev/null
Using built-in specs.
...
#include "..." search starts here:
#include <...> search starts here:
 /opt/rh/devtoolset-8/root/usr/lib/gcc/x86_64-redhat-linux/8/include
 /usr/local/include
 /opt/rh/devtoolset-8/root/usr/include
 /usr/include
End of search list.
...
oschulz commented 5 years ago

Oh, that looks like a nice solution, @c-wicklein - I can't quite get it to work yet, though.

With

export CXXJL_ROOTDIR=/opt/rh/devtoolset-8/root

and

(v1.1) pkg> build Cxx
julia> using Cxx

I get a this warning:

In file included from /Cxx.cpp:1:
:1:9: warning: '_GLIBCXX_USE_CXX11_ABI' macro redefined
#define _GLIBCXX_USE_CXX11_ABI 1
        ^
/opt/rh/devtoolset-8/root/lib/gcc/x86_64-redhat-linux/8/../../../../include/c++/8/x86_64-redhat-linux/bits/c++config.h:2198:10: note: previous definition is here
# define _GLIBCXX_USE_CXX11_ABI 0

Harmless I guess (but any way to hide it?). So Cxx.jl seems to definitely use devtoolset now. However, the C++-REPL mode still segfaults:

C++ > 1+1;
signal (11): Segmentation fault
in expression starting at REPL[1]:0
__exchange_and_add at /src/gcc-7.3.0_build/x86_64-pc-linux-gnu/libstdc++-v3/include/ext/atomicity.h:49 [inlined]
__exchange_and_add_dispatch at /src/gcc-7.3.0_build/x86_64-pc-linux-gnu/libstdc++-v3/include/ext/atomicity.h:82 [inlined]
_M_dispose at /src/gcc-7.3.0_build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/basic_string.h:3247 [inlined]
~basic_string at /src/gcc-7.3.0_build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/basic_string.h:3621
unknown function (ip: 0x7fd62752d41a)
unknown function (ip: 0x7fd62752d231)
unknown function (ip: 0x7fd62752d1eb)
unknown function (ip: 0x7fd62752d1a1)
unknown function (ip: 0x7fd62752ce00)
unknown function (ip: 0xffffffffffffffff)
Allocations: 20972007 (Pool: 20967512; Big: 4495); GC: 47
Segmentation fault (core dumped)

Do I need to do something else? Any advice would be very much appreciated - I'd like to demo Julia/Cxx.jl to some high energy physics people, and HEP lives almost exclusively on CentOS-7. :-)

c-wicklein commented 5 years ago

Regarding the first error, it's not clear to me whence the first definition comes, but on my test system, there is no c++ compiler installed other than devtoolset-8 g++. Maybe you're mixing headers from a system installation of g++ 4.x with the devtoolset-8 installation of g++?

Regarding the second error, did you actually re-build libcxxffi.so? This doesn't happen as part of building Cxx unless you're running julia built from source, from its build tree. Find libcxxffi.so in your ~/.julia and make sure the mtime shows it just built; I suspect you'll find its mtime is from April.

For reference, here's how I built Julia starting on a fresh CentOS 7 minimum installation. I've omitted parts related to the Intel MKL for clarity.

ORIGIN="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

JULIA_VERSION="v1.1.1"
PREFIX="/opt/julia-1.1.1"

if ! yum repolist | grep sclo 2>/dev/null; then
    yum -y --enablerepo=extras install centos-release-scl
fi

yum -y update

yum -y install devtoolset-8-gcc-c++ \
               devtoolset-8-libquadmath-devel \
               devtoolset-8-gcc-gfortran \
               devtoolset-8-libatomic-devel \
               perl516 \
               m4 \
               patch \
               bzip2 \
               sclo-git25

source /opt/rh/devtoolset-8/enable
source /opt/rh/sclo-git25/enable
if ! test -d "$ORIGIN"/julia; then
    git -C "$ORIGIN" clone git://github.com/JuliaLang/julia.git
else
    git -C "$ORIGIN" clean -qxfd && \
    git -C "$ORIGIN" fetch origin && \
    git -C "$ORIGIN" checkout --force origin/master && \
    git -C "$ORIGIN" branch --force master origin/master && \
    git -C "$ORIGIN" checkout --force master
fi

git -C "$ORIGIN"/julia checkout "$JULIA_VERSION"
cd "$ORIGIN"/julia
echo "prefix=\"$PREFIX\"" >> Make.user
./contrib/download_cmake.sh
(make -j4 && make install) >"$ORIGIN"/build.log 2>&1
oschulz commented 5 years ago

Ah, I would always need a custom-built Julia? Hm, that may not be so attractive to the average user - would it be possible to provide CentOS-7-compatible DSOs? Or would that conflict with the official Julia builds in any case?

c-wicklein commented 5 years ago

The DSO I built for CentOS 7 doesn't work on a newer (Fedora 19) system; there might be a C++ name-mangling change which makes it fundamentally incompatible, but I'm not sure.

It might be worth there being an official DSO distribution just for the purpose of supporting CentOS/RHEL 7... I have to think it's very widely used in large-scale computing. Otherwise, it would be nice if the general Cxx build process knew when it was dealing with an incompatible system and triggered the re-built itself.

oschulz commented 5 years ago

It might be worth there being an official DSO distribution just for the purpose of supporting CentOS/RHEL 7... I have to think it's very widely used in large-scale computing.

If possible, that would be great! That would work with the official Julia binaries, then? CentOS-7 will certainly stay relevant in the scientific computing sector for a long time. The whole CERN/LHC/Grid-world migrated to CentOS-7 not too long ago, and will likely stay on CentOS-7 for many years.