-
Notifications
You must be signed in to change notification settings - Fork 22
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
Make GAP.jl usable as a Julia module with precompilation #249
Make GAP.jl usable as a Julia module with precompilation #249
Conversation
Codecov Report
@@ Coverage Diff @@
## master #249 +/- ##
==========================================
+ Coverage 64.31% 70.07% +5.76%
==========================================
Files 49 50 +1
Lines 3276 3262 -14
==========================================
+ Hits 2107 2286 +179
+ Misses 1169 976 -193
|
20a9a35
to
08ddcdd
Compare
c8e491f
to
d88b5bd
Compare
d88b5bd
to
8c067bc
Compare
Sorry, I was afk for the weekend. Will continue now. |
7e4cfd1
to
fb95746
Compare
8293594
to
0b3e664
Compare
deps/build.jl
Outdated
println("DEPOT = ", DEPOT_PATH) | ||
|
||
println("................ENV.............") | ||
println(ENV) |
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 this for debugging or is it meant to say here?
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.
There are some kinks (see comments) but if you want, we can just merge this now and resolve those later (perhaps best to record them as issues, though)
## Hack to make GAPTypes available in the global package environment: | ||
## For a moment, we set the Julia load path to the actual depot, i.e., | ||
## the env GAP.jl is installed to, to install GAPTypes.jl globally | ||
julia_load_path_save = ENV["JULIA_LOAD_PATH"] |
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 ENV["JULIA_LOAD_PATH"]
guaranteed (by documentation / specification) to be set at this point? If it is not, then this line could throw an exception.
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.
Since this build script is (or better should, nobody is keeping you from shooting yourself in the foot) only executed by the package manager, yes, I am sure this is always set.
julia_load_path_save = ENV["JULIA_LOAD_PATH"] | ||
pop!( ENV, "JULIA_LOAD_PATH" ) | ||
julia_executable = joinpath(julia_binary, "julia") | ||
run(`$(julia_executable) -e 'import Pkg; Pkg.add("GAPTypes")'`) |
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.
Wow, that is a gross hack. I am also not quite sure why it is needed? Surely, GAP's configure
also takes care of it? OK, perhaps the problem is that it inherits the JULIA_LOAD_PATH
? But then at the very least, the comment above should explain so.
But I also wonder (very naively, so there is probably an easy answer why this won't work): couldn't we make the code in GAP more flexible, and ask it to first check if GAP.GAPTypes
is available, then use that; if not, try to use GAPTypes
directly?
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.
Yeah, I am painfully aware that this is gross, and should not be done this way. On the other hand, the Julia package manager sets this environment variable, too, which is also not very nice of it.
Actually, patching GAP this way would be possible, although not for the 4.10.2
release I guess. But then we can at least remove that hack afterwards.
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.
I will leave one more comment. The problem is that for the configure script, this somehow failed to give me the right responses when we asked for flags. I have no real idea why yet. This solution is merely the result of a lot of try-and-error.
* Move *.jl files from JuliaInterface to module itself * Add GAPTypes.jl package as dependency * Replaced MPtr by GapObj * Removed unnecessary libgap.jl * Moved MPtr call definition into init, eval into Main to not eval into a closed module
85ddeb5
to
5a1572f
Compare
I get the following error: julia> using GAP
[ Info: Recompiling stale cache file ~/.julia/compiled/v1.1/GAP/YqHod.ji for GAP [c863536a-3901-11e9-33e7-d5cd0df7b904]
Adding path /Users/mo/.julia/dev/GAP/gap/.libs to DL_LOAD_PATH
┌───────┐ GAP 4.10dev-2052-gf30c1e4 of today
│ GAP │ https://www.gap-system.org
└───────┘ Architecture: x86_64-apple-darwin18.2.0-julia64-kv6
Configuration: gmp 6.1.2, Julia GC, Julia 1.1.0, readline
Loading the library and packages ...
Packages: GAPDoc 1.6.2, PrimGrp 3.3.2, SmallGrp 1.3, TransGrp 2.0.4
Try '??help' for help. See also '?copyright', '?cite' and '?authors'
Error, MethodError: Cannot `convert` an object of type Main.ForeignGAP.MPtr to an object of type GAPTypes.GapObj
Closest candidates are:
convert(::Type{T}, !Matched::T) where T at essentials.jl:154
ERROR: InitError: Error thrown by GAP
Stacktrace:
[1] error(::String) at ./error.jl:33
[2] error_handler() at /Users/mo/.julia/dev/GAP/src/GAP.jl:47
[3] initialize(::Array{String,1}, ::Array{String,1}, ::Ptr{Nothing}) at /Users/mo/.julia/dev/GAP/src/GAP.jl:67
[4] (::getfield(GAP, Symbol("##3#4")))(::String, ::Ptr{Nothing}) at /Users/mo/.julia/dev/GAP/src/GAP.jl:97
[5] __init__() at /Users/mo/.julia/dev/GAP/src/GAP.jl:115
[6] _include_from_serialized(::String, ::Array{Any,1}) at ./loading.jl:633
[7] _require_from_serialized(::String) at ./loading.jl:684
[8] _require(::Base.PkgId) at ./loading.jl:967
[9] require(::Base.PkgId) at ./loading.jl:858
[10] require(::Module, ::Symbol) at ./loading.jl:853
during initialization of module GAP |
Please do not put bug reports in closed PR's, but create an issue instead. Anyway, will investigate. |
I was about to do that. This is just for reference. |
I have to admit, I cannot reproduce this. Did you update everything? Including GAP itself? |
As you suggest, I deleted pkg> build GAP to work. Now |
Resolves #265