Coder Social home page Coder Social logo

llvm.jl's Introduction

LLVM C API wrapper

A Julia wrapper for the LLVM C API.

PkgEval

The LLVM.jl package is a Julia wrapper for the LLVM C API, and can be used to work with the LLVM compiler framework from Julia. You can use the package to work with LLVM code generated by Julia, to interoperate with the Julia compiler, or to create your own compiler. It is heavily used by the different GPU compilers for the Julia programming language.

Requirements

LLVM.jl is supported on Juila 1.8+, and thus requires LLVM 13. However, the package is really only intended to be used with the LLVM library shipped with Julia. That means you can not use it with other LLVM libraries, like the one provided by your operating system. It is recommended to use the official binaries from julialang.org, but custom builds are supported too (as long as they provide a dynamically-linked copy of the LLVM library).

Installation

LLVM.jl can be installed with the Julia package manager. From the Julia REPL, type ] to enter the Pkg REPL mode and run:

pkg> add LLVM

Or, equivalently, via the Pkg API:

julia> import Pkg; Pkg.add("LLVM")

llvm.jl's People

Contributors

andreasnoack avatar asinghvi17 avatar bors[bot] avatar dependabot[bot] avatar femtocleaner[bot] avatar fredrikekre avatar gbaraldi avatar giordano avatar github-actions[bot] avatar gnimuc avatar jpsamaroo avatar juliatagbot avatar kristofferc avatar maleadt avatar masonprotter avatar pchintalapudi avatar s-d-r avatar simondanisch avatar theonlysilverclaw avatar tkf avatar topolarity avatar tshort avatar vchuravy avatar wsmoses avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

llvm.jl's Issues

Consistently version-bound functionality

For functionality that's only available on certain LLVM versions, we currently either fail to look op the symbol (i.e. do nothing), error-out at run-time, or conditionally define wrappers at compilation time. That's a bit inconsistent, we should have a unified approach, e.g., tag functions with @required_llvm v"7.0" function... end. This could either be put on the wrappers, or be done by the wrapper generator script.

error in building "Multiple LLVM libraries loaded by Julia"

I am trying to add LLVM package to julia but I get the "Mutiple LLVM libraries loaded by Julia" error. Here is the output of the ddlist():
Libdl.dllist() 104-element Array{AbstractString,1}: "linux-vdso.so.1" "/cvmfs/soft.computecanada.ca/easybuild/software/2017/avx2/Compiler/gcc7.3/julia/1.1.0/bin/../lib/libjulia.so.1" "/cvmfs/soft.computecanada.ca/nix/store/63pk88rnmkzjblpxydvrmskkc8ci7cx6-glibc-2.24/lib/libdl.so.2" "/cvmfs/soft.computecanada.ca/nix/store/63pk88rnmkzjblpxydvrmskkc8ci7cx6-glibc-2.24/lib/librt.so.1" "/cvmfs/soft.computecanada.ca/nix/store/63pk88rnmkzjblpxydvrmskkc8ci7cx6-glibc-2.24/lib/libpthread.so.0" "/cvmfs/soft.computecanada.ca/nix/store/63pk88rnmkzjblpxydvrmskkc8ci7cx6-glibc-2.24/lib/libc.so.6" "/cvmfs/soft.computecanada.ca/easybuild/software/2017/Core/llvm/6.0.1/lib/libLLVMLTO.so.6" "/cvmfs/soft.computecanada.ca/easybuild/software/2017/Core/llvm/6.0.1/lib/libLLVMPasses.so.6" "/cvmfs/soft.computecanada.ca/easybuild/software/2017/Core/llvm/6.0.1/lib/libLLVMObjCARCOpts.so.6" "/cvmfs/soft.computecanada.ca/easybuild/software/2017/Core/llvm/6.0.1/lib/libLLVMSymbolize.so.6" "/cvmfs/soft.computecanada.ca/easybuild/software/2017/Core/llvm/6.0.1/lib/libLLVMDebugInfoPDB.so.6" "/cvmfs/soft.computecanada.ca/easybuild/software/2017/Core/llvm/6.0.1/lib/libLLVMDebugInfoDWARF.so.6" "/cvmfs/soft.computecanada.ca/easybuild/software/2017/Core/llvm/6.0.1/lib/libLLVMFuzzMutate.so.6" "/cvmfs/soft.computecanada.ca/easybuild/software/2017/Core/llvm/6.0.1/lib/libLLVMTableGen.so.6" "/cvmfs/soft.computecanada.ca/easybuild/software/2017/Core/llvm/6.0.1/lib/libLLVMDlltoolDriver.so.6" "/cvmfs/soft.computecanada.ca/easybuild/software/2017/Core/llvm/6.0.1/lib/libLLVMLineEditor.so.6" "/cvmfs/soft.computecanada.ca/easybuild/software/2017/Core/llvm/6.0.1/lib/libLLVMOrcJIT.so.6" "/cvmfs/soft.computecanada.ca/easybuild/software/2017/Core/llvm/6.0.1/lib/libLLVMCoverage.so.6" "/cvmfs/soft.computecanada.ca/easybuild/software/2017/Core/llvm/6.0.1/lib/libLLVMMIRParser.so.6" "/cvmfs/soft.computecanada.ca/easybuild/software/2017/Core/llvm/6.0.1/lib/libLLVMNVPTXCodeGen.so.6" "/cvmfs/soft.computecanada.ca/easybuild/software/2017/Core/llvm/6.0.1/lib/libLLVMNVPTXDesc.so.6" "/cvmfs/soft.computecanada.ca/easybuild/software/2017/Core/llvm/6.0.1/lib/libLLVMNVPTXInfo.so.6" "/cvmfs/soft.computecanada.ca/easybuild/software/2017/Core/llvm/6.0.1/lib/libLLVMNVPTXAsmPrinter.so.6" "/cvmfs/soft.computecanada.ca/easybuild/software/2017/Core/llvm/6.0.1/lib/libLLVMObjectYAML.so.6" ⋮ "/cvmfs/soft.computecanada.ca/easybuild/software/2017/avx2/Compiler/gcc7.3/julia/1.1.0/bin/../lib/julia/libdSFMT.so" "/cvmfs/soft.computecanada.ca/easybuild/software/2017/Core/imkl/2018.3.222/mkl/lib/intel64/libmkl_rt.so" "/cvmfs/soft.computecanada.ca/easybuild/software/2017/Core/imkl/2018.3.222/mkl/lib/intel64/libmkl_core.so" "/cvmfs/soft.computecanada.ca/easybuild/software/2017/Core/imkl/2018.3.222/mkl/lib/intel64/../../../compiler/lib/intel64/libiomp5.so" "/cvmfs/soft.computecanada.ca/easybuild/software/2017/Core/imkl/2018.3.222/mkl/lib/intel64/libmkl_intel_thread.so" "/cvmfs/soft.computecanada.ca/easybuild/software/2017/Core/imkl/2018.3.222/mkl/lib/intel64/libmkl_intel_lp64.so" "/cvmfs/soft.computecanada.ca/easybuild/software/2017/Core/imkl/2018.3.222/mkl/lib/intel64/libmkl_avx2.so" "/cvmfs/soft.computecanada.ca/easybuild/software/2017/avx2/Compiler/gcc7.3/suitesparse/4.5.4/lib/libcholmod.so" "/cvmfs/soft.computecanada.ca/easybuild/software/2017/avx2/Compiler/gcc7.3/suitesparse/4.5.4/lib/../lib/libamd.so.2" "/cvmfs/soft.computecanada.ca/easybuild/software/2017/avx2/Compiler/gcc7.3/suitesparse/4.5.4/lib/../lib/libcolamd.so.2" "/cvmfs/soft.computecanada.ca/easybuild/software/2017/avx2/Compiler/gcc7.3/suitesparse/4.5.4/lib/../lib/libsuitesparseconfig.so.4" "/cvmfs/soft.computecanada.ca/easybuild/software/2017/avx2/Compiler/gcc7.3/suitesparse/4.5.4/lib/../lib/libccolamd.so.2" "/cvmfs/soft.computecanada.ca/easybuild/software/2017/avx2/Compiler/gcc7.3/suitesparse/4.5.4/lib/../lib/libcamd.so.2" "/cvmfs/soft.computecanada.ca/easybuild/software/2017/avx2/Compiler/gcc7.3/metis/5.1.0/lib/libmetis.so" "/cvmfs/soft.computecanada.ca/easybuild/software/2017/Core/imkl/2018.3.222/mkl/lib/intel64/libmkl_gf_lp64.so" "/cvmfs/soft.computecanada.ca/easybuild/software/2017/Core/imkl/2018.3.222/mkl/lib/intel64/libmkl_gnu_thread.so" "/cvmfs/soft.computecanada.ca/nix/var/nix/profiles/gcc-7.3.0/lib64/libgfortran.so.4" "/cvmfs/soft.computecanada.ca/nix/var/nix/profiles/gcc-7.3.0/lib64/libgomp.so.1" "/cvmfs/soft.computecanada.ca/nix/store/lgd606ijp0f644lm8zaahldgbly1cxsp-gfortran-7.3.0-lib/lib/libquadmath.so.0" "/cvmfs/soft.computecanada.ca/easybuild/software/2017/avx2/Compiler/gcc7.3/julia/1.1.0/bin/../lib/julia/libsuitesparse_wrapper.so" "/cvmfs/soft.computecanada.ca/easybuild/software/2017/avx2/Compiler/gcc7.3/suitesparse/4.5.4/lib/libumfpack.so.5" "/cvmfs/soft.computecanada.ca/easybuild/software/2017/avx2/Compiler/gcc7.3/suitesparse/4.5.4/lib/libspqr.so.2" "/cvmfs/soft.computecanada.ca/easybuild/software/2017/avx2/Compiler/gcc7.3/suitesparse/4.5.4/lib/libsuitesparseconfig.so"

ConstantInt failure for values near typemax(UInt64)

The following fails:

LLVM.ConstantInt(CodeGen.llvmtype(UInt64), 0xfffffffffffffff8)

Here's the error message:

ERROR: InexactError: check_top_bit(UInt64, 18446744073709551608)
Stacktrace:
 [1] throw_inexacterror(::Symbol, ::Type, ::UInt64) at ./boot.jl:526
 [2] check_top_bit at ./boot.jl:540 [inlined]
 [3] toInt64 at ./boot.jl:601 [inlined]
 [4] Type at ./boot.jl:676 [inlined]
 [5] convert at ./number.jl:7 [inlined]
 [6] ConstantInt(::LLVM.IntegerType, ::UInt64, ::Any) at /home/tshort/.julia/v0.7/LLVM/src/core/value/constant.jl:47
 [7] top-level scope

The problem is this line. It's triggered if val is a UInt64 near typemax(UInt64). I'm not sure what's the best fix. The easiest might by to write a separate method for ConstantInt(typ::IntegerType, val::UInt64, signed=false).

Can't build on OS X

               _
   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: https://docs.julialang.org
   _ _   _| |_  __ _   |  Type "?help" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.6.0-pre.beta.437 (2017-04-30 05:06 UTC)
 _/ |\__'_|_|_|\__'_|  |  Commit 552626cc97 (3 days old master)
|__/                   |  x86_64-apple-darwin16.5.0

julia> Pkg.build("LLVM")
INFO: Building LLVM
DEBUG: Looking for libLLVM in /Users/solver/Projects/julia6/usr/bin/../lib/julia
DEBUG: Looking for llvm-config in /Users/solver/Projects/julia6/usr/bin
DEBUG: Looking for llvm-config in /Users/solver/Projects/julia6/usr/bin/../tools
DEBUG: - 3.9.1 at /Users/solver/Projects/julia6/usr/bin/../tools/llvm-config
DEBUG: Looking for libLLVM in /Users/solver/Projects/julia6/usr/lib
DEBUG: - v3.9.1 at /Users/solver/Projects/julia6/usr/lib/libLLVM.dylib
INFO: Found 1 unique LLVM installations
WARNING: Only considering bundled LLVM v3.9.1 (define USE_SYSTEM_LLVM=1 to override)
DEBUG: Will be using wrapper v3.9 for libLLVM v3.9.1
INFO: Performing source build of LLVM extras library
DEBUG: Building for LLVM v3.9.1 at /Users/solver/Projects/julia6/usr/lib/libLLVM.dylib using /Users/solver/Projects/julia6/usr/bin/../tools/llvm-config
error: invalid argument '-std=gnu99' not allowed with 'C++/ObjC++'
make: *** [IR/Core.o] Error 1
make: *** Waiting for unfinished jobs....
error: invalid argument '-std=gnu99' not allowed with 'C++/ObjC++'
make: *** [IR/Metadata.o] Error 1
error: invalid argument '-std=gnu99' not allowed with 'C++/ObjC++'
make: *** [IR/Pass.o] Error 1
================================[ ERROR: LLVM ]=================================

LoadError: failed process: Process(`make -j9`, ProcessExited(2)) [2]
while loading /Users/solver/.julia/v0.6/LLVM/deps/build.jl, in expression starting on line 42

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

================================[ BUILD ERRORS ]================================

WARNING: LLVM had build errors.

 - packages with build errors remain installed in /Users/solver/.julia/v0.6
 - build the package(s) and all dependencies with `Pkg.build("LLVM")`
 - build a single package by running its `deps/build.jl` script

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

using CuArrays

i am using Julia 0.6.2 in Atom (GTX 1060, Cuda installed, Ryzen 5 1600X)
I know i cant use the newest Version in 0.6.2, but if i install CuArrays it will install an older Version of LLVM automatically, but i get a LoadError:

===[ ERROR: LLVM ]===
LoadError: Unknown OS
while loading C:\Users\Max\.julia\v0.6\LLVM\deps\build.jl, in expression starting on line 104

Part of the Problem:
INFO: Building CUDAnative
ERROR: LoadError: ArgumentError: Module Unicode not found in current path.
Run `Pkg.add("Unicode")` to install the Unicode package.


if i install the knewest version of LLVM:
Pkg.test("CuArrays") gives:
WARNING: julia is fixed at 0.6.2 conflicting with requirement for LLVM: [0.7.0-DEV.2915,∞)

How can i solve this Problem without Julia 0.7?

LLVM won't compile for Julia 1.1.0

The issue arose when precompiling any CUDA related libraries (e.g., CUDAnative, CuArrays)

the error message always includes:

ERROR: LoadError: LLVM.jl has not been built, please run Pkg.build("LLVM").
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] top-level scope at none:0
 [3] include at ./boot.jl:326 [inlined]
 [4] include_relative(::Module, ::String) at ./loading.jl:1038
 [5] include(::Module, ::String) at ./sysimg.jl:29
 [6] top-level scope at none:2
 [7] eval at ./boot.jl:328 [inlined]
 [8] eval(::Expr) at ./client.jl:404
 [9] top-level scope at ./none:3
in expression starting at /home/korvin42/.julia/packages/LLVM/tPWXv/src/LLVM.jl:9
ERROR: LoadError: Failed to precompile LLVM [929cbde3-209d-540e-8aea-75f648917ca0] to /home/korvin42/.julia/compiled/v1.1/LLVM/e8NBy.ji.
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] compilecache(::Base.PkgId, ::String) at ./loading.jl:1197
 [3] _require(::Base.PkgId) at ./loading.jl:960
 [4] require(::Base.PkgId) at ./loading.jl:858
 [5] require(::Module, ::Symbol) at ./loading.jl:853
 [6] include at ./boot.jl:326 [inlined]
 [7] include_relative(::Module, ::String) at ./loading.jl:1038
 [8] include(::Module, ::String) at ./sysimg.jl:29
 [9] top-level scope at none:2
 [10] eval at ./boot.jl:328 [inlined]
 [11] eval(::Expr) at ./client.jl:404
 [12] top-level scope at ./none:3

when running Pkg.build("LLVM"):

(V1.1) pkg> build LLVM
  Building LLVM → `~/.julia/packages/LLVM/tPWXv/deps/build.log`
┌ Error: Error building `LLVM`: 
│ Multiple LLVM libraries loaded by Julia.
│ Please file an issue and attach the output of `Libdl.dllist()`..
└ @ Pkg.Operations /dev/shm/ebuser/avx2/Julia/1.1.0/gmkl-2018.3/julia-1.1.0/usr/share/julia/stdlib/v1.1/Pkg/src/Operations.jl:1075

output of Libdl.dllist():

114-element Array{AbstractString,1}:
 "linux-vdso.so.1"                                                                                                                 
 "/cvmfs/soft.computecanada.ca/easybuild/software/2017/avx2/Compiler/gcc7.3/julia/1.1.0/bin/../lib/libjulia.so.1"                  
 "/cvmfs/soft.computecanada.ca/nix/store/63pk88rnmkzjblpxydvrmskkc8ci7cx6-glibc-2.24/lib/libdl.so.2"                               
 "/cvmfs/soft.computecanada.ca/nix/store/63pk88rnmkzjblpxydvrmskkc8ci7cx6-glibc-2.24/lib/librt.so.1"                               
 "/cvmfs/soft.computecanada.ca/nix/store/63pk88rnmkzjblpxydvrmskkc8ci7cx6-glibc-2.24/lib/libpthread.so.0"                          
 "/cvmfs/soft.computecanada.ca/nix/store/63pk88rnmkzjblpxydvrmskkc8ci7cx6-glibc-2.24/lib/libc.so.6"                                
 "/cvmfs/soft.computecanada.ca/easybuild/software/2017/Core/llvm/6.0.1/lib/libLLVMLTO.so.6"                                        
 "/cvmfs/soft.computecanada.ca/easybuild/software/2017/Core/llvm/6.0.1/lib/libLLVMPasses.so.6"                                     
 "/cvmfs/soft.computecanada.ca/easybuild/software/2017/Core/llvm/6.0.1/lib/libLLVMObjCARCOpts.so.6"                                
 "/cvmfs/soft.computecanada.ca/easybuild/software/2017/Core/llvm/6.0.1/lib/libLLVMSymbolize.so.6"                                  
 "/cvmfs/soft.computecanada.ca/easybuild/software/2017/Core/llvm/6.0.1/lib/libLLVMDebugInfoPDB.so.6"                               
 "/cvmfs/soft.computecanada.ca/easybuild/software/2017/Core/llvm/6.0.1/lib/libLLVMDebugInfoDWARF.so.6"                             
 "/cvmfs/soft.computecanada.ca/easybuild/software/2017/Core/llvm/6.0.1/lib/libLLVMFuzzMutate.so.6"                                 
 "/cvmfs/soft.computecanada.ca/easybuild/software/2017/Core/llvm/6.0.1/lib/libLLVMTableGen.so.6"                                   
 "/cvmfs/soft.computecanada.ca/easybuild/software/2017/Core/llvm/6.0.1/lib/libLLVMDlltoolDriver.so.6"                              
 "/cvmfs/soft.computecanada.ca/easybuild/software/2017/Core/llvm/6.0.1/lib/libLLVMLineEditor.so.6"                                 
 "/cvmfs/soft.computecanada.ca/easybuild/software/2017/Core/llvm/6.0.1/lib/libLLVMOrcJIT.so.6"                                     
 "/cvmfs/soft.computecanada.ca/easybuild/software/2017/Core/llvm/6.0.1/lib/libLLVMCoverage.so.6"                                   
 "/cvmfs/soft.computecanada.ca/easybuild/software/2017/Core/llvm/6.0.1/lib/libLLVMMIRParser.so.6"                                  
 "/cvmfs/soft.computecanada.ca/easybuild/software/2017/Core/llvm/6.0.1/lib/libLLVMNVPTXCodeGen.so.6"                               
 "/cvmfs/soft.computecanada.ca/easybuild/software/2017/Core/llvm/6.0.1/lib/libLLVMNVPTXDesc.so.6"                                  
 "/cvmfs/soft.computecanada.ca/easybuild/software/2017/Core/llvm/6.0.1/lib/libLLVMNVPTXInfo.so.6"                                  
 "/cvmfs/soft.computecanada.ca/easybuild/software/2017/Core/llvm/6.0.1/lib/libLLVMNVPTXAsmPrinter.so.6"                            
 ⋮                                                                                                                                 
 "/cvmfs/soft.computecanada.ca/easybuild/software/2017/avx2/Compiler/gcc7.3/suitesparse/4.5.4/lib/../lib/libccolamd.so.2"          
 "/cvmfs/soft.computecanada.ca/easybuild/software/2017/avx2/Compiler/gcc7.3/suitesparse/4.5.4/lib/../lib/libcamd.so.2"             
 "/cvmfs/soft.computecanada.ca/easybuild/software/2017/avx2/Compiler/gcc7.3/metis/5.1.0/lib/libmetis.so"                           
 "/cvmfs/soft.computecanada.ca/easybuild/software/2017/Core/imkl/2018.3.222/mkl/lib/intel64/libmkl_gf_lp64.so"                     
 "/cvmfs/soft.computecanada.ca/easybuild/software/2017/Core/imkl/2018.3.222/mkl/lib/intel64/libmkl_gnu_thread.so"                  
 "/cvmfs/soft.computecanada.ca/nix/var/nix/profiles/gcc-7.3.0/lib64/libgfortran.so.4"                                              
 "/cvmfs/soft.computecanada.ca/nix/var/nix/profiles/gcc-7.3.0/lib64/libgomp.so.1"                                                  
 "/cvmfs/soft.computecanada.ca/nix/store/lgd606ijp0f644lm8zaahldgbly1cxsp-gfortran-7.3.0-lib/lib/libquadmath.so.0"                 
 "/cvmfs/soft.computecanada.ca/easybuild/software/2017/avx2/Compiler/gcc7.3/julia/1.1.0/bin/../lib/julia/libsuitesparse_wrapper.so"
 "/cvmfs/soft.computecanada.ca/easybuild/software/2017/avx2/Compiler/gcc7.3/suitesparse/4.5.4/lib/libumfpack.so.5"                 
 "/cvmfs/soft.computecanada.ca/easybuild/software/2017/avx2/Compiler/gcc7.3/suitesparse/4.5.4/lib/libspqr.so.2"                    
 "/cvmfs/soft.computecanada.ca/easybuild/software/2017/avx2/Compiler/gcc7.3/suitesparse/4.5.4/lib/libsuitesparseconfig.so"         
 "/cvmfs/soft.computecanada.ca/nix/var/nix/profiles/16.09/lib/libgit2.so"                                                          
 "/cvmfs/soft.computecanada.ca/nix/store/3jd4711ym4d4w9g5wgwks3q7r3k2wpm5-curl-7.53.0/lib/libcurl.so.4"                            
 "/cvmfs/soft.computecanada.ca/nix/store/3ywsj1hifw5gryb80iri2g6b6mdsy44x-http-parser-2.7.0/lib/libhttp_parser.so"                 
 "/cvmfs/soft.computecanada.ca/nix/store/6h4iisrhj010d84nyysw2fl2csnz019m-openssl-1.0.2k/lib/libssl.so.1.0.0"                      
 "/cvmfs/soft.computecanada.ca/nix/store/6h4iisrhj010d84nyysw2fl2csnz019m-openssl-1.0.2k/lib/libcrypto.so.1.0.0"                   
 "/cvmfs/soft.computecanada.ca/nix/store/hfajqyrky7607wmv7h26jwqhwapbq25r-libssh2-1.7.0/lib/libssh2.so.1"                          
 "/cvmfs/soft.computecanada.ca/nix/store/8ym9k10h5fp32s786xg2jfy6d0j5layw-nghttp2-1.14.1-lib/lib/libnghttp2.so.14"                 
 "/cvmfs/soft.computecanada.ca/nix/store/63pk88rnmkzjblpxydvrmskkc8ci7cx6-glibc-2.24/lib/libnss_files.so.2"                        
 "/cvmfs/soft.computecanada.ca/nix/store/63pk88rnmkzjblpxydvrmskkc8ci7cx6-glibc-2.24/lib/libnss_dns.so.2"                          
 "/cvmfs/soft.computecanada.ca/nix/store/63pk88rnmkzjblpxydvrmskkc8ci7cx6-glibc-2.24/lib/libresolv.so.2"  

Stack corruption in flisp during precompile

Today seems not to be my day. On current Julia master, precompiling LLVM.jl fails with a stack corruption. Haven't had time to debug it.

julia> versioninfo()
Julia Version 1.1.0-DEV.631
Commit 0fde275eff* (2018-11-06 16:09 UTC)
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: Intel(R) Xeon(R) CPU E5-2603 v4 @ 1.70GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.0 (ORCJIT, broadwell)
julia> using LLVM
[ Info: Precompiling LLVM [929cbde3-209d-540e-8aea-75f648917ca0]
fatal error: stack corruption detected

signal (6): Aborted
in expression starting at /home/vchuravy/.julia/packages/LLVM/mcS4Y/src/LLVM.jl:21
__libc_signal_restore_set at /build/glibc-OTsEL5/glibc-2.27/signal/../sysdeps/unix/sysv/linux/nptl-signals.h:80 [inlined]
raise at /build/glibc-OTsEL5/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:48
abort at /build/glibc-OTsEL5/glibc-2.27/stdlib/abort.c:79
__stack_chk_fail at /home/vchuravy/julia/src/codegen.cpp:123
fl_accum_julia_symbol at /home/vchuravy/julia/src/flisp/julia_extensions.c:325
apply_cl at /home/vchuravy/julia/src/flisp/flisp.c:1226
do_trycatch at /home/vchuravy/julia/src/flisp/flisp.c:898
apply_cl at /home/vchuravy/julia/src/flisp/flisp.c:1806
do_trycatch at /home/vchuravy/julia/src/flisp/flisp.c:898
apply_cl at /home/vchuravy/julia/src/flisp/flisp.c:1806
do_trycatch at /home/vchuravy/julia/src/flisp/flisp.c:898
apply_cl at /home/vchuravy/julia/src/flisp/flisp.c:1806
do_trycatch at /home/vchuravy/julia/src/flisp/flisp.c:898
apply_cl at /home/vchuravy/julia/src/flisp/flisp.c:1806
do_trycatch at /home/vchuravy/julia/src/flisp/flisp.c:898
apply_cl at /home/vchuravy/julia/src/flisp/flisp.c:1806
do_trycatch at /home/vchuravy/julia/src/flisp/flisp.c:898
apply_cl at /home/vchuravy/julia/src/flisp/flisp.c:1806
_applyn at /home/vchuravy/julia/src/flisp/flisp.c:682
fl_applyn at /home/vchuravy/julia/src/flisp/flisp.c:722
jl_parse_eval_all at /home/vchuravy/julia/src/ast.c:837
jl_load at /home/vchuravy/julia/src/toplevel.c:826
include at ./boot.jl:317 [inlined]
include_relative at ./loading.jl:1038
include at ./sysimg.jl:29 [inlined]
include at /home/vchuravy/.julia/packages/LLVM/mcS4Y/src/LLVM.jl:17
jl_fptr_trampoline at /home/vchuravy/julia/src/gf.c:1854
jl_apply_generic at /home/vchuravy/julia/src/gf.c:2209
do_call at /home/vchuravy/julia/src/interpreter.c:323
eval_value at /home/vchuravy/julia/src/interpreter.c:411
eval_stmt_value at /home/vchuravy/julia/src/interpreter.c:362 [inlined]
eval_body at /home/vchuravy/julia/src/interpreter.c:773
jl_interpret_toplevel_thunk_callback at /home/vchuravy/julia/src/interpreter.c:885
unknown function (ip: 0xfffffffffffffffe)
unknown function (ip: 0x7f310256abcf)
unknown function (ip: (nil))
jl_interpret_toplevel_thunk at /home/vchuravy/julia/src/interpreter.c:894
jl_toplevel_eval_flex at /home/vchuravy/julia/src/toplevel.c:764
jl_eval_module_expr at /home/vchuravy/julia/src/toplevel.c:179
jl_toplevel_eval_flex at /home/vchuravy/julia/src/toplevel.c:614
jl_eval_module_expr at /home/vchuravy/julia/src/toplevel.c:179
jl_toplevel_eval_flex at /home/vchuravy/julia/src/toplevel.c:614
jl_parse_eval_all at /home/vchuravy/julia/src/ast.c:883
jl_load at /home/vchuravy/julia/src/toplevel.c:826
include at ./boot.jl:317 [inlined]
include_relative at ./loading.jl:1038
include at ./sysimg.jl:29
jl_apply_generic at /home/vchuravy/julia/src/gf.c:2209
do_call at /home/vchuravy/julia/src/interpreter.c:323
eval_value at /home/vchuravy/julia/src/interpreter.c:411
eval_stmt_value at /home/vchuravy/julia/src/interpreter.c:362 [inlined]
eval_body at /home/vchuravy/julia/src/interpreter.c:773
eval_body at /home/vchuravy/julia/src/interpreter.c:689
jl_interpret_toplevel_thunk_callback at /home/vchuravy/julia/src/interpreter.c:885
unknown function (ip: 0xfffffffffffffffe)
unknown function (ip: 0x7f3101ea7e3f)
unknown function (ip: 0x2)
jl_interpret_toplevel_thunk at /home/vchuravy/julia/src/interpreter.c:894
jl_toplevel_eval_flex at /home/vchuravy/julia/src/toplevel.c:764
jl_toplevel_eval_in at /home/vchuravy/julia/src/toplevel.c:793
eval at ./boot.jl:319 [inlined]
eval at ./client.jl:393
jl_apply_generic at /home/vchuravy/julia/src/gf.c:2209
top-level scope at ./none:3
jl_fptr_trampoline at /home/vchuravy/julia/src/gf.c:1854
jl_toplevel_eval_flex at /home/vchuravy/julia/src/toplevel.c:758
jl_toplevel_eval_in at /home/vchuravy/julia/src/toplevel.c:793
eval at ./boot.jl:319
jl_apply_generic at /home/vchuravy/julia/src/gf.c:2209
macro expansion at ./logging.jl:317 [inlined]
exec_options at ./client.jl:219
_start at ./client.jl:425
jl_apply_generic at /home/vchuravy/julia/src/gf.c:2209
jl_apply at /home/vchuravy/julia/ui/../src/julia.h:1571 [inlined]
true_main at /home/vchuravy/julia/ui/repl.c:96
main at /home/vchuravy/julia/ui/repl.c:217
__libc_start_main at /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:310
_start at /home/vchuravy/julia/usr/bin/julia (unknown line)
Allocations: 553273 (Pool: 553114; Big: 159); GC: 0
ERROR: Failed to precompile LLVM [929cbde3-209d-540e-8aea-75f648917ca0] to /home/vchuravy/.julia/compiled/v1.1/LLVM/e8NBy.ji.
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] macro expansion at ./logging.jl:311 [inlined]
 [3] compilecache(::Base.PkgId, ::String) at ./loading.jl:1184
 [4] _require(::Base.PkgId) at ./logging.jl:309
 [5] require(::Base.PkgId) at ./loading.jl:858
 [6] macro expansion at ./logging.jl:309 [inlined]
 [7] require(::Module, ::Symbol) at ./loading.jl:840

Regenerate wrappers

The current libllvm wrappers aren't autogenerated, but are a clean-up and hacked-up version of older wrappers I managed to generate with Clang.jl back in the days. Now that Clang.jl has been revamped and looks capable of wrapping libclang (JuliaInterop/Clang.jl#210), we should try to generate proper libllvm headers once again.

Segfault trying to run sum example twice

If I take the current code for the sum.jl example and try to run the last chunk twice, I reliably segfault.

using LLVM

if length(ARGS) == 2
    x, y = parse.([Int32], ARGS[1:2])
else
    x = Int32(1)
    y = Int32(2)
end

# set-up
mod = LLVM.Module("my_module")

param_types = [LLVM.Int32Type(), LLVM.Int32Type()]
ret_type = LLVM.Int32Type()
fun_type = LLVM.FunctionType(ret_type, param_types)
sum = LLVM.Function(mod, "sum", fun_type)

# generate IR
Builder() do builder
    entry = BasicBlock(sum, "entry")
    position!(builder, entry)

    tmp = add!(builder, parameters(sum)[1], parameters(sum)[2], "tmp")
    ret!(builder, tmp)

    println(mod)
    verify(mod)
end

# analysis and execution
Interpreter(mod) do engine
    args = [GenericValue(LLVM.Int32Type(), x),
            GenericValue(LLVM.Int32Type(), y)]

    res = LLVM.run(engine, sum, args)
    println(convert(Int, res))

    dispose.(args)
    dispose(res)
end

# analysis and execution
Interpreter(mod) do engine
    args = [GenericValue(LLVM.Int32Type(), x),
            GenericValue(LLVM.Int32Type(), y)]

    res = LLVM.run(engine, sum, args)
    println(convert(Int, res))

    dispose.(args)
    dispose(res)
end

As far as I can tell, having once interpreted mod, something is freed that makes mod poisonous to use again since just trying to evaluate mod before versus after the first interpretation also triggers the same segfault.

using LLVM

if length(ARGS) == 2
    x, y = parse.([Int32], ARGS[1:2])
else
    x = Int32(1)
    y = Int32(2)
end

# set-up
mod = LLVM.Module("my_module")

param_types = [LLVM.Int32Type(), LLVM.Int32Type()]
ret_type = LLVM.Int32Type()
fun_type = LLVM.FunctionType(ret_type, param_types)
sum = LLVM.Function(mod, "sum", fun_type)

# generate IR
Builder() do builder
    entry = BasicBlock(sum, "entry")
    position!(builder, entry)

    tmp = add!(builder, parameters(sum)[1], parameters(sum)[2], "tmp")
    ret!(builder, tmp)

    println(mod)
    verify(mod)
end

mod

# analysis and execution
Interpreter(mod) do engine
    args = [GenericValue(LLVM.Int32Type(), x),
            GenericValue(LLVM.Int32Type(), y)]

    res = LLVM.run(engine, sum, args)
    println(convert(Int, res))

    dispose.(args)
    dispose(res)
end

mod

Any thoughts on ways to make this safer?

Attributes are non-roundtrippable

julia> using LLVM

julia> ctx = Context()
Context(Ptr{LLVM.API.LLVMOpaqueContext} @0x0000000005f50170)

julia> mod = LLVM.Module("SomeModule", ctx)
; ModuleID = 'SomeModule'
source_filename = "SomeModule"


julia> ft = LLVM.FunctionType(LLVM.VoidType(ctx), [LLVM.PointerType(LLVM.Int32Type(ctx))])
void (i32*)

julia> fn = LLVM.Function(mod, "SomeFunction", ft)

declare void @SomeFunction(i32*)

julia> attrs = parameter_attributes(fn, 1)
LLVM.FunctionAttrSet(
declare void @SomeFunction(i32*)
, LLVM.API.UnknownMember)

julia> collect(attrs)
Attribute[]

julia> attr = EnumAttribute("byval")
EnumAttribute 6=0

julia> push!(attrs, attr)

julia> collect(attrs)
API.LLVMIsEnumAttribute(ref) = 0
ERROR: unknown attribute kind
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] Attribute(::Ptr{LLVM.API.LLVMOpaqueAttributeRef}) at /home/tim/Julia/pkg/LLVM/src/core/attributes.jl:30
 [3] collect(::LLVM.FunctionAttrSet) at /home/tim/Julia/pkg/LLVM/src/core/function.jl:56
 [4] top-level scope at REPL[15]:1

Maybe I misuse the API though, it's a confusing one.
Ref https://reviews.llvm.org/D19181

Inline Asm

Can an example using inline assembly be added?

Support for binary Julia distributions

Problem: LLVM.jl (and thus CUDAnative.jl) is not compatible with binary julia distributions, because building LLVM.jl's libLLVM-extra requires certain build artefacts (llvm-config, LLVM headers, etc) which aren't packaged.

Possible solutions:

  1. make the Julia buildbots package and deploy these build artefacts
  2. build libLLVM-extra as part of Julia, distributing the library or exposing the functions in libjulia

I'd rather not go for 2) because libLLVM-extra and LLVM.jl are tightly integrated and should advance in lockstep.

If we want to build libLLVM-extra during Pkg.build there's an additional problem: the toolchain should be compatible with the one libLLVM was built with (or there's ABI incompatibilities).
But that is being worked on, quoting @tkelman:

We will be working on making a buildbot-like generic binary build system easier to reproduce for packages anyway.

and

The toolchain will be identical if we standardize the way packages build binaries

cc @SimonDanisch
ref JuliaLang/julia#19302

Example of JIT'ing LLVM IR, then calling it

Hey there, I've been going over the examples provided here, and I think I understand the sum examples. I have recreated a simple add() function below:

using LLVM

ctx = Context()
llvm_mod = LLVM.Module("llvm_mod", ctx)
param_types = [LLVM.Int64Type(ctx), LLVM.Int64Type(ctx)]
add_func = LLVM.Function(llvm_mod, "add", LLVM.FunctionType(LLVM.Int64Type(ctx), param_types))

# Build LLVM IR for our `add(a, b)` function
Builder(ctx) do builder
    position!(builder, BasicBlock(add_func, "entry"))
    tmp = add!(builder, parameters(add_func)[1], parameters(add_func)[2], "tmp")
    ret!(builder, tmp)
    verify(llvm_mod)
end

# This results in the following LLVM IR, visible in the julia prompt via:
#
#   julia> llvm_mod
#   ; ModuleID = 'llvm_mod'
#   source_filename = "llvm_mod"
#
#   define i64 @add(i64, i64) {
#   entry:
#     %tmp = add i64 %0, %1
#     ret i64 %tmp
#   }

# Build julia wrapper to actually invoke this function
function run_add_func(a::Int64, b::Int64)
    sum = 0
    mod = LLVM.Module(llvm_mod)
    # Using JIT() instead of Interpreter() here doesn't work; I get random results
    Interpreter(mod) do engine
        fn = get(functions(mod), "add")
        args = [GenericValue(LLVM.Int64Type(ctx), a),
                GenericValue(LLVM.Int64Type(ctx), b)]
        res = LLVM.run(engine, fn, args)
        sum = convert(Int64, res)
        dispose(res)
   end
   return sum
end

Two questions:

  • This works as long as I use Interpreter(), but JIT() doesn't work; instead of returning the proper sum, I get returned a random constant.

  • Ideally, what I'd like to be able to do is to JIT the LLVM IR that I've built into a 1st-class Julia function that I am able to invoke directly. Is such a thing possible?

Idea: serialize llvmcall modules

Awaiting a new llvmcall, we could try and extend the Julia serializer to detect calls to llvmcall with pointer arguments, and serialize the LLVM module + function name.

llvm fails to build

windows 7 machine with julia 0.6.3

julia> Pkg.build("LLVM")
INFO: Building LLVM
==========================================[ ERROR: LLVM ]===========================================

LoadError: Unknown OS
while loading C:\Users\karaouli.julia\v0.6\LLVM\deps\build.jl, in expression starting on line 104

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

==========================================[ BUILD ERRORS ]==========================================

WARNING: LLVM had build errors.

  • packages with build errors remain installed in C:\Users\karaouli.julia\v0.6
  • build the package(s) and all dependencies with Pkg.build("LLVM")
  • build a single package by running its deps/build.jl script

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

Can't initialise Target for native triplet

using LLVM
# returns true if no native target present
@assert LLVM.InitializeNativeTarget() == false
tr = LLVM.triple()
t = LLVM.target(tr)

This used to work ~ a year ago, even without doing the actual initialisation.
Right now it fails (on my machine with)

ERROR: LLVM error: Unable to find target for this triple (no targets are registered)

Unknown OS

Tried to get CUDArt, CUDAdrv, CUDAnative to work. First it did not work because the drivers could not be found. Therefore i installed the latest version from github and updating my CUDA to 9.1. Now when trying to make the packages run it does not work since CUDAnative's requirement are not satisfied because of LLVM (tried v0.5.0 as well as v0.5.1). Currently running julia v0.6 on Windows 10.
After using the "Pkg.build("llvm")" command i get the following error:
error

Wrap LLVMBuildICmp

First of all, I want to say that I really appreciate this project. ;)

Your readme says that higher-level wrappers are added "as the need arises". So, my meta-issue would be whether you take requests on this and how those should be made.

Currently, I could really use the icmp instruction, since branching is kindof pointless without conditions.
If you do not have time for this, I'll take a look at the lower-level API.

Error building package without access to `/usr/local/sbin`

I'm not admin, and /usr/local/sbin is not readable for some reason.

julia> Pkg.build("LLVM")
INFO: Building LLVM
=======================================================================[ ERROR: LLVM ]========================================================================

LoadError: SystemError: unable to read directory /usr/local/sbin: Permission denied
while loading /gpfs22/home/dss/.julia/v0.6/LLVM/deps/build.jl, in expression starting on line 104

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

I don't grep any occurrences of "sbin" is the whole package, so not sure what's going on.

Instructions to build Julia with full LLVM

Would you mind giving some short instructions on how to build and install Julia including the full LLVM as it is required by the LLVM package?
I seem to fail this task on Linux (Ubuntu). After building Julia, there appears to be no llvm-config available... which unfortunately prevents me from playing with CUDAnative.
Many thanks!

LLVM loaderror : Unkonw OS

Hi, in a widows 7 64 bit machine, with julia 0.6.3, I cannot build llvm

INFO: Installing LLVM v0.5.1
INFO: Building LLVM
==========================================[ ERROR: LLVM ]===========================================

LoadError: Unknown OS
while loading C:\Users\karaouli.julia\v0.6\LLVM\deps\build.jl, in expression starting online 104

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

==========================================[ BUILD ERRORS ]==========================================

WARNING: LLVM had build errors.

  • packages with build errors remain installed in C:\Users\karaouli.julia\v0.6
  • build the package(s) and all dependencies with Pkg.build("LLVM")
  • build a single package by running its deps/build.jl script

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

error building

Julia Version 0.5.0
Commit 3c9d753 (2016-09-19 18:14 UTC)
Platform Info:
  System: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Core(TM) i7 CPU         870  @ 2.93GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Nehalem)
  LAPACK: libopenblas64_
  LIBM: libopenlibm
  LLVM: libLLVM-3.7.1 (ORCJIT, nehalem)

Output after running DEBUG=1 j5 build.jl --compilecache=no. j5 is the alias I have setup for julia-0.5.

DEBUG: Acceptable LLVM versions: 3.7.1, 3.8.0, 3.8.1, 3.9.0, 4.0.0
DEBUG: Searching for config binaries in /home/dom/github/julia-0.5/bin
DEBUG: Searching for config binaries in /home/dom/conda/bin
DEBUG: Searching for config binaries in /home/dom/.cargo/bin
DEBUG: Searching for config binaries in /home/dom/.nix-profile/bin
DEBUG: Searching for config binaries in /home/dom/bin
DEBUG: Searching for config binaries in /usr/local/sbin
DEBUG: Searching for config binaries in /usr/local/bin
DEBUG: Searching for config binaries in /usr/sbin
DEBUG: Searching for config binaries in /usr/bin
DEBUG: - found llvm-config at /usr/bin/llvm-config-3.9
DEBUG: Searching for libraries using /usr/bin/llvm-config-3.9
DEBUG: ... contains libraries in /usr/lib/llvm-3.9/lib
DEBUG: - found v3.9.0 at /usr/lib/llvm-3.9/lib/libLLVM-3.9.so
DEBUG: - found v3.9.0 at /usr/lib/llvm-3.9/lib/libLLVM-3.9.0.so
DEBUG: - found v3.9.0 at /usr/lib/llvm-3.9/lib/libLLVM.so
DEBUG: Searching for config binaries in /sbin
DEBUG: Searching for config binaries in /bin
DEBUG: Searching for config binaries in /usr/games
DEBUG: Searching for config binaries in /usr/local/games
DEBUG: Searching for config binaries in /home/dom/.fzf/bin
INFO: Found 3 LLVM installations, providing 1 different versions
rm -f libLLVM_extra.so ./Target.o ./Target/NVPTX.o ./Transforms/IPO.o ./IR/Pass.o ./IR/PassManager.o
g++ -I/usr/lib/llvm-3.9/include -std=c++0x -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wno-comment -std=c++11 -ffunction-sections -fdata-sections -O2 -g -DNDEBUG -fno-exceptions -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -fPIC -I/usr/lib/llvm-3.9/include   -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DTARGET_AARCH64 -DTARGET_AMDGPU -DTARGET_ARM -DTARGET_BPF -DTARGET_HEXAGON -DTARGET_MIPS -DTARGET_MSP430 -DTARGET_NVPTX -DTARGET_POWERPC -DTARGET_SPARC -DTARGET_SYSTEMZ -DTARGET_X86 -DTARGET_XCORE  -c -o Target.o Target.cpp
g++ -I/usr/lib/llvm-3.9/include -std=c++0x -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wno-comment -std=c++11 -ffunction-sections -fdata-sections -O2 -g -DNDEBUG -fno-exceptions -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -fPIC -I/usr/lib/llvm-3.9/include   -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DTARGET_AARCH64 -DTARGET_AMDGPU -DTARGET_ARM -DTARGET_BPF -DTARGET_HEXAGON -DTARGET_MIPS -DTARGET_MSP430 -DTARGET_NVPTX -DTARGET_POWERPC -DTARGET_SPARC -DTARGET_SYSTEMZ -DTARGET_X86 -DTARGET_XCORE  -c -o Target/NVPTX.o Target/NVPTX.cpp
g++ -I/usr/lib/llvm-3.9/include -std=c++0x -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wno-comment -std=c++11 -ffunction-sections -fdata-sections -O2 -g -DNDEBUG -fno-exceptions -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -fPIC -I/usr/lib/llvm-3.9/include   -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DTARGET_AARCH64 -DTARGET_AMDGPU -DTARGET_ARM -DTARGET_BPF -DTARGET_HEXAGON -DTARGET_MIPS -DTARGET_MSP430 -DTARGET_NVPTX -DTARGET_POWERPC -DTARGET_SPARC -DTARGET_SYSTEMZ -DTARGET_X86 -DTARGET_XCORE  -c -o Transforms/IPO.o Transforms/IPO.cpp
g++ -I/usr/lib/llvm-3.9/include -std=c++0x -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wno-comment -std=c++11 -ffunction-sections -fdata-sections -O2 -g -DNDEBUG -fno-exceptions -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -fPIC -I/usr/lib/llvm-3.9/include   -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DTARGET_AARCH64 -DTARGET_AMDGPU -DTARGET_ARM -DTARGET_BPF -DTARGET_HEXAGON -DTARGET_MIPS -DTARGET_MSP430 -DTARGET_NVPTX -DTARGET_POWERPC -DTARGET_SPARC -DTARGET_SYSTEMZ -DTARGET_X86 -DTARGET_XCORE  -c -o IR/Pass.o IR/Pass.cpp
g++ -I/usr/lib/llvm-3.9/include -std=c++0x -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wno-comment -std=c++11 -ffunction-sections -fdata-sections -O2 -g -DNDEBUG -fno-exceptions -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -fPIC -I/usr/lib/llvm-3.9/include   -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DTARGET_AARCH64 -DTARGET_AMDGPU -DTARGET_ARM -DTARGET_BPF -DTARGET_HEXAGON -DTARGET_MIPS -DTARGET_MSP430 -DTARGET_NVPTX -DTARGET_POWERPC -DTARGET_SPARC -DTARGET_SYSTEMZ -DTARGET_X86 -DTARGET_XCORE  -c -o IR/PassManager.o IR/PassManager.cpp
g++ -I/usr/lib/llvm-3.9/include -std=c++0x -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wno-comment -std=c++11 -ffunction-sections -fdata-sections -O2 -g -DNDEBUG -fno-exceptions -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -fPIC -I/usr/lib/llvm-3.9/include   -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DTARGET_AARCH64 -DTARGET_AMDGPU -DTARGET_ARM -DTARGET_BPF -DTARGET_HEXAGON -DTARGET_MIPS -DTARGET_MSP430 -DTARGET_NVPTX -DTARGET_POWERPC -DTARGET_SPARC -DTARGET_SYSTEMZ -DTARGET_X86 -DTARGET_XCORE -L/usr/lib/llvm-3.9/lib  -Wl,-z,defs "-Wl,-rpath,/usr/lib/llvm-3.9/lib"  -shared Target.o Target/NVPTX.o Transforms/IPO.o IR/Pass.o IR/PassManager.o -L/usr/lib/llvm-3.9/lib  -Wl,-z,defs "-Wl,-rpath,/usr/lib/llvm-3.9/lib" -lLLVM -lrt -ldl -ltinfo -lpthread -lz -lm -o libLLVM_extra.so
IR/Pass.o:(.data.rel.ro._ZTVN4llvm15JuliaModulePassE[_ZTVN4llvm15JuliaModulePassE]+0x40): undefined reference to `llvm::ModulePass::createPrinterPass(llvm::raw_ostream&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
IR/Pass.o:(.data.rel.ro._ZTVN4llvm17JuliaFunctionPassE[_ZTVN4llvm17JuliaFunctionPassE]+0x40): undefined reference to `llvm::FunctionPass::createPrinterPass(llvm::raw_ostream&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
IR/Pass.o:(.data.rel.ro._ZTVN4llvm19JuliaBasicBlockPassE[_ZTVN4llvm19JuliaBasicBlockPassE]+0x40): undefined reference to `llvm::BasicBlockPass::createPrinterPass(llvm::raw_ostream&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
collect2: error: ld returned 1 exit status
Makefile:34: recipe for target 'libLLVM_extra.so' failed
make: *** [libLLVM_extra.so] Error 1
ERROR: LoadError: failed process: Process(`make -j9`, ProcessExited(2)) [2]
 in pipeline_error(::Base.Process) at ./process.jl:616
 in run at ./process.jl:592 [inlined]
 in (::##28#30)() at /home/dom/.julia/v0.5/LLVM/deps/build.jl:167
 in withenv(::##28#30, ::Pair{String,String}, ::Vararg{Pair{String,String},N}) at ./env.jl:153
 in cd(::##27#29, ::String) at ./file.jl:59
 in include_from_node1(::String) at ./loading.jl:488
 in process_options(::Base.JLOptions) at ./client.jl:262
 in _start() at ./client.jl:318
while loading /home/dom/.julia/v0.5/LLVM/deps/build.jl, in expression starting on line 163

On a sort of related note I'm planning to experiment with CUDAnative so should I use the julia from JuliaGPU org?

llvm-extra depends on zlib-dev

Hello, i'm trying to install https://github.com/JuliaGPU/CUDAnative.jl and need this package, but i get the error below. To LLVM i used http://apt.llvm.org/ ( apt-get install clang-3.9 clang-3.9-doc libclang-common-3.9-dev libclang-3.9-dev libclang1-3.9 libclang1-3.9-dbg libllvm-3.9-ocaml-dev libllvm3.9 libllvm3.9-dbg lldb-3.9 llvm-3.9 llvm-3.9-dev llvm-3.9-doc llvm-3.9-examples llvm-3.9-runtime clang-format-3.9 python-clang-3.9 lldb-3.9-dev liblldb-3.9-dbg ).

Ubuntu 16.04.1
Julia Nightly

julia> Pkg.build("LLVM")
INFO: Building LLVM
DEBUG: Acceptable LLVM versions: 3.7.1, 3.8.0, 3.8.1, 3.9.0, 4.0.0, 3.9.0
DEBUG: Searching for config binaries in /usr/bin
DEBUG: - found llvm-config at /usr/bin/llvm-config-3.9
DEBUG: Searching for libraries using /usr/bin/llvm-config-3.9
DEBUG: ... contains libraries in /usr/lib/llvm-3.9/lib
DEBUG: - found v3.9.0 at /usr/lib/llvm-3.9/lib/libLLVM-3.9.so
DEBUG: - found v3.9.0 at /usr/lib/llvm-3.9/lib/libLLVM.so
DEBUG: Searching for config binaries in /usr/local/sbin
DEBUG: Searching for config binaries in /usr/local/bin
DEBUG: Searching for config binaries in /usr/sbin
DEBUG: Searching for config binaries in /sbin
DEBUG: Searching for config binaries in /bin
INFO: Found 2 LLVM installations, providing 1 different versions
INFO: Overriding selection to match v3.9.0
rm -f libLLVM_extra.so ./Transforms/IPO.o ./Target.o ./Target/NVPTX.o
g++ -I/usr/lib/llvm-3.9/include -std=c++0x -gsplit-dwarf -Wl,-fuse-ld=gold -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wno-comment -Werror=date-time -std=c++11 -ffunction-sections -fdata-sections -O2 -g -DNDEBUG -fno-exceptions -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -fPIC -I/usr/lib/llvm-3.9/include   -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DTARGET_AARCH64 -DTARGET_AMDGPU -DTARGET_ARM -DTARGET_BPF -DTARGET_HEXAGON -DTARGET_MIPS -DTARGET_MSP430 -DTARGET_NVPTX -DTARGET_POWERPC -DTARGET_SPARC -DTARGET_SYSTEMZ -DTARGET_X86 -DTARGET_XCORE -D_GLIBCXX_USE_CXX11_ABI=1  -c -o Transforms/IPO.o Transforms/IPO.cpp
g++ -I/usr/lib/llvm-3.9/include -std=c++0x -gsplit-dwarf -Wl,-fuse-ld=gold -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wno-comment -Werror=date-time -std=c++11 -ffunction-sections -fdata-sections -O2 -g -DNDEBUG -fno-exceptions -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -fPIC -I/usr/lib/llvm-3.9/include   -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DTARGET_AARCH64 -DTARGET_AMDGPU -DTARGET_ARM -DTARGET_BPF -DTARGET_HEXAGON -DTARGET_MIPS -DTARGET_MSP430 -DTARGET_NVPTX -DTARGET_POWERPC -DTARGET_SPARC -DTARGET_SYSTEMZ -DTARGET_X86 -DTARGET_XCORE -D_GLIBCXX_USE_CXX11_ABI=1  -c -o Target.o Target.cpp
g++ -I/usr/lib/llvm-3.9/include -std=c++0x -gsplit-dwarf -Wl,-fuse-ld=gold -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wno-comment -Werror=date-time -std=c++11 -ffunction-sections -fdata-sections -O2 -g -DNDEBUG -fno-exceptions -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -fPIC -I/usr/lib/llvm-3.9/include   -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DTARGET_AARCH64 -DTARGET_AMDGPU -DTARGET_ARM -DTARGET_BPF -DTARGET_HEXAGON -DTARGET_MIPS -DTARGET_MSP430 -DTARGET_NVPTX -DTARGET_POWERPC -DTARGET_SPARC -DTARGET_SYSTEMZ -DTARGET_X86 -DTARGET_XCORE -D_GLIBCXX_USE_CXX11_ABI=1  -c -o Target/NVPTX.o Target/NVPTX.cpp
g++ -I/usr/lib/llvm-3.9/include -std=c++0x -gsplit-dwarf -Wl,-fuse-ld=gold -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wno-comment -Werror=date-time -std=c++11 -ffunction-sections -fdata-sections -O2 -g -DNDEBUG -fno-exceptions -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -fPIC -I/usr/lib/llvm-3.9/include   -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DTARGET_AARCH64 -DTARGET_AMDGPU -DTARGET_ARM -DTARGET_BPF -DTARGET_HEXAGON -DTARGET_MIPS -DTARGET_MSP430 -DTARGET_NVPTX -DTARGET_POWERPC -DTARGET_SPARC -DTARGET_SYSTEMZ -DTARGET_X86 -DTARGET_XCORE -D_GLIBCXX_USE_CXX11_ABI=1 -L/usr/lib/llvm-3.9/lib  -Wl,-z,defs "-Wl,-rpath,/usr/lib/llvm-3.9/lib"  -shared Transforms/IPO.o Target.o Target/NVPTX.o -L/usr/lib/llvm-3.9/lib  -Wl,-z,defs "-Wl,-rpath,/usr/lib/llvm-3.9/lib" -lLLVM -lrt -ldl -ltinfo -lpthread -lz -lm -o libLLVM_extra.so
/usr/bin/ld.gold: error: cannot find -lz
collect2: error: ld returned 1 exit status
Makefile:48: recipe for target 'libLLVM_extra.so' failed
make: *** [libLLVM_extra.so] Error 1
==============================================================================[ ERROR: LLVM ]==============================================================================

LoadError: failed process: Process(`make -j9`, ProcessExited(2)) [2]
while loading /home/xxx/.julia/v0.6/LLVM/deps/build.jl, in expression starting on line 163

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

=============================================================================[ BUILD ERRORS ]==============================================================================

WARNING: LLVM had build errors.

 - packages with build errors remain installed in /home/xxx/.julia/v0.6
 - build the package(s) and all dependencies with `Pkg.build("LLVM")`
 - build a single package by running its `deps/build.jl` script

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

JuliaPro 0.6.1 build failure on window7 x86_64

julia> Pkg.update()
INFO: Updating METADATA...
INFO: Updating cache of BinDeps...
INFO: Updating cache of URIParser...
INFO: Updating cache of JSON...
WARNING: Package MatlabCompat: skipping update (dirty)...
WARNING: Package MathGL: skipping update (dirty)...
INFO: Updating PETSc master...
INFO: Updating AbstractNumbers master...
INFO: Updating PackageCompiler master...
WARNING: Package Trilinos: skipping update (dirty)...
INFO: Computing changes...
INFO: Downgrading LLVM: v0.9.3 => v0.5.1
INFO: Building LLVM

=====[ ERROR: LLVM ]=======
LoadError: Unknown OS
while loading C:\JuliaPro-0.6.1.1\pkgs-0.6.1.1\v0.6\LLVM\deps\build.jl, in expre
ssion starting on line 104

======[ BUILD ERRORS ]=====
WARNING: LLVM had build errors.

 - packages with build errors remain installed in C:\JuliaPro-0.6.1.1\pkgs-0.6.1.1\v0.6
 - build the package(s) and all dependencies with `Pkg.build("LLVM")`
 - build a single package by running its `deps/build.jl` script

LLVM.dylib not found on macOS master

macmini:Julia julia$ ./julia-1.0.1-bin/bin/julia -e "using InteractiveUtils; versioninfo(); using Libdl; println(filter(x -> occursin(\"LLVM\", x), Libdl.dllist()))"
Julia Version 1.0.1
Commit 0d713926f8 (2018-09-29 19:05 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin14.5.0)
  CPU: Intel(R) Core(TM) i5-4308U CPU @ 2.80GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.0 (ORCJIT, haswell)
AbstractString["/Users/julia/Julia/julia-1.0.1-bin/lib/julia//libLLVM.dylib"]
macmini:Julia julia$ ./julia-dev-bin/bin/julia -e "using InteractiveUtils; versioninfo(); using Libdl; println(filter(x -> occursin(\"LLVM\", x), Libdl.dllist()))"
Julia Version 1.1.0-DEV.646
Commit 648c3690a5 (2018-11-09 07:15 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin14.5.0)
  CPU: Intel(R) Core(TM) i5-4308U CPU @ 2.80GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.1 (ORCJIT, haswell)
AbstractString[]
macmini:Julia julia$ find julia-*-bin | grep LLVM.dylib
julia-1.0.1-bin/lib/julia/libLLVM.dylib
julia-dev-bin/lib/julia/libLLVM.dylib

Target(triple()) issue

I'm getting the following with Julia v0.7 alpha and master of LLVM.jl:

julia> Target(triple())
ERROR: LLVM error: Unable to find target for this triple (no targets are registered)
Stacktrace:
 [1] Target(::String) at /home/tshort/.julia/dev/LLVM/src/target.jl:20
 [2] top-level scope

triple() is "x86_64-unknown-linux-gnu".

It worked last week (I think). I don't see any recent commits that might affect this.

LLVM LoadError: Permission Denied (EACCES)

Hi,
I am using Julia on a cluster. But I am having error from LLVM. Here is the steps I took and the error message:

$./julia
   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: https://docs.julialang.org
   _ _   _| |_  __ _   |  Type "?help" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.6.2 (2017-12-13 18:08 UTC)
 _/ |\__'_|_|_|\__'_|  |
|__/                   |  x86_64-redhat-linux

julia> Pkg.add("CuArrays")
...
#Cloning to Packages' Repo
#Installing Packages 
...
INFO: Building CUDAdrv
INFO: Building LLVM
=======================================================================[ ERROR: LLVM ]========================================================================

LoadError: stat: permission denied (EACCES)
while loading  /home/xiaoqihu/.julia/v0.6/LLVM/deps/build.jl, in expression starting on line 104

==============================================================================================================================================================
INFO: Building CUDAnative
WARNING: LLVM.jl has not been configured, and will not work properly.
WARNING: Please run Pkg.build("LLVM") and restart Julia.
====================================================================[ ERROR: CUDAnative ]=====================================================================

LoadError: UndefVarError: libllvm_system not defined
while loading  /home/xiaoqihu/.julia/v0.6/CUDAnative/deps/build.jl, in expression starting on line 153

==============================================================================================================================================================
INFO: Building SpecialFunctions
INFO: Building CuArrays
WARNING: could not find CUDNN, its functionality will be unavailable

=======================================================================[ BUILD ERRORS ]=======================================================================

WARNING: CUDAnative and LLVM had build errors.

 - packages with build errors remain installed in  /home/xiaoqihu/.julia/v0.6
 - build the package(s) and all dependencies with `Pkg.build("CUDAnative", "LLVM")`
 - build a single package by running its `deps/build.jl` script

==============================================================================================================================================================
INFO: Package database updated

julia> exit()

Here is the output for versioninfo():

julia> versioninfo()
Julia Version 0.6.2
Commit d386e40* (2017-12-13 18:08 UTC)
Platform Info:
  OS: Linux (x86_64-redhat-linux)
  CPU: Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell)
  LAPACK: libopenblas64_
  LIBM: libopenlibm
  LLVM: libLLVM-3.9.1 (ORCJIT, skylake-avx512)

Here is backtrace:

$ ./julia ~/.julia/v0.6/LLVM/deps/build.jl
ERROR: LoadError: stat: permission denied (EACCES)
Stacktrace:
 [1] stat(::SubString{String}) at ./stat.jl:69
 [2] isdir at ./stat.jl:279 [inlined]
 [3] discover_llvm(::Array{Any,1}, ::Array{SubString{String},1}) at /home/xiaoqihu/.julia/v0.6/LLVM/deps/discover.jl:75
 [4] discover_llvm() at /home/xiaoqihu/.julia/v0.6/LLVM/deps/discover.jl:107
 [5] main() at /home/xiaoqihu/.julia/v0.6/LLVM/deps/build.jl:16
 [6] include_from_node1(::String) at ./loading.jl:576
 [7] include(::String) at ./sysimg.jl:14
 [8] process_options(::Base.JLOptions) at ./client.jl:305
 [9] _start() at ./client.jl:371
while loading /home/xiaoqihu/.julia/v0.6/LLVM/deps/build.jl, in expression starting on line 104

julia_type_to_llvm is renamed

Just a heads up:

julia> convert(LLVMType, Int32)
ERROR: could not load symbol "julia_type_to_llvm":
./julia: undefined symbol: julia_type_to_llvm
Stacktrace:
 [1] convert at /home/tfaingna/.julia/packages/LLVM/5Ogv5/src/interop/base.jl:74 [inlined]
 [2] convert(::Type{LLVMType}, ::Type{T} where T) at /home/tfaingna/.julia/packages/LLVM/5Ogv5/src/interop/base.jl:73
 [3] top-level scope at REPL[2]:1

JuliaLang/julia#25984 renamed julia_type_to_llvm to jl_type_to_llvm, so this needs to be changed in interop/base.jl

LLVM will not build on macOS High Sierra with Julia 0.6.3

I get this when trying to build the LLVM package.

julia> Pkg.build("LLVM")
INFO: Building LLVM
==================================================[ ERROR: LLVM ]==================================================

LoadError: could not find LLVM installation providing llvm-config
while loading /Users/johannesblaschke/.julia/v0.6/LLVM/deps/build.jl, in expression starting on line 104

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

=================================================[ BUILD ERRORS ]==================================================

WARNING: LLVM had build errors.

 - packages with build errors remain installed in /Users/johannesblaschke/.julia/v0.6
 - build the package(s) and all dependencies with `Pkg.build("LLVM")`
 - build a single package by running its `deps/build.jl` script

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

I have llvm installed and it is in my PATH:

julia> ENV["PATH"]
"/Applications/Julia-0.6.app/Contents/Resources/julia/bin:/usr/local/opt/llvm/bin:/Users/johannesblaschke/.fzf/bin:/Users/johannesblaschke/local/virtualenv/py3/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/TeX/texbin"

I tried digging into how LLVM finds the llvm install, but I cannot figure out why it's not detecting my llvm install.

Error building LLVM on Fedora 26

It is finding the libraries, but there seems to be a bug in the selection code. There is a llvm-config binary installed. Here is the debugging output:

julia> Pkg.build("LLVM")
INFO: Building LLVM
DEBUG: Performing package build for LLVM.jl from /home/jgf/.julia/v0.6/LLVM/deps
DEBUG: Discovering LLVM libraries in /usr/bin/../lib/julia, and configs in /usr/bin, /usr/bin/../tools
DEBUG: Discovered LLVM toolchains: 4.0.1 at /usr/lib64/libLLVM-4.0.1.so
DEBUG: Discovering LLVM libraries in , and configs in /usr/lib64/qt-3.3/bin, /usr/lib64/ccache, /usr/local/bin, /usr/local/sbin, /usr/bin, /usr/sbin, /usr/libexec/sdcc, /home/jgf/.local/bin, /home/jgf/bin, /usr/libexec/sdcc
DEBUG: Discovered LLVM toolchains: 4.0.1 at /usr/lib64/libLLVM-4.0.1.so
DEBUG: Selecting LLVM from libraries 4.0.1 at /usr/lib64/libLLVM-4.0.1.so (bundled: true), 4.0.1 at /usr/lib64/libLLVM-4.0.1.so (bundled: false) and wrappers 3.9.0, 4.0.0
================================================================================[ ERROR: LLVM ]=================================================================================

LoadError: could not find LLVM installation providing llvm-config
while loading /home/jgf/.julia/v0.6/LLVM/deps/build.jl, in expression starting on line 104

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

================================================================================[ BUILD ERRORS ]================================================================================

WARNING: LLVM had build errors.

 - packages with build errors remain installed in /home/jgf/.julia/v0.6
 - build the package(s) and all dependencies with `Pkg.build("LLVM")`
 - build a single package by running its `deps/build.jl` script

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

unlink (rm) error during LLVM initialization

I'm trying to use CuArrays on a worker process on a gpu node of a cluster. If I ssh onto the node, fire up a REPL and call using CuArrays everything works fine. However, when I try the same using a worker (distributed computing facilities) on the same node I get an unlink error from the rm(cachefile) in the LLVM init.

Note that watching the worker process with htop I see that the virtual memory consumption shoots up to ~17 GB.

Any ideas on how to fix this?

Please excuse if this issue is better filed over at CuArrays.jl or elsewhere.

using Distributed
addprocs([("myuser@gpunode", 1)]; exename=`/path/to/my/julia/bin`, exeflags=`--project=/my/project`, dir="/my/project", tunnel=true)
@everywhere using CuArrays
On worker 3:
InitError: IOError: unlink: no such file or directory (ENOENT)
uv_error at ./libuv.jl:97 [inlined]
unlink at ./file.jl:781
#rm#9 at ./file.jl:261
rm at ./file.jl:253 [inlined]
__init__ at /projects/ag-trebst/bauer/.julia/packages/LLVM/DAnFH/src/LLVM.jl:144
_include_from_serialized at ./loading.jl:692
_require_search_from_serialized at ./loading.jl:776
_tryrequire_from_serialized at ./loading.jl:707
_require_search_from_serialized at ./loading.jl:765
_tryrequire_from_serialized at ./loading.jl:707
_require_search_from_serialized at ./loading.jl:765
_require at ./loading.jl:1001
require at ./loading.jl:922
#1 at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.3/Distributed/src/Distributed.jl:78
#105 at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.3/Distributed/src/process_messages.jl:290
run_work_thunk at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.3/Distributed/src/process_messages.jl:79
run_work_thunk at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.3/Distributed/src/process_messages.jl:88
#98 at ./task.jl:333
during initialization of module LLVM

Stacktrace:
 [1] sync_end(::Array{Any,1}) at .\task.jl:300
 [2] _require_callback(::Base.PkgId) at .\task.jl:319
 [3] #invokelatest#1 at .\essentials.jl:709 [inlined]
 [4] invokelatest at .\essentials.jl:708 [inlined]
 [5] require(::Base.PkgId) at .\loading.jl:925
 [6] require(::Module, ::Symbol) at .\loading.jl:917
 [7] top-level scope at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.3\Distributed\src\macros.jl:199
 [8] top-level scope at In[5]:1

      From worker 3:	
      From worker 3:	signal (15): Terminated
      From worker 3:	in expression starting at none:0
      From worker 3:	epoll_pwait at /lib64/libc.so.6 (unknown line)
      From worker 3:	uv__io_poll at /workspace/srcdir/libuv/src/unix/linux-core.c:270
      From worker 3:	uv_run at /workspace/srcdir/libuv/src/unix/core.c:359
      From worker 3:	jl_task_get_next at /buildworker/worker/package_linux64/build/src/partr.c:448
      From worker 3:	poptaskref at ./task.jl:660
      From worker 3:	wait at ./task.jl:667
      From worker 3:	task_done_hook at ./task.jl:401
      From worker 3:	_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2135 [inlined]
      From worker 3:	jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2305
      From worker 3:	jl_apply at /buildworker/worker/package_linux64/build/src/julia.h:1631 [inlined]
      From worker 3:	jl_finish_task at /buildworker/worker/package_linux64/build/src/task.c:181
      From worker 3:	start_task at /buildworker/worker/package_linux64/build/src/task.c:669
      From worker 3:	unknown function (ip: 0xffffffffffffffff)
      From worker 3:	unknown function (ip: 0xffffffffffffffff)
      From worker 3:	Allocations: 4232611 (Pool: 4231742; Big: 869); GC: 5

Better support for intrinsics

I seem to have lost my branch that added better support for working with intrinsics.
The important quality of life improvement would be to select and intrinsic based on its signature and the prefix instead of having to provide the fqn.

The intrinsics is called "llvm.experimental.constrained.fadd", but in order to get the right "overload" one needs to use "llvm.experimental.constrained.fadd.f64"

The C++ API exposes:

ID llvm::Function::lookupIntrinsicID(StringRef Name);
Function* llvm::Intrinsic::getDeclaration(Module, ID, Typs)

cc: @miguelraz, who is going to run into this while looking into SIMD.jl

ISEL failure on Travis macOS during Kaleidoscope tests

loops: Error During Test at /Users/travis/build/maleadt/LLVM.jl/test/Kaleidoscope.jl:27
  Got exception LLVMException("Cannot select: 0x7fc8073f98e8: ch,glue = X86ISD::CALL 0x7fc8073f9d60, 0x7fc8073f96e0, Register:f64 %xmm0, RegisterMask:Untyped, 0x7fc8073f9d60:1\n  0x7fc8073f96e0: i32 = X86ISD::Wrapper TargetGlobalAddress:i32<double (double)* @fib> 0\n    0x7fc8073f9470: i32 = TargetGlobalAddress<double (double)* @fib> 0\n  0x7fc8073f9c28: f64 = Register %xmm0\n  0x7fc8073f9b58: Untyped = RegisterMask\n  0x7fc8073f9d60: ch,glue = CopyToReg 0x7fc8073f9af0, Register:f64 %xmm0, 0x7fc8073f9408\n    0x7fc8073f9c28: f64 = Register %xmm0\n    0x7fc8073f9408: f64,ch = load<LD8[ConstantPool]> 0x7fc806ab6260, 0x7fc8073f9540, undef:i32\n      0x7fc8073f9540: i32 = X86ISD::Wrapper TargetConstantPool:i32<double 1.000000e+01> 0\n        0x7fc8073f9a88: i32 = TargetConstantPool<double 1.000000e+01> 0\n      0x7fc8073f9338: i32 = undef\nIn function: entry") outside of a @test
  LLVM error: Cannot select: 0x7fc8073f98e8: ch,glue = X86ISD::CALL 0x7fc8073f9d60, 0x7fc8073f96e0, Register:f64 %xmm0, RegisterMask:Untyped, 0x7fc8073f9d60:1
    0x7fc8073f96e0: i32 = X86ISD::Wrapper TargetGlobalAddress:i32<double (double)* @fib> 0
      0x7fc8073f9470: i32 = TargetGlobalAddress<double (double)* @fib> 0
    0x7fc8073f9c28: f64 = Register %xmm0
    0x7fc8073f9b58: Untyped = RegisterMask
    0x7fc8073f9d60: ch,glue = CopyToReg 0x7fc8073f9af0, Register:f64 %xmm0, 0x7fc8073f9408
      0x7fc8073f9c28: f64 = Register %xmm0
      0x7fc8073f9408: f64,ch = load<LD8[ConstantPool]> 0x7fc806ab6260, 0x7fc8073f9540, undef:i32
        0x7fc8073f9540: i32 = X86ISD::Wrapper TargetConstantPool:i32<double 1.000000e+01> 0
          0x7fc8073f9a88: i32 = TargetConstantPool<double 1.000000e+01> 0
        0x7fc8073f9338: i32 = undef
  In function: entry
  Stacktrace:
   [1] handle_error(::Cstring) at /Users/travis/build/maleadt/LLVM.jl/src/core/context.jl:103
   [2] macro expansion at /Users/travis/build/maleadt/LLVM.jl/src/base.jl:18 [inlined]
   [3] LLVMRunFunction at /Users/travis/build/maleadt/LLVM.jl/lib/6.0/libLLVM_h.jl:2829 [inlined]
   [4] run(::ExecutionEngine, ::LLVM.Function, ::Array{GenericValue,1}) at /Users/travis/build/maleadt/LLVM.jl/src/execution.jl:130 (repeats 2 times)
   [5] (::getfield(Main.Kaleidoscope, Symbol("##20#21")){String})(::ExecutionEngine) at /Users/travis/build/maleadt/LLVM.jl/examples/Kaleidoscope/run.jl:37
   [6] JIT(::getfield(Main.Kaleidoscope, Symbol("##20#21")){String}, ::LLVM.Module) at /Users/travis/build/maleadt/LLVM.jl/src/execution.jl:114
   [7] run at /Users/travis/build/maleadt/LLVM.jl/examples/Kaleidoscope/run.jl:32 [inlined]
   [8] (::getfield(Main, Symbol("##270#274")))(::Context) at /Users/travis/build/maleadt/LLVM.jl/test/Kaleidoscope.jl:50
   [9] Context(::getfield(Main, Symbol("##270#274"))) at /Users/travis/build/maleadt/LLVM.jl/src/core/context.jl:21
   [10] macro expansion at /Users/travis/build/maleadt/LLVM.jl/test/Kaleidoscope.jl:28 [inlined]
   [11] macro expansion at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v0.7/Test/src/Test.jl:1080 [inlined]
   [12] macro expansion at /Users/travis/build/maleadt/LLVM.jl/test/Kaleidoscope.jl:6 [inlined]
   [13] macro expansion at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v0.7/Test/src/Test.jl:1080 [inlined]
   [14] top-level scope at /Users/travis/build/maleadt/LLVM.jl/test/Kaleidoscope.jl:3 [inlined]
   [15] top-level scope at ./<missing>:0
   [16] include at ./boot.jl:317 [inlined]
   [17] include_relative(::Module, ::String) at ./loading.jl:1075
   [18] include(::Module, ::String) at ./sysimg.jl:29
   [19] include(::String) at ./client.jl:393
   [20] macro expansion at /Users/travis/build/maleadt/LLVM.jl/test/runtests.jl:11 [inlined]
   [21] macro expansion at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v0.7/Test/src/Test.jl:1080 [inlined]
   [22] top-level scope at /Users/travis/build/maleadt/LLVM.jl/test/runtests.jl:8 [inlined]
   [23] top-level scope at ./<missing>:0
   [24] include at ./boot.jl:317 [inlined]
   [25] include_relative(::Module, ::String) at ./loading.jl:1075
   [26] include(::Module, ::String) at ./sysimg.jl:29
   [27] include(::String) at ./client.jl:393
   [28] top-level scope at none:0
   [29] eval(::Module, ::Any) at ./boot.jl:319
   [30] exec_options(::Base.JLOptions) at ./client.jl:243
   [31] _start() at ./client.jl:427

LoadError: could not find LLVM installation providing llvm-config

I run Pkg.update() and got the error message below. Ubuntu 16.04, versioninfo at bottom.

INFO: Installing LLVM v0.5.2
INFO: Building LLVM
==================================================[ ERROR: LLVM ]==================================================

LoadError: could not find LLVM installation providing llvm-config
while loading /home/kjwiik/.julia/v0.6/LLVM/deps/build.jl, in expression starting on line 104

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

=================================================[ BUILD ERRORS ]==================================================

WARNING: LLVM had build errors.

 - packages with build errors remain installed in /home/kjwiik/.julia/v0.6
 - build the package(s) and all dependencies with `Pkg.build("LLVM")`
 - build a single package by running its `deps/build.jl` script

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

julia> versioninfo()
Julia Version 0.6.2
Commit d386e40c17 (2017-12-13 18:08 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Core(TM) i7-2860QM CPU @ 2.50GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Sandybridge)
  LAPACK: libopenblas64_
  LIBM: libopenlibm
  LLVM: libLLVM-3.9.1 (ORCJIT, sandybridge)

LLVM backend implemented in Julia?

My background is not in compilers, so I apologize if I miss something obvious.

The last few days, I have been toying with the idea of generating code from Julia for the HP42s calculator (which has an assembly-like programming language). What I mean is, given this simple lambda function: x -> 2x, using code_llvm I get this LLVM IR

define i64 @"julia_#119_63406"(i64) #0 !dbg !5 {
top:
  %1 = shl i64 %0, 1
  ret i64 %1
}

which could be translated to the HP42s language as a combination of ROTXY and some bit masking (A list of instructions available can be found here: http://www.thomasokken.com/free42/42s.pdf).

From the IR, an LLVM module can be created as m = parse(LLVM.Module, ir), and it is easy to generate an object file for the host platform (as found in the examples):

function write_objectfile(m::LLVM.Module, path::String,
                          host_triple = LLVM.triple())
    host_t = LLVM.Target(host_triple)
    LLVM.TargetMachine(host_t, host_triple) do tm
        LLVM.emit(tm, m, LLVM.API.LLVMObjectFile, path)
    end
end

However, creating a new LLVM backend does not seem to be exactly trivial, and requires recompiling LLVM, as well as maintaining my own fork (it did not seem to me as if I could simply link my assembler to LLVM libraries).

My question is, would it be possible to do this from Julia, using LLVM.jl in some fashion?

The other option would be to roll-your-own IR parser, which I think could more of a hassle to get right. Beside, I think it would be neat to target a new platform by simply including a Julia package! Any thoughts?

LoadError: Multiple LLVM libraries loaded by Julia

From old issues I guess this has been seen in different contexts already. I'm a distro packager myself, but fairly new to Julia, so right now at loss to puzzle out what is wrong.
I can't see any libLLVM* that is present double. And the test in .julia/packages/LLVM/wQgrk/src/LLVM.jl does not immediately make sense to me since there is clearly more than one libLLVM* library in the system...

Any advice is appreciated!

Gentoo Linux, Julia 1.4

(@v1.4) pkg> build
   Building VectorizationBase → `~/.julia/packages/VectorizationBase/dlopt/deps/build.log`
┌ Error: Error building `VectorizationBase`: 
│ ERROR: LoadError: Multiple LLVM libraries loaded by Julia.
│ Please file an issue and attach the output of `Libdl.dllist()`.

julia> show(stdout, "text/plain", dllist())
82-element Array{String,1}:
 "linux-vdso.so.1"
 "/usr/bin/../lib64/libjulia.so.1"
 "/lib64/libdl.so.2"
 "/lib64/librt.so.1"
 "/lib64/libpthread.so.0"
 "/lib64/libc.so.6"
 "/usr/lib/llvm/9/lib64/libLLVMOrcJIT.so.9"
 "/usr/lib/llvm/9/lib64/libLLVMExecutionEngine.so.9"
 "/usr/lib/llvm/9/lib64/libLLVMRuntimeDyld.so.9"
 "/usr/lib/llvm/9/lib64/libLLVMNVPTXCodeGen.so.9"
 "/usr/lib/llvm/9/lib64/libLLVMNVPTXDesc.so.9"
 "/usr/lib/llvm/9/lib64/libLLVMNVPTXInfo.so.9"
 "/usr/lib/llvm/9/lib64/libLLVMBPFDisassembler.so.9"
 "/usr/lib/llvm/9/lib64/libLLVMBPFCodeGen.so.9"
 "/usr/lib/llvm/9/lib64/libLLVMBPFAsmParser.so.9"
 "/usr/lib/llvm/9/lib64/libLLVMBPFDesc.so.9"
 "/usr/lib/llvm/9/lib64/libLLVMBPFInfo.so.9"
 "/usr/lib/llvm/9/lib64/libLLVMAMDGPUDisassembler.so.9"
 "/usr/lib/llvm/9/lib64/libLLVMAMDGPUCodeGen.so.9"
 "/usr/lib/llvm/9/lib64/libLLVMipo.so.9"
 "/usr/lib/llvm/9/lib64/libLLVMVectorize.so.9"
 "/usr/lib/llvm/9/lib64/libLLVMAsmParser.so.9"
 "/usr/lib/llvm/9/lib64/libLLVMAMDGPUAsmParser.so.9"
 "/usr/lib/llvm/9/lib64/libLLVMAMDGPUDesc.so.9"
 "/usr/lib/llvm/9/lib64/libLLVMAMDGPUInfo.so.9"
 "/usr/lib/llvm/9/lib64/libLLVMX86Disassembler.so.9"
 "/usr/lib/llvm/9/lib64/libLLVMX86AsmParser.so.9"
 "/usr/lib/llvm/9/lib64/libLLVMX86CodeGen.so.9"
 "/usr/lib/llvm/9/lib64/libLLVMDebugInfoDWARF.so.9"
 "/usr/lib/llvm/9/lib64/libLLVMTarget.so.9"
 "/usr/lib/llvm/9/lib64/libLLVMScalarOpts.so.9"
 "/usr/lib/llvm/9/lib64/libLLVMInstCombine.so.9"
 "/usr/lib/llvm/9/lib64/libLLVMTransformUtils.so.9"
 "/usr/lib/llvm/9/lib64/libLLVMBitWriter.so.9"
 "/usr/lib/llvm/9/lib64/libLLVMAnalysis.so.9"
 "/usr/lib/llvm/9/lib64/libLLVMX86Desc.so.9"
 "/usr/lib/llvm/9/lib64/libLLVMObject.so.9"
 "/usr/lib/llvm/9/lib64/libLLVMCore.so.9"
 "/usr/lib/llvm/9/lib64/libLLVMMCDisassembler.so.9"
 "/usr/lib/llvm/9/lib64/libLLVMMC.so.9"
 "/usr/lib/llvm/9/lib64/libLLVMX86Info.so.9"
 "/usr/lib/llvm/9/lib64/libLLVMSupport.so.9"
 "/usr/bin/../lib64/libunwind.so.8"
 "/usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/libstdc++.so.6"
 "/lib64/libm.so.6"
 "/usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/libgcc_s.so.1"
 "/lib64/ld-linux-x86-64.so.2"
 "/usr/lib/llvm/9/lib64/../lib64/libLLVMJITLink.so.9"
 "/usr/lib/llvm/9/lib64/../lib64/libLLVMBitReader.so.9"
 "/usr/lib/llvm/9/lib64/../lib64/libLLVMAsmPrinter.so.9"
 "/usr/lib/llvm/9/lib64/../lib64/libLLVMCodeGen.so.9"
 "/usr/lib/llvm/9/lib64/../lib64/libLLVMSelectionDAG.so.9"
 "/usr/lib/llvm/9/lib64/../lib64/libLLVMMCParser.so.9"
 "/usr/lib/llvm/9/lib64/../lib64/libLLVMAMDGPUUtils.so.9"
 "/usr/lib/llvm/9/lib64/../lib64/libLLVMBinaryFormat.so.9"
 "/usr/lib/llvm/9/lib64/../lib64/libLLVMGlobalISel.so.9"
 "/usr/lib/llvm/9/lib64/../lib64/libLLVMMIRParser.so.9"
 "/usr/lib/llvm/9/lib64/../lib64/libLLVMAggressiveInstCombine.so.9"
 "/usr/lib/llvm/9/lib64/../lib64/libLLVMIRReader.so.9"
 "/usr/lib/llvm/9/lib64/../lib64/libLLVMInstrumentation.so.9"
 "/usr/lib/llvm/9/lib64/../lib64/libLLVMLinker.so.9"
 "/usr/lib/llvm/9/lib64/../lib64/libLLVMProfileData.so.9"
 "/usr/lib/llvm/9/lib64/../lib64/libLLVMX86Utils.so.9"
 "/usr/lib/llvm/9/lib64/../lib64/libLLVMRemarks.so.9"
 "/lib64/libz.so.1"
 "/lib64/libtinfo.so.6"
 "/usr/lib/llvm/9/lib64/../lib64/libLLVMDemangle.so.9"
 "/usr/lib/llvm/9/lib64/../lib64/../lib64/libLLVMBitstreamReader.so.9"
 "/usr/lib/llvm/9/lib64/../lib64/../lib64/libLLVMDebugInfoCodeView.so.9"
 "/usr/lib64/julia/sys.so"
 "/usr/bin/../lib64/julia/libpcre2-8.so"
 "/usr/bin/../lib64/julia/libgmp.so"
 "/usr/bin/../lib64/julia/libmpfr.so"
 "/usr/bin/../lib64/julia/liblapack.so"
 "/usr/lib64/libblas.so.3"
 "/usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/libgfortran.so.5"
 "/usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/libquadmath.so.0"
 "/usr/bin/../lib64/julia/libcholmod.so"
 "/usr/lib64/libamd.so.0"
 "/usr/lib64/libcolamd.so.0"
 "/usr/lib64/libsuitesparseconfig.so.0"
 "/usr/bin/../lib64/julia/libsuitesparse_wrapper.so"

Build-time error due to `relpath(empty string)`

I'm trying to install CUDAnative on Ubuntu 16.04...I've got a source build, but I keep getting this error. Reading the docs didn't help

rzwitch@rzwitch-workstation:~$ DEBUG=1 julia
               _
   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: https://docs.julialang.org
   _ _   _| |_  __ _   |  Type "?help" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.6.1-pre.0 (2017-06-19 13:06 UTC)
 _/ |\__'_|_|_|\__'_|  |  Commit dcf39a1* (47 days old release-0.6)
|__/                   |  x86_64-linux-gnu

julia> Pkg.build("LLVM")
INFO: Building LLVM
DEBUG: Performing package build for LLVM.jl from /home/rzwitch/.julia/v0.6/LLVM/deps
DEBUG: Discovering LLVM libraries in ../../../../julia/usr/lib/julia, and configs in ../../../../julia/usr/bin, ../../../../julia/usr/tools
DEBUG: Discovered LLVM toolchains: 3.9.1 at ../../../../julia/usr/lib/libLLVM-3.9.1.so
==============================================================================[ ERROR: LLVM ]===============================================================================

LoadError: ArgumentError: `path` must be specified
while loading /home/rzwitch/.julia/v0.6/LLVM/deps/build.jl, in expression starting on line 108

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

==============================================================================[ BUILD ERRORS ]==============================================================================

WARNING: LLVM had build errors.

 - packages with build errors remain installed in /home/rzwitch/.julia/v0.6
 - build the package(s) and all dependencies with `Pkg.build("LLVM")`
 - build a single package by running its `deps/build.jl` script

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

julia> exit()
rzwitch@rzwitch-workstation:~$ CC=clang CXX=clang++ julia -e 'Pkg.build("LLVM")'
INFO: Building LLVM
==============================================================================[ ERROR: LLVM ]===============================================================================

LoadError: ArgumentError: `path` must be specified
while loading /home/rzwitch/.julia/v0.6/LLVM/deps/build.jl, in expression starting on line 108

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

==============================================================================[ BUILD ERRORS ]==============================================================================

WARNING: LLVM had build errors.

 - packages with build errors remain installed in /home/rzwitch/.julia/v0.6
 - build the package(s) and all dependencies with `Pkg.build("LLVM")`
 - build a single package by running its `deps/build.jl` script

============================================================================================================================================================================
rzwitch@rzwitch-workstation:~$ 

Recent `linkage!` breakage

After upgrading to LLVM v1.3.0, I'm seeing new breakage with linkage!. Anyone else run into this? There's a test for linkage!, so I suspect something's goofed with my installation. This is on Linux with an August vintage master version of Julia (source compiled).

using LLVM 

ctx = Context()
mod = parse(LLVM.Module,  """
    define double @fun() {
    top:
      %0 = call double inttoptr (i32 -137186077 to double ()*)()
      ret double %0
    }
    """, ctx)
fun = functions(mod)["fun"]

@show linkage(fun)
linkage!(fun, LLVM.API.LLVMInternalLinkage)

The error is:

ERROR: LoadError: MethodError: Cannot `convert` an object of type UInt32 to an object of type LLVM.API.LLVMLinkage
Closest candidates are:
  convert(::Type{T}, ::T) where T at essentials.jl:167
  LLVM.API.LLVMLinkage(::Integer) at /home/tshort/.julia/packages/CEnum/daZUb/src/CEnum.jl:128
  LLVM.API.LLVMLinkage(::Any) where T<:CEnum.Cenum at /home/tshort/.julia/packages/CEnum/daZUb/src/operators.jl:19
Stacktrace:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.