-
Notifications
You must be signed in to change notification settings - Fork 107
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
Upgrade build system to BB2 -- Part 1 #406
Conversation
It looks that `dump` is no longer exposed in LLVM release build.
Don't forget to add FreeBSD to the list. 😉 |
Why delete the Project.toml file? |
To temporarily workaround a dependency problem, I will add it back in the end. |
It turns out LLVMBuilder for FreeBSD is currently broken :( |
this can be fixed by UPDATE
UPDATE2This has been fixed by forcing to use Lines 172 to 173 in c62cb57
even on 64bit Windows.
|
I have been using the
The offending line was:
I realize this is just a WIP right now, but thought I'd try to help surface any issues early. |
@twadleigh that's due to this commit 7b9dd68 which should be Win32 only. |
docs/src/examples.md
Outdated
@@ -200,7 +200,7 @@ julia> const path_to_lib = pwd(); | |||
julia> addHeaderDir(path_to_lib, kind=C_System) | |||
|
|||
julia> Libdl.dlopen(joinpath(path_to_lib, "libarraymaker.so"), Libdl.RTLD_GLOBAL) | |||
Ptr{Void} @0x00007f9dd4556d60 | |||
Ptr{Cvoid} @0x00007f9dd4556d60 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cvoid
is actually an alias for Nothing
; void pointers print as Ptr{Nothing}
.
src/cxxstr.jl
Outdated
@@ -714,7 +716,6 @@ end | |||
dne = CreateDeclRefExpr(C,FD) | |||
argt = tuple(llvmargs...) | |||
expr = CallDNE(C,dne,argt; argidxs = argidxs, symargs = symargs) | |||
expr |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why get rid of this? If you do want to get rid of it, you can similarly ditch the assignment above it, since it's just the RHS that will be used/returned.
src/initialization.jl
Outdated
contains(xcode_path, "Xcode.app") && (xcode_path *= "/Toolchains/XcodeDefault.xctoolchain") | ||
xcode_path *= "/" | ||
|
||
xcode_path = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there not still a way to get this automatically, e.g. via xcode-select
?
This is really great work! I don't feel fully qualified to review it, but I've left a few comments in-line. Aside from those, I'll note:
|
Since we're not going to support binary build for v0.7-, these code are totally obsoleted.
Hi @ararslan, I've rebased this PR and applied your suggestions. I can successfully build libcxxffi binary for FreeBSD: https://github.com/Gnimuc/CxxBuilder/releases/tag/v0.0.4-1, but I don't have a BSD environment for testing whether the pre-built lib is dlopen-able. We also need to add an init function for it. This PR is for Julia-1.1+LLVM-6.0.1 only. The main reason is the incompatibility between the official Julia binaries and LLVMBuilder releases. You could refer to previous discussions for details:
It's possible to add binary-build support for Julia-1.0, but I failed to make that work on Windows. For now, the libcxxffi binary used in this PR is actually Julia-master compatible which happens to be compatible with Julia-1.1 x86_64 platforms. It's hard to get everything works without the full compatibility between Julia and LLVMBuilder. Hopefully, we will have it in post-Julia-1.2-era. |
I can give it a try on my FreeBSD system, and if all goes well we can turn on Cirrus CI for this repo to test on FreeBSD. |
welp staticfloat/LLVMBuilder#45 EDIT: So apparently one should not be opening multiple copies of libLLVM, which is the cause of that issue. What is it that needs to be |
It's |
@Gnimuc Not sure if this is still a WIP, but I got multiple errors when I tried to precompile your |
@kraftpunk97 It should work as long as you're working on macOS, Linux(64bit) or Windows(64bit). Could you comment those errors below? BTW, you may need to manually git fetch the latest master. |
@Gnimuc Here's the error when I precompile
|
Shouldn't you use the BB2 branch that this PR is based on? e.g. |
aha, I got that
Yeah, that's actually my bad. I've updated the command in the OP. Currently, I manually keep syncing these two branches. |
Thanks @Gnimuc, problem solved |
Hi @ararslan, did you successfully |
It turns out macOS SDK headers are not installed in `/usr/include` by default on Mojave.
Sorry for the delay in getting back to you on that. I just tried your FreeBSD-compatible release for CxxBuilder and I can |
Seems to work out of the box (CentOS Singularity Container on Ubuntu)! Thanks so much for all your work on this, @Gnimuc and all the other that were involved! I was really missing Cxx.jl ... |
Yep, just remembered, lol. Sorry! Hadn't used Cxx for too long. :-) |
Another question: Is there an easy way to supply the binary deps in a central location (e.g. a container image), to speed up Cxx installation and keep the user .julia directories small(er)? |
Thank you for your effort! |
@oschulz It's possible to shrink deps size. I tried before but failed to do it correctly. For now, BB just ships the whole LLVM/Clang deps which are very huge. I think we can revisit it after Julia 1.2 has been released. |
doesn't install on ubuntu 19.04 Disco Dingo
$ julia
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.0.3
_/ |\__'_|_|_|\__'_| | Ubuntu ⛬ julia/1.0.3+dfsg-4
|__/ |
julia> using Pkg
julia> Pkg.add("Cxx")
Updating registry at `~/.julia/registries/General`
Updating git-repo `https://github.com/JuliaRegistries/General.git`
Resolving package versions...
ERROR: Unsatisfiable requirements detected for package Cxx [a0b5b9ef]:
Cxx [a0b5b9ef] log:
├─possible versions are: [0.0.1-0.0.2, 0.1.0-0.1.1, 0.2.0] or uninstalled
├─restricted to versions * by an explicit requirement, leaving only
versions [0.0.1-0.0.2, 0.1.0-0.1.1, 0.2.0]
└─restricted by julia compatibility requirements to versions:
uninstalled — no versions left
Stacktrace:
[1] #propagate_constraints!#61(::Bool, ::Function,
::Pkg.GraphType.Graph, ::Set{Int64}) at
/build/julia-wlSndE/julia-1.0.3+dfsg/usr/share/julia/stdlib/v1.0/Pkg/src/GraphType.jl:1005
[2] propagate_constraints! at
/build/julia-wlSndE/julia-1.0.3+dfsg/usr/share/julia/stdlib/v1.0/Pkg/src/GraphType.jl:946
[inlined]
[3] #simplify_graph!#121(::Bool, ::Function, ::Pkg.GraphType.Graph,
::Set{Int64}) at
/build/julia-wlSndE/julia-1.0.3+dfsg/usr/share/julia/stdlib/v1.0/Pkg/src/GraphType.jl:1460
[4] simplify_graph! at
/build/julia-wlSndE/julia-1.0.3+dfsg/usr/share/julia/stdlib/v1.0/Pkg/src/GraphType.jl:1460
[inlined] (repeats 2 times)
[5] resolve_versions!(::Pkg.Types.Context,
::Array{Pkg.Types.PackageSpec,1}, ::Nothing) at
/build/julia-wlSndE/julia-1.0.3+dfsg/usr/share/julia/stdlib/v1.0/Pkg/src/Operations.jl:373
[6] resolve_versions! at
/build/julia-wlSndE/julia-1.0.3+dfsg/usr/share/julia/stdlib/v1.0/Pkg/src/Operations.jl:316
[inlined]
[7] #add_or_develop#62(::Array{Base.UUID,1}, ::Symbol, ::Function,
::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}) at
/build/julia-wlSndE/julia-1.0.3+dfsg/usr/share/julia/stdlib/v1.0/Pkg/src/Operations.jl:1201
[8] #add_or_develop at ./none:0 [inlined]
[9] #add_or_develop#13(::Symbol, ::Bool,
::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}},
::Function, ::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}) at
/build/julia-wlSndE/julia-1.0.3+dfsg/usr/share/julia/stdlib/v1.0/Pkg/src/API.jl:64
[10] #add_or_develop at ./none:0 [inlined]
[11] #add_or_develop#12 at
/build/julia-wlSndE/julia-1.0.3+dfsg/usr/share/julia/stdlib/v1.0/Pkg/src/API.jl:29
[inlined]
[12] #add_or_develop at ./none:0 [inlined]
[13] #add_or_develop#11 at
/build/julia-wlSndE/julia-1.0.3+dfsg/usr/share/julia/stdlib/v1.0/Pkg/src/API.jl:28
[inlined]
[14] #add_or_develop at ./none:0 [inlined]
[15] #add_or_develop#10 at
/build/julia-wlSndE/julia-1.0.3+dfsg/usr/share/julia/stdlib/v1.0/Pkg/src/API.jl:27
[inlined]
[16] #add_or_develop at ./none:0 [inlined]
[17] #add#18 at
/build/julia-wlSndE/julia-1.0.3+dfsg/usr/share/julia/stdlib/v1.0/Pkg/src/API.jl:69
[inlined]
[18] add(::String) at
/build/julia-wlSndE/julia-1.0.3+dfsg/usr/share/julia/stdlib/v1.0/Pkg/src/API.jl:69
[19] top-level scope at none:0
On 12/4/19 2:26 am, Gnimuc wrote:
This PR is for providing an out-of-box user installation experience of
Cxx.jl. You could give it a test by |(v1.1) pkg> dev
https://github.com/Gnimuc/Cxx.jl.git|.
Platform Status
macOS ✅
Linux x86_64 ✅
Linux i686 ❌
Windows x86_64 see #406 (comment)
<#406 (comment)>
below
Windows i686 ❌
FreeBSD pending upstream (LLVMBuilder)
In short, the package works fine almost on all x86_64 platforms. There
is a symbol missing error
(|clang::FileManager::getVirtualFile(llvm::StringRef, long, long)|) on
i686 platforms, which is probably due to the incompatibility between
LLVMBuilder(only tested with gcc7) and current released 32bit Julia.
UPDATE
Since there are still some compatibility issues between Julia and
LLVMBuilder (especially i686 platforms), I won't try this until
Julia1.2 is released. Currently, the binary build for macOS and Linux
x86_64 is working quite well. Windows x86_64 support is still
experimental: pre-built binary can be loaded successfully and a lot of
examples can work as expected. However, some examples will trigger
segment faults which, I guess, are due to some unknown bugs in Cxx.
I think the first step is to merge this PR and tag a new release so
more people can test this package and submit bug reports. Then we can
try to support other Tier 1 platforms until after Julia1.2 is
released. It looks like Keno is heading on other important things and
doesn't have time to review this, so I'm pinging all you guys here
(sorry in advance if this is disturbing), but it would be great if you
could help to review/test this PR.
cc @ararslan <https://github.com/ararslan> @cdsousa
<https://github.com/cdsousa> @phlavenk <https://github.com/phlavenk>
@btaidm <https://github.com/btaidm> @oschulz
<https://github.com/oschulz> @ahumenberger
<https://github.com/ahumenberger> @grizzlysmit
<https://github.com/grizzlysmit> @zsz00 <https://github.com/zsz00>
@ervinbosenbacher <https://github.com/ervinbosenbacher> @DrKrar
<https://github.com/DrKrar> @skariel <https://github.com/skariel>
------------------------------------------------------------------------
You can view, comment on, or merge this pull request online at:
#406
Commit Summary
* `dump()` => `print(llvm::errs(), false)`
* `contains` => `occursin`, a upgrading oversight
* fix-up
* Fix REPL mode
* Misc. upgrading oversight
* fix-up
* Update cxxstr.jl
* fix-up
* Merge pull request #1 from cdsousa/patch-mac
* Fix segmentfault
* Bump Julia version and update CI
* Upgrade build system to BB2 --take 1
* Delete Project.toml
* Upgrade build system to BB2 --take 2
* Workaround for Windows ABI mismatch
* Fix another Windows glitch
* Safer path separator solutions
* Fix source file path separator for Windows
* Add `__cxa_atexit` as per suggested in #145
* Update build_libcxxffi.jl
* Remove meaningless GC preserve
* Only define `__cxa_atexit` on Windows
* Update build_libcxxffi.jl
* Try to fix CI on macOS
* fix-up
* Disable precompile
* Use hard-coded xcode path on macOS since `xcode-select` is not
continued
* Update build_libcxxffi.jl
* Add missing libname
* Fix signature mismatch
* Workaround for building issues on Julia master
* Enable appveyor and update badge links
File Changes
* *M* .gitignore
<https://github.com/JuliaInterop/Cxx.jl/pull/406/files#diff-0> (3)
* *M* .travis.yml
<https://github.com/JuliaInterop/Cxx.jl/pull/406/files#diff-1> (73)
* *D* Project.toml
<https://github.com/JuliaInterop/Cxx.jl/pull/406/files#diff-2> (12)
* *M* README.md
<https://github.com/JuliaInterop/Cxx.jl/pull/406/files#diff-3> (32)
* *M* REQUIRE
<https://github.com/JuliaInterop/Cxx.jl/pull/406/files#diff-4> (3)
* *A* appveyor.yml
<https://github.com/JuliaInterop/Cxx.jl/pull/406/files#diff-5> (43)
* *M* deps/build.jl
<https://github.com/JuliaInterop/Cxx.jl/pull/406/files#diff-6> (18)
* *A* deps/build_libcxxffi.jl
<https://github.com/JuliaInterop/Cxx.jl/pull/406/files#diff-7> (38)
* *M* docs/src/examples.md
<https://github.com/JuliaInterop/Cxx.jl/pull/406/files#diff-8> (4)
* *M* docs/src/implementation.md
<https://github.com/JuliaInterop/Cxx.jl/pull/406/files#diff-9> (2)
* *M* src/Cxx.jl
<https://github.com/JuliaInterop/Cxx.jl/pull/406/files#diff-10> (4)
* *M* src/CxxREPL/replpane.jl
<https://github.com/JuliaInterop/Cxx.jl/pull/406/files#diff-11> (95)
* *M* src/boot.h
<https://github.com/JuliaInterop/Cxx.jl/pull/406/files#diff-12> (4)
* *M* src/bootstrap.cpp
<https://github.com/JuliaInterop/Cxx.jl/pull/406/files#diff-13> (8)
* *M* src/clangwrapper.jl
<https://github.com/JuliaInterop/Cxx.jl/pull/406/files#diff-14> (4)
* *M* src/cxxstr.jl
<https://github.com/JuliaInterop/Cxx.jl/pull/406/files#diff-15> (29)
* *M* src/initialization.jl
<https://github.com/JuliaInterop/Cxx.jl/pull/406/files#diff-16> (47)
* *M* src/show.jl
<https://github.com/JuliaInterop/Cxx.jl/pull/406/files#diff-17> (6)
* *M* src/typetranslation.jl
<https://github.com/JuliaInterop/Cxx.jl/pull/406/files#diff-18> (10)
* *M* test/clangutils.jl
<https://github.com/JuliaInterop/Cxx.jl/pull/406/files#diff-19> (10)
* *M* test/cxxstr.jl
<https://github.com/JuliaInterop/Cxx.jl/pull/406/files#diff-20> (2)
* *M* test/llvmgraph.jl
<https://github.com/JuliaInterop/Cxx.jl/pull/406/files#diff-21> (2)
* *M* test/llvmincludes.jl
<https://github.com/JuliaInterop/Cxx.jl/pull/406/files#diff-22> (2)
* *M* test/llvmtest.jl
<https://github.com/JuliaInterop/Cxx.jl/pull/406/files#diff-23> (14)
* *M* test/qttest.jl
<https://github.com/JuliaInterop/Cxx.jl/pull/406/files#diff-24> (2)
Patch Links:
* https://github.com/JuliaInterop/Cxx.jl/pull/406.patch
* https://github.com/JuliaInterop/Cxx.jl/pull/406.diff
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#406>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AInk9huHeglqHo3hdyxUCxm9sCt0utXiks5vf2I6gaJpZM4bmusy>.
--
.~. In my life God comes first....
/V\ but Linux is pretty high after that :-D
/( )\ Francis (Grizzly) Smit
^^-^^ http://www.smit.id.au/
|
@grizzlysmit, unfortunately, Cxx doesn't support binary build for Julia 1.0.x for now. You may need to upgrade Julia to 1.1 firstly and then run |
Sounds good, thanks! |
This PR is for providing an out-of-box user installation experience of Cxx.jl. You could give it a test by
(v1.1) pkg> add https://github.com/Gnimuc/Cxx.jl#BB2
.In short, the package works fine almost on all x86_64 platforms. There is a symbol missing error (
clang::FileManager::getVirtualFile(llvm::StringRef, long, long)
) on i686 platforms, which is probably due to the incompatibility between LLVMBuilder(only tested with gcc7) and current released 32bit Julia.UPDATE
Since there are still some compatibility issues between Julia and LLVMBuilder (especially i686 platforms), I won't revisit this until Julia1.2 is released. Currently, the binary build for macOS and Linux x86_64 is working quite well. Windows x86_64 support is still experimental: pre-built binary can be loaded successfully and a lot of examples can work as expected, but other examples may trigger segment faults which, I guess, are due to some unknown bugs in Cxx.
I think the first step is to merge this PR and tag a new release so more people can test this package and submit bug reports. Then we can try to support other Tier 1 platforms until after Julia1.2 is released. It looks like Keno is heading on other important things and doesn't have time to review this, so I'm pinging all you guys here (sorry in advance if this is disturbing), but it would be great if you could help to review/test this PR.
cc @ararslan @cdsousa @phlavenk @btaidm @oschulz @ahumenberger @grizzlysmit @zsz00 @ervinbosenbacher @DrKrar @skariel
fix #403, fix #398, fix #397, fix #394, fix #393, fix #388