JuliaLang / julia

The Julia Programming Language
https://julialang.org/
MIT License
45.79k stars 5.49k forks source link

Julia does not compile with GCC 6.3.0 when using c++11 even though the compiler fully supports this c++ standard #36660

Closed samfux84 closed 4 years ago

samfux84 commented 4 years ago

Hi,

I am trying to install the Julia Release 1.4.2 from source code.

Using GCC 6.3.0 (compiled from source):

[sfux@eu-a6-001-01 julia-1.4.2]$ gcc --version
gcc (GCC) 6.3.0
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[sfux@eu-a6-001-01 julia-1.4.2]$

And when running make, I get the following error:

[sfux@eu-a6-001-01 julia-1.4.2]$ make
Warning: git information unavailable; versioning information limited
Warning: git information unavailable; versioning information limited
Warning: git information unavailable; versioning information limited
/scratch/131102562.tmpdir/julia-1.4.2/deps/openlibm.mk:37: *** Attempting to use gcc4 OPENLIBM tarball, but compiling with cxx11 string ABI; set "CXXFLAGS=-D_GLIBCXX_USE_CXX11_ABI=0" to avoid linker errors.  Stop.
make: *** [Makefile:60: julia-deps] Error 2
[sfux@eu-a6-001-01 julia-1.4.2]$

GCC 6.3.0 fully supports the C++11 standard (it even supports most of the C++ 14 standard), therefore I would like to ask, why it is necessary to set "CXXFLAGS=-D_GLIBCXX_USE_CXX11_ABI=0" ?

Best regards

Sam

PallHaraldsson commented 4 years ago

https://docs.computecanada.ca/wiki/GCC_C%2B%2B_Dual_ABI

The transition from GCC version 4.9 to version 5.1 introduced a major change to its application binary interface (ABI). If all source code including all dependent libraries is recompiled using the same version of the compiler then there will be no issues.

I think that's the issue, it's still C++11 with either ABI, but you're being told to use the no-default, or you're run into trouble (I'm not sure it's even about Julia, I think some dependency, libm at a minimum, wants it this way (already compiled that way?), and maybe you can fix that, but why make life difficult?). Did you try it? I guess:

CXXFLAGS=-D_GLIBCXX_USE_CXX11_ABI=0 make
samfux84 commented 4 years ago

@PallHaraldsson : Thank you for the fast and informative reply.

The quote you are posting mentions:

If all source code including all dependent libraries is recompiled using the same version of the compiler then there will be no issues.

If one builds Julia from source, then I think that the dependencies are also compiled with the same compiler than Julia (which would in my case be GCC 6.3.0), therefore this should not create any problem. I fully agree that when using precompiled dependencies that were compiled with GCC 4.8 that this won't work, but this should here not be the case.

On our cluster I compile software using toolchains, all system libraries that I specified in the Make.inc have also been compiled with GCC 6.3.0.

For the moment, I will continue with

CXXFLAGS=-D_GLIBCXX_USE_CXX11_ABI=0 make

Best regards and thank you again.

Sam

samfux84 commented 4 years ago

Tried to compile Julia 1.4.2 with the variable set:

sfux@eu-a6-001-01 julia-1.4.2]$ cat testmake.log
Warning: git information unavailable; versioning information limited
Creating usr/etc/julia/startup.jl
Copying in usr/share/man/man1/julia.1
/scratch/131102562.tmpdir/julia-1.4.2/contrib/install.sh 755 /scratch/131102562.tmpdir/julia-1.4.2/contrib/julia-config.jl /scratch/131102562.tmpdir/julia-1.4.2/usr/share/julia/
Warning: git information unavailable; versioning information limited
Warning: git information unavailable; versioning information limited
Making install in src
 /cluster/apps/sfos/bin/mkdir -p '/scratch/131102562.tmpdir/julia-1.4.2/usr-staging/patchelf-0.9/scratch/131102562.tmpdir/julia-1.4.2/usr/tools'
  /cluster/apps/sfos/bin/install -c patchelf '/scratch/131102562.tmpdir/julia-1.4.2/usr-staging/patchelf-0.9/scratch/131102562.tmpdir/julia-1.4.2/usr/tools'
Making install in tests
 /cluster/apps/sfos/bin/mkdir -p '/scratch/131102562.tmpdir/julia-1.4.2/usr-staging/patchelf-0.9/scratch/131102562.tmpdir/julia-1.4.2/usr/share/doc/patchelf'
 /cluster/apps/sfos/bin/mkdir -p '/scratch/131102562.tmpdir/julia-1.4.2/usr-staging/patchelf-0.9/scratch/131102562.tmpdir/julia-1.4.2/usr/share/man/man1'
 /cluster/apps/sfos/bin/install -c -m 644 /scratch/131102562.tmpdir/julia-1.4.2/deps/srccache/patchelf-0.9/README '/scratch/131102562.tmpdir/julia-1.4.2/usr-staging/patchelf-0.9/scratch/131102562.tmpdir/julia-1.4.2/usr/share/doc/patchelf'
 /cluster/apps/sfos/bin/install -c -m 644 /scratch/131102562.tmpdir/julia-1.4.2/deps/srccache/patchelf-0.9/patchelf.1 '/scratch/131102562.tmpdir/julia-1.4.2/usr-staging/patchelf-0.9/scratch/131102562.tmpdir/julia-1.4.2/usr/share/man/man1'
PATH="/cluster/apps/gcc-6.3.0/pcre2-10.31-icskfvs544io5izei64af5o7gp6fdif5/bin:/cluster/apps/gcc-6.3.0/openblas-0.2.20-cot3cawsqf4pkxjwzjexaykbwn2ch3ii/bin:/cluster/apps/nss/gcc-6.3.0/python/3.7.4/x86_64/bin:/cluster/apps/gcc-6.3.0/curl-7.61.1-wjhduwaux5lhc4lrpxx3gk4ihkkgke27/bin:/cluster/spack/apps/linux-centos7-x86_64/gcc-4.8.5/gcc-6.3.0-sqhtfh32p5gerbkvi5hih7cfvcpmewvj/bin:/cluster/apps/local:/cluster/apps/sfos/bin:/cluster/apps/lsf/10.1/linux2.6-glibc2.3-x86_64/bin:/usr/lib64/qt-3.3/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/cluster/home/sfux/bin:/cluster/apps/ansys/v170/fluent/bin:/cluster/apps/adm:/cluster/home/sfux/shellscript:/cluster/home/sfux/prog/bash:/opt/ibutils/bin:/scratch/131102562.tmpdir/julia-1.4.2/usr/tools" PATCHELF="/scratch/131102562.tmpdir/julia-1.4.2/usr/tools/patchelf" /scratch/131102562.tmpdir/julia-1.4.2/contrib/fixup-libgfortran.sh --verbose /scratch/131102562.tmpdir/julia-1.4.2/usr/lib
Warning: git information unavailable; versioning information limited
Warning: git information unavailable; versioning information limited
Warning: git information unavailable; versioning information limited
Discovered traces of libgfortran within .
Got SONAMES of
Warning: git information unavailable; versioning information limited
    CC usr/lib/libllvmcalltest.so
    CC usr/lib/libccalltest.so
Warning: git information unavailable; versioning information limited
Makefile:110: "WARNING: Generating boilerplate git version info"
    PERL base/pcre_h.jl
    PERL base/errno_h.jl
    PERL base/file_constants.jl
    PERL base/uv_constants.jl
ln -sf /cluster/apps/gcc-6.3.0/gmp-6.1.2-zoxz4uto4e4rztqbqcbmki76nlb5ppuf/lib/libgmp.so.10 /scratch/131102562.tmpdir/julia-1.4.2/usr/lib/julia/libgmp.so
ln -sf /cluster/apps/gcc-6.3.0/pcre2-10.31-icskfvs544io5izei64af5o7gp6fdif5/lib/libpcre2-8.so.0 /scratch/131102562.tmpdir/julia-1.4.2/usr/lib/julia/libpcre2-8.so
ln -sf /cluster/apps/gcc-6.3.0/mpfr-4.0.1-w7qqgg6nyyhck5tqz2r7wpvptkbfi5yj/lib/libmpfr.so.6 /scratch/131102562.tmpdir/julia-1.4.2/usr/lib/julia/libmpfr.so
ln -sf /cluster/apps/gcc-6.3.0/curl-7.61.1-wjhduwaux5lhc4lrpxx3gk4ihkkgke27/lib/libcurl.so.4 /scratch/131102562.tmpdir/julia-1.4.2/usr/lib/julia/libcurl.so
ln -sf /cluster/apps/gcc-6.3.0/openblas-0.2.20-cot3cawsqf4pkxjwzjexaykbwn2ch3ii/lib/libopenblas.so.0 /scratch/131102562.tmpdir/julia-1.4.2/usr/lib/julia/libopenblas.so
    PERL base/build_h.jl.phony
    CC src/support/hashing.o
    CC src/support/timefuncs.o
    CC src/support/ptrhash.o
    CC src/support/operators.o
    CC src/support/utf8.o
    CC src/support/ios.o
    CC src/support/htable.o
    CC src/support/bitvector.o
    CC src/support/int2str.o
    CC src/support/libsupportinit.o
    CC src/support/arraylist.o
    CC src/support/strtod.o
    LINK src/support/libsupport.a
Warning: git information unavailable; versioning information limited
    CC src/flisp/flisp.o
    CC src/flisp/builtins.o
    CC src/flisp/string.o
    CC src/flisp/equalhash.o
    CC src/flisp/table.o
    CC src/flisp/iostream.o
    CC src/flisp/julia_extensions.o
    CC src/flisp/flmain.o
    LINK src/flisp/libflisp.a
    LINK src/flisp/flisp
Warning: git information unavailable; versioning information limited
    FLISP src/julia_flisp.boot
    FLISP src/julia_flisp.boot.inc
Warning: git information unavailable; versioning information limited
    CC src/jloptions.o
    CC src/runtime_ccall.o
    CC src/rtutils.o
    CC src/codegen.o
    CC src/llvm-ptls.o
    CC src/jltypes.o
    CC src/gf.o
    CC src/typemap.o
    CC src/ast.o
    CC src/builtins.o
    CC src/module.o
    CC src/interpreter.o
    CC src/symbol.o
    CC src/dlload.o
    CC src/sys.o
    CC src/init.o
    CC src/task.o
    CC src/dump.o
    CC src/array.o
    CC src/staticdata.o
    CC src/toplevel.o
    CC src/jl_uv.o
    CC src/simplevector.o
    CC src/runtime_intrinsics.o
    CC src/datatype.o
    CC src/precompile.o
    CC src/threading.o
    CC src/partr.o
    CC src/stackwalk.o
    CC src/gc.o
    CC src/gc-debug.o
    CC src/gc-pages.o
    CC src/gc-stacks.o
    CC src/method.o
    CC src/jlapi.o
    CC src/signal-handling.o
    CC src/safepoint.o
    CC src/timing.o
    CC src/subtype.o
    CC src/crc32c.o
    CC src/APInt-C.o
    CC src/processor.o
    CC src/jitlayers.o
    CC src/debuginfo.o
    CC src/disasm.o
    CC src/llvm-simdloop.o
    CC src/llvm-muladd.o
    CC src/llvm-final-gc-lowering.o
    CC src/llvm-pass-helpers.o
    CC src/llvm-late-gc-lowering.o
    CC src/llvm-lower-handlers.o
    CC src/llvm-gc-invariant-verifier.o
    CC src/llvm-propagate-addrspaces.o
    CC src/llvm-multiversioning.o
    CC src/llvm-alloc-opt.o
    CC src/cgmemmgr.o
    CC src/llvm-api.o
In file included from /scratch/131102562.tmpdir/julia-1.4.2/src/llvm-lower-handlers.cpp:7:0:
/scratch/131102562.tmpdir/julia-1.4.2/usr/include/llvm/Analysis/CFG.h:122:1: warning: multi-line comment [-Wcomment]
 ///  /   \
 ^
In file included from /scratch/131102562.tmpdir/julia-1.4.2/src/llvm-gc-invariant-verifier.cpp:11:0:
/scratch/131102562.tmpdir/julia-1.4.2/usr/include/llvm/Analysis/CFG.h:122:1: warning: multi-line comment [-Wcomment]
 ///  /   \
 ^
In file included from /scratch/131102562.tmpdir/julia-1.4.2/src/llvm-propagate-addrspaces.cpp:7:0:
/scratch/131102562.tmpdir/julia-1.4.2/usr/include/llvm/Analysis/CFG.h:122:1: warning: multi-line comment [-Wcomment]
 ///  /   \
 ^
In file included from /scratch/131102562.tmpdir/julia-1.4.2/src/llvm-late-gc-lowering.cpp:10:0:
/scratch/131102562.tmpdir/julia-1.4.2/usr/include/llvm/Analysis/CFG.h:122:1: warning: multi-line comment [-Wcomment]
 ///  /   \
 ^
/scratch/131102562.tmpdir/julia-1.4.2/src/codegen.cpp: In function ‘jl_cgval_t emit_varinfo(jl_codectx_t&, jl_varinfo_t&, jl_sym_t*, jl_value_t*)’:
/scratch/131102562.tmpdir/julia-1.4.2/src/codegen.cpp:3649:82: warning: ‘box_isnull’ may be used uninitialized in this function [-Wmaybe-uninitialized]
                 isnull = ctx.builder.CreateSelect(load_unbox, isnull, box_isnull);
                                                                                  ^
/scratch/131102562.tmpdir/julia-1.4.2/src/codegen.cpp: In function ‘llvm::Function* gen_invoke_wrapper(jl_method_instance_t*, jl_value_t*, const jl_returninfo_t&, int, llvm::StringRef, llvm::Module*)’:
/scratch/131102562.tmpdir/julia-1.4.2/src/codegen.cpp:671:50: warning: ‘result’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     jl_cgval_t tagval(v, NULL, false, typ, tindex);
                                                  ^
/scratch/131102562.tmpdir/julia-1.4.2/src/codegen.cpp:5302:17: note: ‘result’ was declared here
     AllocaInst *result;
                 ^~~~~~
In file included from /scratch/131102562.tmpdir/julia-1.4.2/src/codegen.cpp:49:0:
/scratch/131102562.tmpdir/julia-1.4.2/usr/include/llvm/IR/IRBuilder.h: In function ‘llvm::Value* emit_array_nd_index(jl_codectx_t&, const jl_cgval_t&, jl_value_t*, ssize_t, const jl_cgval_t*, size_t, jl_value_t*)’:
/scratch/131102562.tmpdir/julia-1.4.2/usr/include/llvm/IR/IRBuilder.h:1856:57: warning: ‘ii’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     return CreateICmp(ICmpInst::ICMP_ULT, LHS, RHS, Name);
                                                         ^
In file included from /scratch/131102562.tmpdir/julia-1.4.2/src/codegen.cpp:840:0:
/scratch/131102562.tmpdir/julia-1.4.2/src/cgutils.cpp:2027:12: note: ‘ii’ was declared here
     Value *ii;
            ^~
/scratch/131102562.tmpdir/julia-1.4.2/src/codegen.cpp: In function ‘jl_cgval_t emit_expr(jl_codectx_t&, jl_value_t*, ssize_t)’:
/scratch/131102562.tmpdir/julia-1.4.2/src/codegen.cpp:3541:82: warning: ‘isnull’ may be used uninitialized in this function [-Wmaybe-uninitialized]
                 isnull = ctx.builder.CreateSelect(load_unbox, isnull, box_isnull);
                                                                                  ^
/scratch/131102562.tmpdir/julia-1.4.2/src/codegen.cpp:3521:12: note: ‘isnull’ was declared here
     Value *isnull;
            ^~~~~~
/scratch/131102562.tmpdir/julia-1.4.2/src/codegen.cpp: In function ‘std::unique_ptr<llvm::Module> emit_function(jl_method_instance_t*, jl_code_info_t*, jl_value_t*, size_t, jl_llvm_functions_t*, const jl_cgparams_t*)’:
/scratch/131102562.tmpdir/julia-1.4.2/src/codegen.cpp:6597:42: warning: ‘retval’ may be used uninitialized in this function [-Wmaybe-uninitialized]
             ctx.builder.CreateRet(retval);
                                          ^
    LINK usr/lib/libjulia.so.1.4
Warning: git information unavailable; versioning information limited
    CC ui/repl.o
    LINK usr/bin/julia
Warning: git information unavailable; versioning information limited
    JULIA usr/lib/julia/corecompiler.ji
    JULIA usr/lib/julia/sys.ji
coreio.jl
exports.jl
essentials.jl
ctypes.jl
gcutils.jl
generator.jl
reflection.jl
options.jl
promotion.jl
tuple.jl
expr.jl
pair.jl
traits.jl
range.jl
error.jl
bool.jl
number.jl
int.jl
operators.jl
pointer.jl
refvalue.jl
refpointer.jl
checked.jl
indices.jl
array.jl
abstractarray.jl
subarray.jl
views.jl
baseext.jl
ntuple.jl
abstractdict.jl
iterators.jl
namedtuple.jl
hashing.jl
rounding.jl
div.jl
float.jl
twiceprecision.jl
complex.jl
rational.jl
multinverses.jl
abstractarraymath.jl
arraymath.jl
simdloop.jl
reduce.jl
reshapedarray.jl
reinterpretarray.jl
bitarray.jl
bitset.jl
multimedia.jl
some.jl
dict.jl
abstractset.jl
set.jl
char.jl
strings/basic.jl
strings/string.jl
strings/substring.jl
build_h.jl
version_git.jl
osutils.jl
c.jl
io.jl
iobuffer.jl
intfuncs.jl
strings/strings.jl
strings/search.jl
strings/unicode.jl
strings/util.jl
strings/io.jl
parse.jl
shell.jl
regex.jl
pcre.jl
pcre_h.jl
show.jl
compiler/ssair/show.jl
arrayshow.jl
methodshow.jl
cartesian.jl
multidimensional.jl
permuteddimsarray.jl
broadcast.jl
missing.jl
version.jl
sysinfo.jl
libc.jl
errno_h.jl
env.jl
linked_list.jl
condition.jl
threads.jl
threadingconstructs.jl
atomics.jl
locks-mt.jl
lock.jl
task.jl
weakkeydict.jl
logging.jl
libuv.jl
uv_constants.jl
asyncevent.jl
iostream.jl
stream.jl
filesystem.jl
path.jl
stat.jl
file.jl
file_constants.jl
cmd.jl
process.jl
grisu/grisu.jl
grisu/float.jl
grisu/fastshortest.jl
grisu/fastprecision.jl
grisu/fastfixed.jl
grisu/bignums.jl
grisu/bignum.jl
secretbuffer.jl
floatfuncs.jl
math.jl
special/cbrt.jl
special/exp.jl
special/exp10.jl
special/ldexp_exp.jl
special/hyperbolic.jl
special/trig.jl
special/rem_pio2.jl
special/log.jl
reducedim.jl
accumulate.jl
ordering.jl
sort.jl
fastmath.jl
Enums.jl
gmp.jl
ryu/Ryu.jl
ryu/utils.jl
ryu/shortest.jl
ryu/fixed.jl
ryu/exp.jl
mpfr.jl
combinatorics.jl
hashing2.jl
irrationals.jl
mathconstants.jl
meta.jl
channels.jl
deepcopy.jl
download.jl
summarysize.jl
errorshow.jl
stacktraces.jl
initdefs.jl
threadcall.jl
uuid.jl
loading.jl
util.jl
asyncmap.jl
experimental.jl
deprecated.jl
docs/basedocs.jl
client.jl
docs/Docs.jl
docs/bindings.jl
docs/utils.jl
Base  ─────────── 22.953354 seconds
Base64  ─────────  3.687634 seconds
CRC32c  ─────────  0.007600 seconds
SHA  ────────────  0.150703 seconds
FileWatching  ───  0.088865 seconds
Unicode  ────────  0.005089 seconds
Mmap  ───────────  0.065355 seconds
Serialization  ──  0.248844 seconds
Libdl  ──────────  0.026085 seconds
Printf  ─────────  0.234678 seconds
Markdown  ───────  0.903252 seconds
LibGit2  ────────  1.391330 seconds
Logging  ────────  0.264949 seconds
Sockets  ────────  1.807218 seconds
Profile  ────────  0.171103 seconds
Dates  ──────────  1.676104 seconds
DelimitedFiles  ─  0.093291 seconds
Random  ─────────  0.485830 seconds
UUIDs  ──────────  0.011351 seconds
Future  ─────────  0.003940 seconds
LinearAlgebra  ──  9.327407 seconds
SparseArrays  ───  4.503461 seconds
SuiteSparse  ────  1.119491 seconds
Distributed  ────  0.642284 seconds
SharedArrays  ───  0.155434 seconds
Pkg  ──────────── 10.722860 seconds
Test  ───────────  1.031715 seconds
REPL  ───────────  0.560468 seconds
Statistics  ─────  0.155229 seconds
Stdlibs total  ── 39.554530 seconds
Sysimage built. Summary:
Total ───────  62.507893 seconds
Base: ───────  22.953354 seconds 36.7207%
Stdlibs: ────  39.554530 seconds 63.2793%
Warning: git information unavailable; versioning information limited
    JULIA usr/lib/julia/sys-o.a
ERROR: LoadError: IOError: stream is closed or unusable
Stacktrace:
 [1] check_open at ./stream.jl:328 [inlined]
 [2] uv_write_async(::Base.TTY, ::Ptr{UInt8}, ::UInt64) at ./stream.jl:961
 [3] uv_write(::Base.TTY, ::Ptr{UInt8}, ::UInt64) at ./stream.jl:924
 [4] unsafe_write(::Base.TTY, ::Ptr{UInt8}, ::UInt64) at ./stream.jl:1007
 [5] write at ./strings/io.jl:183 [inlined]
 [6] write(::Base.TTY, ::SubString{String}, ::String) at ./io.jl:584
 [7] (::Main.anonymous.var"#2#6"{Float64,Base.DevNull})(::String, ::IOStream) at /scratch/131102562.tmpdir/julia-1.4.2/contrib/generate_precompile.jl:133
 [8] mktemp(::Main.anonymous.var"#2#6"{Float64,Base.DevNull}, ::String) at ./file.jl:659
 [9] mktemp at ./file.jl:657 [inlined]
 [10] generate_precompile_statements() at /scratch/131102562.tmpdir/julia-1.4.2/contrib/generate_precompile.jl:80
 [11] top-level scope at /scratch/131102562.tmpdir/julia-1.4.2/contrib/generate_precompile.jl:190
in expression starting at /scratch/131102562.tmpdir/julia-1.4.2/contrib/generate_precompile.jl:3
Generating precompile statements...*** This error is usually fixed by running `make clean`. If the error persists, try `make cleanall`. ***
make[1]: *** [sysimage.mk:86: /scratch/131102562.tmpdir/julia-1.4.2/usr/lib/julia/sys-o.a] Error 1
make: *** [Makefile:87: julia-sysimg-release] Error 2
[sfux@eu-a6-001-01 julia-1.4.2]$

I tried "make clean" and reruning make as well as "make cleanall" and rerunning make and I still get the same error.

Best regards

Sam

PallHaraldsson commented 4 years ago

As I thought libm is using BinaryBuilder, so I think you're using binaries not source code. https://github.com/JuliaLang/julia/commit/5f21b526a53a113829cf645c1adc4ce3316354c0

There's also a deps directory (with patches) and at least some code was/is? is built from source. I think you can force all to compile from source, but I've never compiled Julia, I see no reason to.

There usually isn't, for most users, unless you want to contribute to Julia, and then usually even not. For questions there's also discourse.julialang.org and at least close the one here if it answers your.

samfux84 commented 4 years ago

Thank you for your reply.

PallHaraldsson commented 4 years ago

It seems I didn't (fully) answer the question, as I thought (I noticed your comment appearing at the same time I made mine), since this didn't work. Anyway, as I said usually no need, and also since I haven't compiled I can't help you further, except pointing to the docs. It sure works, as people compile!

Feel free to point out here where you went wrong, if you find out, then I know...

samfux84 commented 4 years ago

What would be the right place to ask questions about compiling Julia? On our HPC cluster, we compile all software (even the compilers) from source. With Julia I encounter problems for every version that I try to compile (I started with version 0.3, long time ago). It would be nice if the developers could use some standard build systems like autoconf/automake or cmake to simplify building the software. A makefile is ok as well, but it should actually compile (and not fail every time). If compilation fails, then there should be a useful error message.

    JULIA usr/lib/julia/sys-o.a
ERROR: LoadError: IOError: stream is closed or unusable
Stacktrace:
 [1] check_open at ./stream.jl:328 [inlined]
 [2] uv_write_async(::Base.TTY, ::Ptr{UInt8}, ::UInt64) at ./stream.jl:961
 [3] uv_write(::Base.TTY, ::Ptr{UInt8}, ::UInt64) at ./stream.jl:924
 [4] unsafe_write(::Base.TTY, ::Ptr{UInt8}, ::UInt64) at ./stream.jl:1007
 [5] write at ./strings/io.jl:183 [inlined]
 [6] write(::Base.TTY, ::SubString{String}, ::String) at ./io.jl:584
 [7] (::Main.anonymous.var"#2#6"{Float64,Base.DevNull})(::String, ::IOStream) at /scratch/131320273.tmpdir/julia-1.4.2/contrib/generate_precompile.jl:133
 [8] mktemp(::Main.anonymous.var"#2#6"{Float64,Base.DevNull}, ::String) at ./file.jl:659
 [9] mktemp at ./file.jl:657 [inlined]
 [10] generate_precompile_statements() at /scratch/131320273.tmpdir/julia-1.4.2/contrib/generate_precompile.jl:80
 [11] top-level scope at /scratch/131320273.tmpdir/julia-1.4.2/contrib/generate_precompile.jl:190
in expression starting at /scratch/131320273.tmpdir/julia-1.4.2/contrib/generate_precompile.jl:3
Generating precompile statements...*** This error is usually fixed by running `make clean`. If the error persists, try `make cleanall`. ***
make[1]: *** [sysimage.mk:86: /scratch/131320273.tmpdir/julia-1.4.2/usr/lib/julia/sys-o.a] Error 1
make: *** [Makefile:87: julia-sysimg-release] Error 2

I tried just running make again -> did not work I tried running make clean and then run make again -> did not work I tried running make cleanall and then run make again -> did not work

Best regards

Sam

PallHaraldsson commented 4 years ago

There are "detailed" instructions here: https://github.com/JuliaLang/julia/blob/master/doc/build/build.md

I guess you missed them, two links from the top readme. Cmake is required for libgt2, implying not used otherwise.

There was a "dev" category, or so I thought at Julia discourse, but it was either renamed (and seems then not applying?) or never named that. You could try asking on Slack too, or if this is not helpful just reopen this issue.

StefanKarpinski commented 4 years ago

What would be the right place to ask questions about compiling Julia?

https://discourse.julialang.org is generally the place to ask questions. Sorry that you haven't had success with building Julia. This doesn't appear to be a build system problem (and it's hard to find a build system that's more standard than make). If you opt to use the system versions of all external dependencies, then you need to ensure that you have supported versions of those external dependencies, which are listed here:

https://github.com/JuliaLang/julia/blob/master/doc/build/build.md#required-build-tools-and-external-libraries

It looks like you may be trying to use a version of libuv that does not work for Julia. There are changes to libuv's event loop model required to support Julia's task system, so you cannot use a vanilla unpatched system libuv. These changes are backwards compatible, which means that you can install Julia's libuv as a system library and use it with other applications, but you cannot use a normal libuv with Julia, which sounds like what you're doing. Using an unpatched LLVM is also not recommended. It will probably build, but the resulting Julia may be subtly broken due to LLVM bugs which we have patched but which have not yet been fixed in upstream LLVM releases. The rest of the libraries that Julia uses are "just libraries" but libuv and LLVM are deep parts of Julia's runtime.

Keno commented 4 years ago

Just chiming in here to say that we highly recommend the generic binaries, even in HPC environments. They are well supported and well tested.

samfux84 commented 4 years ago

I am sorry for the rant in my last post. I was just frustrated because compilation did not work. Meanwhile I could figure out why it did not work. I started originally with a OpenBLAS installation with 64-bit integers but then switched to another one with 32-bit integers. The USE_BLAS64 was still set to 1. It was quite difficult to pinpoint this issue. But now Julia 1.4.2 builds fine with using some system libraries but not exclusively (for LLVM I fully agree that it is better to use the version provided by Julia). I used the following settings for the dependency libraries:

USE_SYSTEM_LLVM:=0
USE_SYSTEM_LIBUNWIND:=0
DISABLE_LIBUNWIND:=0
USE_SYSTEM_PCRE:=1
USE_SYSTEM_LIBM:=1
USE_SYSTEM_OPENLIBM:=0
UNTRUSTED_SYSTEM_LIBM:=0
USE_SYSTEM_DSFMT:=0
USE_SYSTEM_BLAS:=1
USE_SYSTEM_LAPACK:=1
USE_SYSTEM_GMP:=1
USE_SYSTEM_MPFR:=1
USE_SYSTEM_SUITESPARSE:=1
USE_SYSTEM_LIBUV:=0
USE_SYSTEM_UTF8PROC:=0
USE_SYSTEM_MBEDTLS:=0
USE_SYSTEM_LIBSSH2:=0
USE_SYSTEM_CURL:=1
USE_SYSTEM_LIBGIT2:=0
USE_SYSTEM_PATCHELF:=1
USE_SYSTEM_ZLIB:=1
USE_SYSTEM_P7ZIP:=1

Compilation and precompiling worked fine.

[sfux@eu-login-36 ~]$ bsub -n 36 -Is -W 9:00 -R "rusage[mem=4600,scratch=6000]" -R "select[model==XeonGold_6150]" bash
Generic job.
Job <131517767> is submitted to queue <hpc.24h>.
<<Waiting for dispatch ...>>
<<Starting on eu-a6-001-01>>
[sfux@eu-a6-001-01 ~]$ env2lmod
[sfux@eu-a6-001-01 ~]$ module load gcc/6.3.0 julia/1.4.2

The following have been reloaded with a version change:
  1) gcc/4.8.5 => gcc/6.3.0

[sfux@eu-a6-001-01 ~]$ module list

Currently Loaded Modules:
  1) StdEnv      3) gmp/6.1.2    5) suite-sparse/5.1.0   7) python/3.7.4   9) pcre2/10.31  11) p7zip/16.02   13) julia/1.4.2
  2) gcc/6.3.0   4) mpfr/4.0.1   6) openblas/0.2.20      8) zlib/1.2.11   10) curl/7.61.1  12) patchelf/0.9

[sfux@eu-a6-001-01 ~]$ julia
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.4.2 (2020-05-23)
 _/ |\__'_|_|_|\__'_|  |
|__/                   |

julia>

Thank you for your help.

Best regards

Sam

StefanKarpinski commented 4 years ago

Great. Glad to hear you got this sorted out. The combinatorial explosion of possible configurations and corresponding confusing failure modes is exactly why we write this about using system libraries:

Please be aware that this procedure is not officially supported, as it introduces additional variability into the installation and versioning of the dependencies, and is recommended only for system package maintainers. Unexpected compile errors may result, as the build system will do no further checking to ensure the proper packages are installed.

Can you confirm that the earlier error was due to trying to use the system libuv? If so, it might be good if we add a note that we don't support using a vanilla libuv library in the build docs. It could save someone else some frustration in the future.

samfux84 commented 4 years ago

I received the error

    JULIA usr/lib/julia/sys-o.a
ERROR: LoadError: IOError: stream is closed or unusable
Stacktrace:
 [1] check_open at ./stream.jl:328 [inlined]
 [2] uv_write_async(::Base.TTY, ::Ptr{UInt8}, ::UInt64) at ./stream.jl:961
 [3] uv_write(::Base.TTY, ::Ptr{UInt8}, ::UInt64) at ./stream.jl:924
 [4] unsafe_write(::Base.TTY, ::Ptr{UInt8}, ::UInt64) at ./stream.jl:1007
 [5] write at ./strings/io.jl:183 [inlined]
 [6] write(::Base.TTY, ::SubString{String}, ::String) at ./io.jl:584
 [7] (::Main.anonymous.var"#2#6"{Float64,Base.DevNull})(::String, ::IOStream) at /scratch/131320273.tmpdir/julia-1.4.2/contrib/generate_precompile.jl:133
 [8] mktemp(::Main.anonymous.var"#2#6"{Float64,Base.DevNull}, ::String) at ./file.jl:659
 [9] mktemp at ./file.jl:657 [inlined]
 [10] generate_precompile_statements() at /scratch/131320273.tmpdir/julia-1.4.2/contrib/generate_precompile.jl:80
 [11] top-level scope at /scratch/131320273.tmpdir/julia-1.4.2/contrib/generate_precompile.jl:190
in expression starting at /scratch/131320273.tmpdir/julia-1.4.2/contrib/generate_precompile.jl:3
Generating precompile statements...*** This error is usually fixed by running `make clean`. If the error persists, try `make cleanall`. ***
make[1]: *** [sysimage.mk:86: /scratch/131320273.tmpdir/julia-1.4.2/usr/lib/julia/sys-o.a] Error 1
make: *** [Makefile:87: julia-sysimg-release] Error 2

with

USE_SYSTEM_LIBUV:=0

It only vanished after USE_BLAS64=0 was matching the OpenBLAS libary that I used (with 32 bit integers).

Best regards

Sam

StefanKarpinski commented 4 years ago

It only vanished after USE_BLAS64=0 was matching the OpenBLAS libary that I used (with 32 bit integers).

Ok, that makes sense. Is there some place in the build docs where you think that could be clarified that would have helped you? I'm not sure how feasible it is for us to detect the word size of each library and warn about mismatches, especially since it's not a library word size thing, it's just a configuration of the library.

samfux84 commented 4 years ago

@StefanKarpinski: Here, the blame is on me, not on the docs. I screwed up by not taking sufficiently care of checking to use the correct BLAS library. After fixing this, Julia compiled fine.

I don't think that this is something that needs to be checked in the makefile. But in any case thank you for asking.