Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

julia 1.11.0 beta 1 build error on FreeBSD #54123

Open
oikumene opened this issue Apr 18, 2024 · 3 comments
Open

julia 1.11.0 beta 1 build error on FreeBSD #54123

oikumene opened this issue Apr 18, 2024 · 3 comments
Labels
domain:building Build system, or building Julia or its dependencies system:freebsd Affects only FreeBSD

Comments

@oikumene
Copy link

While trying to build julia on FreeBSD stable/14, I encountered the following error and cannot resolve it.

gmake[1]: Leaving directory '/wrkdirs/usr/ports/lang/julia/work/julia-1.11.0-beta1/src'
gmake[1]: Entering directory '/wrkdirs/usr/ports/lang/julia/work/julia-1.11.0-beta1'
Warning: git information unavailable; versioning information limited
 cd /wrkdirs/usr/ports/lang/julia/work/julia-1.11.0-beta1/base && /wrkdirs/usr/ports/lang/julia/work/julia-1.11.0-beta1/usr/bin/julia -C "generic"  --output-ji /wrkdirs/usr/ports/lang/julia/work/julia-1.11.0-beta1/usr/lib/julia/corecompiler.ji.tmp --startup-file=no --warn-overwrite=yes -g0 -O0 compiler/compiler.jl
: CommandLine Error: Option 'debug-counter' registered more than once!
LLVM ERROR: inconsistency in registered CommandLine options

The make argument is as below:

MAKE_ARGS+=     VERBOSE=1 NO_GIT=1 \
                USE_BINARYBUILDER=0 \
                prefix=${PREFIX} \
                JCXXFLAGS="${CXXFLAGS}" \
                USE_GPL_LIBS=0 \
                ARCH=x86_64 \
                JULIA_CPU_TARGET=generic \
                USE_SYSTEM_CURL=1 \
                USE_SYSTEM_DSFMT=1 \
                USE_SYSTEM_GMP=1 \
                USE_SYSTEM_OPENLIBM=1 \
                USE_SYSTEM_LAPACK=1 \
                USE_SYSTEM_LIBGIT2=1 \
                USE_SYSTEM_LIBSSH2=1 \
                USE_SYSTEM_MBEDTLS=1 \
                USE_SYSTEM_MPFR=1 \
                USE_SYSTEM_PATCHELF=1 \
                USE_SYSTEM_PCRE=1 \
                USE_SYSTEM_UTF8PROC=1 \
                USE_SYSTEM_P7ZIP=1 \
                USE_SYSTEM_BLAS=1 \
                USE_SYSTEM_NGHTTP2=1 \
                USE_SYSTEM_CSL=1 \
                USE_SYSTEM_LIBUNWIND=1 \
                CC=${CC} \
                CXX=${CXX}
@giordano giordano added domain:building Build system, or building Julia or its dependencies system:freebsd Affects only FreeBSD labels Apr 18, 2024
@oikumene oikumene changed the title julia 1.11.0 beta 1 build error with gcc13 on FreeBSD julia 1.11.0 beta 1 build error on FreeBSD Apr 18, 2024
@oikumene
Copy link
Author

Building with llvm18, I got following stack trace:

[57107] signal 6 (65543): Abort trap
in expression starting at none:0
thr_kill at /lib/libc.so.7 (unknown line)
_raise at /lib/libc.so.7 (unknown line)
abort at /lib/libc.so.7 (unknown line)
_ZN4llvm18report_fatal_errorERKNS_5TwineEb.cold at /wrkdirs/usr/ports/lang/juli
a/work/julia-1.11.0-beta1/usr/bin/../lib/libjulia-internal.so.1.11 (unknown line)
_ZN4llvm18report_fatal_errorEPKcb at /wrkdirs/usr/ports/lang/julia/work/julia-1.11.0-beta1/usr/bin/../lib/libjulia-internal.so.1.11 (unknown line)
_ZN12_GLOBAL__N_117CommandLineParser9addOptionEPN4llvm2cl6OptionEPNS2_10SubCommandE at /wrkdirs/usr/ports/lang/julia/work/julia-1.11.0-beta1/usr/bin/../lib/libjulia-internal.so.1.11 (unknown line)
_ZN4llvm2cl6Option11addArgumentEv at /wrkdirs/usr/ports/lang/julia/work/julia-1.11.0-beta1/usr/bin/../lib/libjulia-internal.so.1.11 (unknown line)
_ZN4llvm12DebugCounter8instanceEv.part.0 at /wrkdirs/usr/ports/lang/julia/work/julia-1.11.0-beta1/usr/bin/../lib/libjulia-internal.so.1.11 (unknown line)
_ZN4llvm2cl20getRegisteredOptionsERNS0_10SubCommandE at /wrkdirs/usr/ports/lang/julia/work/julia-1.11.0-beta1/usr/bin/../lib/libjulia-internal.so.1.11 (unknown line)
jl_init_llvm at /wrkdirs/usr/ports/lang/julia/work/julia-1.11.0-beta1/src/codegen.cpp:9965
jl_init_codegen_impl at /wrkdirs/usr/ports/lang/julia/work/julia-1.11.0-beta1/src/codegen.cpp:10059
_finish_julia_init at /wrkdirs/usr/ports/lang/julia/work/julia-1.11.0-beta1/src/init.c:857
jl_repl_entrypoint at /wrkdirs/usr/ports/lang/julia/work/julia-1.11.0-beta1/src/jlapi.c:1053
main at /wrkdirs/usr/ports/lang/julia/work/julia-1.11.0-beta1/usr/bin/julia (unknown line)
__libc_start1 at /lib/libc.so.7 (unknown line)
_start at /wrkdirs/usr/ports/lang/julia/work/julia-1.11.0-beta1/usr/bin/julia (unknown line)
Allocations: 0 (Pool: 0; Big: 0); GC: 0

@giordano
Copy link
Contributor

LLVM 18? Julia master doesn't even support LLVM 17 yet, v1.11 only supports LLVM 16. But I take you're trying to build Julia with an external and unsupported llvm version, which based on googling the error message

LLVM ERROR: inconsistency in registered CommandLine options

is very likely the cause of your problem.

@oikumene
Copy link
Author

By "llvm18", I wanted to say that I built julia with clang18. I always used llvm shipped with julia.
But I looked into the wrong log file, and the above error message was built by gcc13. (building julia with clang on FreeBSD has the same problem as #52067 until recent FreeBSD-current. I will try it later)

I found this conversation. It is rather old but describes the problem I encountered.

  • The problem seems to be caused by initCommonOptions() invoked many times. It is in libLLVMSupport.a (from deps/srccache/llvm-julia-16.0.6-2/llvm/lib/Support/CommandLine.cpp)
  • libLLVM-16jl.so links all the static LLVM libraries in us/lib/.
  • libjulia-internal.so links libLLVMSupport.a and libLLVMTargetParser.a (via RT_LLVM_LIBS in src/Makefile)
  • libjulia-codegen.so links all the static LLVM libraries, libjulia-internal.so and libLLVM-16jl.so (via CG_RELEASE_LIBS and CG_LLVMLINK in src/Makefile)

So, there is three instance of initCommonOptions(), one in libLLVM-16jl.so, one in libjulia-codegen.so and one in libjulia-internal.so, which make initCommonOptions() called many times.
The solution I took is to remove linking of static LLVM libraries from libjulia-internal.so and libjulia-codegen.so, and link libLLVM-16jl.so to libjulia-internal.so too. As libLLVM-16jl.so links all the static LLVM libraries, the code in the three libraries may call LLVM functions while initCommonOptions() is called only once in libLLVM-16jl.so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain:building Build system, or building Julia or its dependencies system:freebsd Affects only FreeBSD
Projects
None yet
Development

No branches or pull requests

2 participants