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

Fix wine bootstrap #40425

Merged
merged 5 commits into from
Apr 12, 2021
Merged

Fix wine bootstrap #40425

merged 5 commits into from
Apr 12, 2021

Conversation

Keno
Copy link
Member

@Keno Keno commented Apr 10, 2021

Fixes #39124
Closes #39022

@Keno Keno added domain:building Build system, or building Julia or its dependencies system:windows Affects only Windows system:wine Building Julia under Wine labels Apr 10, 2021
@vtjnash
Copy link
Sponsor Member

vtjnash commented Apr 10, 2021

heh, I just had worked on this recently in 483379f. Looks like I'm missing a few of your changes and you're missing a few of mine

@Keno
Copy link
Member Author

Keno commented Apr 10, 2021

wanna just squash your changes into this branch?

@giordano
Copy link
Contributor

Does this mean we could fully build julia (including precompilation) with BinaryBuilder? I tried to run Julia in Wine some weeks ago, the REPL looked kind of broken, but running it non-interactively worked fine at least for simple tasks (I did some matrix multiplications)

@ViralBShah
Copy link
Member

I thought julia in BB needs full cross-compilation capabilities in the Julia compiler, which we do not have.

@giordano
Copy link
Contributor

We can already build the julia executable, but we can't generate the sysimage. If we can do that with Wine, I think that's all we need, and using Wine is one of the long-term objectives of BinaryBuilder (JuliaPackaging/BinaryBuilder.jl#10)

@musm
Copy link
Contributor

musm commented Apr 10, 2021

It's been a while since I tried to cross-compile. The build process goes through fine, but I'm getting

Test  ─────────────  0.258845 seconds
LibCURL  ──────────  0.405084 seconds
Downloads  ────────  0.420572 seconds
Pkg  ──────────────  4.357362 seconds
LazyArtifacts  ────  0.017907 seconds
Stdlibs total  ──── 30.544908 seconds
Sysimage built. Summary:
Total ───────  54.886725 seconds
Base: ───────  24.339616 seconds 44.3452%
Stdlibs: ────  30.544908 seconds 55.6508%
    JULIA usr/lib/julia/sys-o.a
Generating REPL precompile statements... 30/30
Executing precompile statements... 1363/1396
Precompilation complete. Summary:
Total ─────── 112.483401 seconds
Generation ──  82.938948 seconds 73.7344%
Execution ───  29.544453 seconds 26.2656%
0014:err:winediag:nodrv_CreateWindow Application tried to create a window, but no driver could be loaded.
0014:err:winediag:nodrv_CreateWindow The explorer process failed to start.
0014:err:ole:apartment_createwindowifneeded CreateWindow failed with error 0
0014:err:ole:apartment_createwindowifneeded CreateWindow failed with error 0
0014:err:ole:apartment_createwindowifneeded CreateWindow failed with error 0

Following the instructions at https://github.com/JuliaLang/julia/blob/master/doc/build/windows.md#cross-compiling-from-unix
I might have missed some critical package/step?

@musm
Copy link
Contributor

musm commented Apr 12, 2021

My bad, I had a configuration/env. variable set in my bashrc file that interacted badly with wine, that lead to the printing of messages like:

0014:err:ole:apartment_createwindowifneeded CreateWindow failed with error 0

In any case removing that, I still have some warnings during the compilation process (posted below).

The main issue I'm experiencing is that the compilation process seems to hang during the precompilation statement generation step (it hands and never complete?).

Precompilation complete. Summary:
Total ─────── 121.307485 seconds
Generation ──  88.658005 seconds 73.0854%
Execution ───  32.649480 seconds 26.9146%

...stuck

Update, after an awfully long time, it managed to finish the precompilation process. However, running the executable leads to following errors:

$ ./usr/bin/julia.exe
fatal: error thrown and no exception handler available.
InitError(mod=:Sys, error=ErrorException("could not load library "libpcre2-8"
The specified module could not be found. "))
jl_errorf at /home/mus/julia/src\rtutils.c:77
jl_load_dynamic_library at /home/mus/julia/src\dlload.c:280
jl_get_library_ at /home/mus/julia/src\runtime_ccall.cpp:52
jl_get_library_ at /home/mus/julia/src\runtime_ccall.cpp:63 [inlined]
jl_load_and_lookup at /home/mus/julia/src\runtime_ccall.cpp:63
jlplt_pcre2_compile_8_27503 at \\wsl$\Ubuntu\home\mus\julia\usr\lib\julia\sys.dll (unknown line)
compile at .\pcre.jl:151
compile at .\regex.jl:82
match at .\regex.jl:306
match at .\regex.jl:306 [inlined]
match at .\regex.jl:325 [inlined]
splitdrive at .\path.jl:38
joinpath at .\path.jl:259
abspath at .\path.jl:413 [inlined]
__init_build at .\sysinfo.jl:125
__init__ at .\sysinfo.jl:117
jfptr___init___32992 at \\wsl$\Ubuntu\home\mus\julia\usr\lib\julia\sys.dll (unknown line)
jl_apply at /home/mus/julia/src\julia.h:1764 [inlined]
jl_module_run_initializer at /home/mus/julia/src\toplevel.c:72
_julia_init at /home/mus/julia/src\init.c:798
repl_entrypoint at /home/mus/julia/src\jlapi.c:696
mainCRTStartup at /home/mus/julia/cli\loader_exe.c:51
BaseThreadInitThunk at C:\Windows\System32\KERNEL32.DLL (unknown line)
RtlUserThreadStart at C:\Windows\SYSTEM32\ntdll.dll (unknown line)
Compilation Log

$ make -j16
    CC cli/loader_exe.o
    CC cli/loader_lib.o
    CC cli/loader_trampolines.o
    PERL base/pcre_h.jl
    PERL base/errno_h.jl
    PERL base/file_constants.jl
    LINK usr/bin/libjulia.dll
    PERL base/uv_constants.jl
    PERL base/features_h.jl
    PERL base/features_h.jl
    PERL base/features_h.jl
    PERL base/build_h.jl.phony
    ANALYZE usr/bin/libjulia.dll
    LINK usr/bin/julia.exe
    PERL base/version_git.jl.phony
    CC usr/bin/libllvmcalltest.dll
    CC usr/bin/libccalltest.dll
    FLISP src/julia_flisp.boot
chmod a+x /home/mus/julia/julia.bat
    FLISP src/julia_flisp.boot.inc
    CC src/jloptions.o
    CC src/runtime_ccall.o
    CC src/rtutils.o
    CC src/codegen.o
    CC src/llvm-ptls.o
    CC src/jltypes.o
    CC src/gf.o
    CC src/typemap.o
    CC src/smallintset.o
    CC src/ast.o
    CC src/builtins.o
    CC src/module.o
    CC src/interpreter.o
    CC src/symbol.o
    CC src/dlload.o
In file included from /home/mus/julia/src/codegen.cpp:57:
/home/mus/julia/usr/include/llvm/ADT/Statistic.h:38: warning: "LLVM_ENABLE_STATS" redefined
   38 | #define LLVM_ENABLE_STATS 1
      |
In file included from /home/mus/julia/src/codegen.cpp:3:
/home/mus/julia/src/llvm-version.h:24: note: this is the location of the previous definition
   24 | #define LLVM_ENABLE_STATS 0
      |
    CC src/init.o
    CC src/sys.o
    CC src/task.o
    CC src/array.o
    CC src/dump.o
    CC src/staticdata.o
    CC src/toplevel.o
    CC src/jl_uv.o
/home/mus/julia/src/sys.c: In function ‘jl_dllist’:
/home/mus/julia/src/sys.c:609:14: warning: passing argument 1 of ‘free’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  609 |         free(path);
      |              ^~~~
In file included from /home/mus/julia/src/sys.c:8:
/usr/share/mingw-w64/include/stdlib.h:530:27: note: expected ‘void *’ but argument is of type ‘const char *530 |   void __cdecl free(void *_Memory);
      |                     ~~~~~~^~~~~~~
    CC src/datatype.o
    CC src/simplevector.o
    CC src/runtime_intrinsics.o
    CC src/precompile.o
    CC src/threading.o
    CC src/partr.o
    CC src/stackwalk.o
    CC src/gc.o
    CC src/gc-debug.o
    CC src/gc-pages.o
    CC src/gc-stacks.o
    CC src/method.o
    CC src/jlapi.o
    CC src/signal-handling.o
    CC src/safepoint.o
    CC src/timing.o
    CC src/subtype.o
    CC src/crc32c.o
    CC src/APInt-C.o
    CC src/processor.o
/home/mus/julia/src/jlapi.c: In function ‘repl_entrypoint’:
/home/mus/julia/src/jlapi.c:692:9: warning: implicit declaration of function ‘execv’ [-Wimplicit-function-declaration]
  692 |         execv("/proc/self/exe", orig_argv);
      |         ^~~~~
    CC src/ircode.o
    CC src/opaque_closure.o
    CC src/jitlayers.o
    CC src/aotcompile.o
    CC src/debuginfo.o
    CC src/disasm.o
    CC src/llvm-simdloop.o
    CC src/llvm-muladd.o
    CC src/llvm-final-gc-lowering.o
    CC src/llvm-pass-helpers.o
    CC src/llvm-late-gc-lowering.o
    CC src/llvm-lower-handlers.o
    CC src/llvm-gc-invariant-verifier.o
    CC src/llvm-propagate-addrspaces.o
    CC src/llvm-multiversioning.o
    CC src/llvm-alloc-opt.o
    CC src/cgmemmgr.o
    CC src/llvm-api.o
    CC src/llvm-remove-addrspaces.o
    CC src/llvm-remove-ni.o
/home/mus/julia/src/jitlayers.cpp: In function ‘jl_value_t* (* _jl_compile_codeinst(jl_code_instance_t*, jl_code_info_t*, size_t))(jl_value_t*, jl_value_t**, uint32_t, _jl_code_instance_t*)’:
/home/mus/julia/src/jitlayers.cpp:220:45: warning: unknown conversion type character ‘l’ in format [-Wformat=]
  220 |             jl_printf(dump_compiles_stream, "%" PRIu64 "\t\"", end_time - start_time);
      |                                             ^~~~~~~~~~~~~~~~~
/home/mus/julia/src/jitlayers.cpp:220:45: warning: too many arguments for format [-Wformat-extra-args]
/home/mus/julia/src/jitlayers.cpp: In member function ‘virtual CompilerResultT JuliaOJIT::CompilerT::operator()(llvm::Module&)’:
/home/mus/julia/src/jitlayers.cpp:580:69: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘long long int’ [-Wformat=]
  580 |             jl_printf(dump_llvm_opt_stream, "        basicblocks: %lu\n", countBasicBlocks(F));
      |                                                                   ~~^     ~~~~~~~~~~~~~~~~~~~
      |                                                                     |                     |
      |                                                                     long unsigned int     long long int
      |                                                                   %I64u
/home/mus/julia/src/jitlayers.cpp:635:41: warning: unknown conversion type character ‘l’ in format [-Wformat=]
  635 |         jl_printf(dump_llvm_opt_stream, "  time_ns: %" PRIu64 "\n", end_time - start_time);
      |                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~
/home/mus/julia/src/jitlayers.cpp:635:41: warning: too many arguments for format [-Wformat-extra-args]
/home/mus/julia/src/jitlayers.cpp:646:69: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘long long int’ [-Wformat=]
  646 |             jl_printf(dump_llvm_opt_stream, "        basicblocks: %lu\n", countBasicBlocks(F));
      |                                                                   ~~^     ~~~~~~~~~~~~~~~~~~~
      |                                                                     |                     |
      |                                                                     long unsigned int     long long int
      |                                                                   %I64u
    CC src/llvm-julia-licm.o
    CC src/llvm-demote-float16.o
    LINK usr/bin/libjulia-internal.dll
    JULIA usr/lib/julia/corecompiler.ji
    JULIA usr/lib/julia/sys.ji

@Keno
Copy link
Member Author

Keno commented Apr 12, 2021

Update, after an awfully long time, it managed to finish the precompilation process. However, running the executable leads to following errors:

You can set the WINEPATH to the bin directory and it'll find it, but I thought the new stdlib jll work took care of this. @staticfloat ?

@Keno Keno merged commit 53603f6 into master Apr 12, 2021
@Keno Keno deleted the kf/fixwine branch April 12, 2021 23:24
@vtjnash
Copy link
Sponsor Member

vtjnash commented Apr 12, 2021

My guess is this is something wrong with wine, since the same build works fine without the PATH modifications on Windows

@musm
Copy link
Contributor

musm commented Apr 13, 2021

I agree with this patch (many, many thanks for the effort!), although I think we should keep the original issue open since cross-compilation is still not 100% functioning.

ElOceanografo pushed a commit to ElOceanografo/julia that referenced this pull request May 4, 2021
* Fix wine bootstrap

Fixes JuliaLang#39124
Closes JuliaLang#39022

* fix cross-build, and other build issues

* this should probably be part of spawn, if it is needed

* Revert "this should probably be part of spawn, if it is needed"

This reverts commit eb88a9c.

Seems to be needed

* fixup! fix cross-build, and other build issues

Co-authored-by: Jameson Nash <[email protected]>
antoine-levitt pushed a commit to antoine-levitt/julia that referenced this pull request May 9, 2021
* Fix wine bootstrap

Fixes JuliaLang#39124
Closes JuliaLang#39022

* fix cross-build, and other build issues

* this should probably be part of spawn, if it is needed

* Revert "this should probably be part of spawn, if it is needed"

This reverts commit eb88a9c.

Seems to be needed

* fixup! fix cross-build, and other build issues

Co-authored-by: Jameson Nash <[email protected]>
johanmon pushed a commit to johanmon/julia that referenced this pull request Jul 5, 2021
* Fix wine bootstrap

Fixes JuliaLang#39124
Closes JuliaLang#39022

* fix cross-build, and other build issues

* this should probably be part of spawn, if it is needed

* Revert "this should probably be part of spawn, if it is needed"

This reverts commit eb88a9c.

Seems to be needed

* fixup! fix cross-build, and other build issues

Co-authored-by: Jameson Nash <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain:building Build system, or building Julia or its dependencies system:windows Affects only Windows system:wine Building Julia under Wine
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix Windows cross-compilation from Unix
5 participants