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

Windows nightly binaries statically link against LLVM #29981

Closed
maleadt opened this issue Nov 9, 2018 · 11 comments
Closed

Windows nightly binaries statically link against LLVM #29981

maleadt opened this issue Nov 9, 2018 · 11 comments
Labels
building Build system, or building Julia or its dependencies regression Regression in behavior compared to a previous version system:mac Affects only macOS system:windows Affects only Windows
Milestone

Comments

@maleadt
Copy link
Member

maleadt commented Nov 9, 2018

$ ./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"]
$ ./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[]

i.e. the nightly binaries do not show LLVM.dylib in the output of Libdl.dllist()...
The library is definitely there though, and suspiciously libjulia has grown with 40M:

$ ls -lah julia*-bin/lib/{libjulia.1.*,julia/libLLVM}.dylib
-rwxr-xr-x  1 julia  staff    39M Sep 29 15:22 julia-1.0.1-bin/lib/julia/libLLVM.dylib
-rwxr-xr-x  1 julia  staff   3.0M Sep 29 15:22 julia-1.0.1-bin/lib/libjulia.1.0.dylib
-rwxr-xr-x  1 julia  staff    40M Nov  9 02:24 julia-dev-bin/lib/julia/libLLVM.dylib
-rwxr-xr-x  1 julia  staff    43M Nov  9 02:25 julia-dev-bin/lib/libjulia.1.1.dylib

Looks like we've reverted to statically linking LLVM, presumably unintendedly since we're still shipping LLVM.dylib?

Discovered while debugging LLVM.jl, which requires a dynamically-linked libLLVM and finds that library by looking at the output of Libdl.dllist().

I can do a bisect on the csail macmini, but that will take a while, and maybe somebody already knows what's up by the looks of this issue.

cc @staticfloat

@maleadt maleadt added building Build system, or building Julia or its dependencies system:mac Affects only macOS labels Nov 9, 2018
@maleadt
Copy link
Member Author

maleadt commented Nov 11, 2018

Bisected to 391f2dd/#29446. On the macOS system, llvm-config --libfiles just lists all static archives, while on my Linux system that outputs only libLLVM.so...

@maleadt
Copy link
Member Author

maleadt commented Nov 13, 2018

$ ./bin/llvm-config --shared-mode
static

$ ./bin/llvm-config --libfiles --link-shared
llvm-config: error: libLLVM-6.0.dylib is missing

$ find . -name "libLLVM*.dylib"  
./lib/libLLVM.dylib

$ ln -s lib/libLLVM.dylib lib/libLLVM-6.0.dylib

$ ./bin/llvm-config --libfiles --link-shared
/Users/julia/Julia/julia-dev/deps/scratch/llvm-6.0.1/build_Release/lib/libLLVM-6.0.dylib

Anybody knows what's up?

@maleadt maleadt added the regression Regression in behavior compared to a previous version label Nov 15, 2018
@maleadt
Copy link
Member Author

maleadt commented Dec 3, 2018

This should have been closed with #30033, but I just discovered the same issue applies to Windows:

tbesard@phoenix-win64 MINGW64 ~/Julia                                                                                                                                                                                                        
$ ./julia-1.0.2/bin/julia.exe                                                                                                                                                                                                                
               _                                                                                                                                                                                                                             
   _       _ _(_)_     |  Documentation: https://docs.julialang.org                                                                                                                                                                          
  (_)     | (_) (_)    |                                                                                                                                                                                                                     
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.                                                                                                                                                                              
  | | | | | | |/ _` |  |                                                                                                                                                                                                                     
  | | |_| | | | (_| |  |  Version 1.0.2 (2018-11-08)                                                                                                                                                                                         
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release                                                                                                                                                                            
|__/                   |                                                                                                                                                                                                                     
                                                                                                                                                                                                                                             
julia> using Libdl                                                                                                                                                                                                                           
                                                                                                                                                                                                                                             
julia> filter(x -> occursin("LLVM", x), Libdl.dllist())                                                                                                                                                                                      
1-element Array{AbstractString,1}:                                                                                                                                                                                                           
 "C:\\Users\\tbesard\\Julia\\julia-1.0.2\\bin\\LLVM.dll"                                                                                                                                                         
                                                                                                                                                                                                                                             
tbesard@phoenix-win64 MINGW64 ~/Julia                                                                                                                                                                                                        
$ ./julia-nightly/bin/julia.exe                                                                                                                                                                                                              
               _                                                                                                                                                                                                                             
   _       _ _(_)_     |  Documentation: https://docs.julialang.org                                                                                                                                                                          
  (_)     | (_) (_)    |                                                                                                                                                                                                                     
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.                                                                                                                                                                              
  | | | | | | |/ _` |  |                                                                                                                                                                                                                     
  | | |_| | | | (_| |  |  Version 1.1.0-DEV.786 (2018-12-03)                                                                                                                                                                                 
 _/ |\__'_|_|_|\__'_|  |  Commit 71748da03b (0 days old master)                                                                                                                                                                              
|__/                   |                                                                                                                                                                                                                     
                                                                                                                                                                                                                                             
julia> using Libdl                                                                                                                                                                                                                           
                                                                                                                                                                                                                                             
julia> filter(x -> occursin("LLVM", x), Libdl.dllist())                                                                                                                                                                                      
0-element Array{AbstractString,1} 
$ ls -lah julia-*/bin/{libjulia,LLVM}.dll                                                                                                                                                                                                    
-rwxr-xr-x 1 tbesard None 42M Nov  8 23:31 julia-1.0.2/bin/libjulia.dll                                                                                                                                                                      
-rwxr-xr-x 1 tbesard None 52M Nov  8 23:22 julia-1.0.2/bin/LLVM.dll                                                                                                                                                                          
-rwxr-xr-x 1 tbesard None 82M Dec  3 12:34 julia-nightly/bin/libjulia.dll                                                                                                                                                                    
-rwxr-xr-x 1 tbesard None 53M Dec  3 12:30 julia-nightly/bin/LLVM.dll

@maleadt maleadt changed the title macOS nightly binaries statically link against LLVM Windows nightly binaries statically link against LLVM Dec 3, 2018
@maleadt
Copy link
Member Author

maleadt commented Dec 3, 2018

This one seems more troublesome. Running llvm-config from LLVMBuilder with --shared-mode --link-shared reveals that LLVM-6.0.dll is not found. So far so good, but tracing with ProcMon shows that it looks in C:\workspace\destdir\tools\ and nowhere else...
It figures that path out by looking at LLVM_TOOLS_INSTALL_DIR, which is hard coded in https://github.com/staticfloat/LLVMBuilder/blob/3b43a1dda7148cd44db6542b4c88ffaed097901c/build_tarballs.jl#L201

maleadt added a commit to JuliaLLVM/LLVM.jl that referenced this issue Dec 4, 2018
maleadt added a commit to JuliaLLVM/LLVM.jl that referenced this issue Dec 4, 2018
@JeffBezanson JeffBezanson added this to the 1.1 milestone Dec 17, 2018
@JeffBezanson
Copy link
Member

Tentatively adding to the 1.1 milestone since this is a regression since 1.0. @staticfloat @eli-schwartz @vchuravy @vtjnash any ideas?

@vtjnash
Copy link
Member

vtjnash commented Dec 17, 2018

I think Tim's findings are why we hardcoded the correct value (prior to #29446)

@eli-schwartz
Copy link
Contributor

Ouch. Seems like it would make more sense, though, to ensure the llvm toolchain is in healthy working order. If you're moving things around by hand in the llvm build configuration, it would likely be a good idea to fix it too... is it simply a matter of creating the symlinks on every OS?

BTW looking at the source for llvm-config.cpp it looks like this hardcodes a PREFIX{bin,lib,include} style layout. Maybe it should respect compile-time paths for this.

@vtjnash
Copy link
Member

vtjnash commented Dec 20, 2018

Yeah, the problem we found is that the llvm toolchain doesn't have a health working order. I agree we should try to fix this upstream as you mentioned. In the meantime, we can put your fix behind a ifneq ($(USE_SYSTEM_LLVM),0) test.

@nalimilan
Copy link
Member

Maybe related: I made a PR upstream two years ago to restore support for custom install dirs. See https://reviews.llvm.org/D28234.

@Nosferican
Copy link
Contributor

Any update on this as the last issue blocking 1.1 release?

@maleadt
Copy link
Member Author

maleadt commented Jan 17, 2019

Fixed (worked around) by #30459.

@maleadt maleadt closed this as completed Jan 17, 2019
carlocab added a commit to carlocab/julia that referenced this issue May 1, 2021
As noted in JuliaLang#29981 and JuliaLang#30459, `llvm-config` is broken on Darwin, and
sadly hasn't been fixed since then.

Building Julia on Darwin with `USE_SYSTEM_LLVM` doesn't currently work,
as calls to `llvm-config` produce the wrong flags. This PR fixes that.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
building Build system, or building Julia or its dependencies regression Regression in behavior compared to a previous version system:mac Affects only macOS system:windows Affects only Windows
Projects
None yet
Development

No branches or pull requests

6 participants