Closed aminya closed 4 years ago
Thanks for this! I'm surprised this is all it takes to get something working on Windows.
Thanks for this! I'm surprised this is all it takes to get something working on Windows.
You're welcome 😃
Check the https://github.com/tshort/StaticCompiler.jl/issues/6. I cannot still get it running for the f()
test.
For more robust compiling across platforms, PackageCompilerX is a good place to look.
I think this can be merged now.
Also, looks like Travis tests are failing on the standalone executables. I'm not sure if they ever passed, though. I'd like to either get that cleaned up or try the tests locally.
Also, looks like Travis tests are failing on the standalone executables. I'm not sure if they ever passed, though. I'd like to either get that cleaned up or try the tests locally.
On my system I get the error that Int64
is not a key.
It happens because of this:
Cformatmap = Dict(
Cint => "%d",
Clong => "%ld",
Cdouble => "%e",
)
There is no map for Int64
and Cint means Int32
Documentation for all the C types is here: https://docs.julialang.org/en/v1/base/c/#Base.Cchar
I couldn't figure out how to edit your branch. See the following for a version that compiles standalone executables on Windows.
https://github.com/tshort/StaticCompiler.jl/blob/aminya-extra/test/standalone-exe.jl
Feel free to add that to your branch and make changes if needed.
I couldn't figure out how to edit your branch. See the following for a version that compiles standalone executables on Windows.
Because I am an outsider collaborator, similar to how I don't have direct access to this repository, you don't have access to my fork. That's why I was asking for transferring this repo to Julia-Embedded 😄
I will edit it.
Another pain point for Windows is that an exe wants all dll's in the path or in the same folder. I just blindly copied them to the standalone folder.
I get this error:
In file included from twox.c:2:0:
C:/Julia-1.3.0/include/julia/julia.h:1523:28: warning: 'jl_init_with_image__threading' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
#define jl_init_with_image jl_init_with_image__threading
^
C:/Julia-1.3.0/include/julia/julia.h:1523:28: note: in definition of macro 'jl_init_with_image'
#define jl_init_with_image jl_init_with_image__threading
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/6.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -ltwox
collect2.exe: error: ld returned 1 exit status
ERROR: LoadError: failed process: Process(`gcc -o twox twox.o '-LC:\Users\yahyaaba\Documents\GitHub\StaticCompiler.jl\test/standalone' '-LC:\Julia-1.3.0\bin/../lib' -Wl,--unresolved-symbols=ignore-in-object-files -Wl,-rpath,. '-Wl,-rpath,C:\Julia-1.3.0\bin/../lib' -ljulia -ltwox`, ProcessExited(1)) [1]
Stacktrace:
[1] pipeline_error at .\process.jl:525 [inlined]
[2] #run#565(::Bool, ::typeof(run), ::Cmd) at .\process.jl:440
[3] run at .\process.jl:438 [inlined]
[4] (::var"#18#20")() at C:\Users\yahyaaba\Documents\GitHub\StaticCompiler.jl\test\standalone-exe.jl:153
[5] cd(::var"#18#20", ::String) at .\file.jl:93
[6] top-level scope at C:\Users\yahyaaba\Documents\GitHub\StaticCompiler.jl\test\standalone-exe.jl:101
in expression starting at C:\Users\yahyaaba\Documents\GitHub\StaticCompiler.jl\test\standalone-exe.jl:101
Windows passed here: https://travis-ci.com/tshort/StaticCompiler.jl/jobs/261964286
:exclamation: No coverage uploaded for pull request base (
master@a3c946c
). Click here to learn what that means. The diff coverage is25%
.
@@ Coverage Diff @@
## master #3 +/- ##
========================================
Coverage ? 92.7%
========================================
Files ? 7
Lines ? 288
Branches ? 0
========================================
Hits ? 267
Misses ? 21
Partials ? 0
Impacted Files | Coverage Δ | |
---|---|---|
src/irgen.jl | 84.84% <25%> (ø) |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update a3c946c...3c7ed69. Read the comment docs.
Windows passes now https://travis-ci.com/aminya/StaticCompiler.jl/builds/138874773
I couldn't fix https://github.com/tshort/StaticCompiler.jl/issues/8
Tests pass locally for me on Windows and Linux, so I'll probably merge this as is. I'll give it a couple of days to see if I can figure out why Travis fails.
That's good!
Yeah, we can do more stuff on other pull requests. For example, we need to move @jlrun
from tests to the package itself.
Agreed. There's lot's more stuff to do! On @jlrun
, right now, that's a pretty kludgy macro. It's not intended to be part of the API. We could use some compiling helpers as part of the API. That could include stuff from test/standalone-exe.jl
and PackageCompilerX.
I'm more worried about the core compiling functionality. That needs work to handle more code.
Fixes https://github.com/tshort/StaticCompiler.jl/issues/2, https://github.com/tshort/StaticCompiler.jl/issues/4, https://github.com/tshort/StaticCompiler.jl/issues/6, and https://github.com/tshort/StaticCompiler.jl/issues/5