tshort / StaticCompiler.jl

Compiles Julia code to a standalone library (experimental)
Other
494 stars 31 forks source link

could not load symbol "usleep": #2

Closed aminya closed 4 years ago

aminya commented 4 years ago
┌ Warning: The two argument form of `func_for_method_checked` is deprecated. Pass sparams in addition.
│   caller = #irgen#45(::Bool, ::Bool, ::typeof(irgen), ::Any, ::Any) at irgen.jl:50
└ @ StaticCompiler C:\Users\yahyaaba\Documents\GitHub\StaticCompiler.jl\src\irgen.jl:50
ccalls: Error During Test at C:\Users\yahyaaba\Documents\GitHub\StaticCompiler.jl\test\ccalls.jl:8
  Got exception outside of a @test
  could not load symbol "usleep":
  The specified procedure could not be found.

  Stacktrace:
   [1] top-level scope at C:\Users\yahyaaba\Documents\GitHub\StaticCompiler.jl\test\ccalls.jl:8
   [2] eval at .\boot.jl:330 [inlined]
   [3] eval at C:\Users\yahyaaba\Documents\GitHub\StaticCompiler.jl\src\StaticCompiler.jl:1 [inlined]
   [4] find_ccalls(::TypedCodeUtils.Reflection) at C:\Users\yahyaaba\Documents\GitHub\StaticCompiler.jl\src\ccalls.jl:18
   [5] find_ccalls(::Any, ::Any) at C:\Users\yahyaaba\Documents\GitHub\StaticCompiler.jl\src\ccalls.jl:9
   [6] #irgen#45(::Bool, ::Bool, ::typeof(irgen), ::Any, ::Any) at C:\Users\yahyaaba\Documents\GitHub\StaticCompiler.jl\src\irgen.jl:144
   [7] irgen(::Any, ::Any) at C:\Users\yahyaaba\Documents\GitHub\StaticCompiler.jl\src\irgen.jl:43
   [8] top-level scope at C:\Users\yahyaaba\Documents\GitHub\StaticCompiler.jl\test\ccalls.jl:12
   [9] top-level scope at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.3\Test\src\Test.jl:1107    
   [10] top-level scope at C:\Users\yahyaaba\Documents\GitHub\StaticCompiler.jl\test\ccalls.jl:9
   [11] include at .\boot.jl:328 [inlined]
   [12] include_relative(::Module, ::String) at .\loading.jl:1105
   [13] include(::Module, ::String) at .\Base.jl:31
   [14] include(::String) at .\client.jl:424
   [15] top-level scope at C:\Users\yahyaaba\Documents\GitHub\StaticCompiler.jl\test\runtests.jl:7
   [16] top-level scope at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.3\Test\src\Test.jl:1107   
   [17] top-level scope at C:\Users\yahyaaba\Documents\GitHub\StaticCompiler.jl\test\runtests.jl:7
   [18] include_string(::Module, ::String, ::String) at .\loading.jl:1075
   [19] (::Atom.var"#139#144"{String,String,Module})() at C:\Users\yahyaaba\.julia\packages\Atom\lBERI\src\eval.jl:138   [20] withpath(::Atom.var"#139#144"{String,String,Module}, ::String) at C:\Users\yahyaaba\.julia\packages\CodeTools\xGemk\src\utils.jl:30
   [21] withpath(::Function, ::String) at C:\Users\yahyaaba\.julia\packages\Atom\lBERI\src\eval.jl:47
   [22] #138 at C:\Users\yahyaaba\.julia\packages\Atom\lBERI\src\eval.jl:135 [inlined]
   [23] with_logstate(::Atom.var"#138#143"{String,String,Module}, ::Base.CoreLogging.LogState) at .\logging.jl:395    
   [24] with_logger at .\logging.jl:491 [inlined]
   [25] #137 at C:\Users\yahyaaba\.julia\packages\Atom\lBERI\src\eval.jl:134 [inlined]
   [26] hideprompt(::Atom.var"#137#142"{String,String,Module}) at C:\Users\yahyaaba\.julia\packages\Atom\lBERI\src\repl.jl:85
   [27] macro expansion at C:\Users\yahyaaba\.julia\packages\Atom\lBERI\src\eval.jl:133 [inlined]
   [28] macro expansion at C:\Users\yahyaaba\.julia\packages\Media\ItEPc\src\dynamic.jl:24 [inlined]
   [29] (::Atom.var"#136#141")(::Dict{String,Any}) at C:\Users\yahyaaba\.julia\packages\Atom\lBERI\src\eval.jl:122    
   [30] handlemsg(::Dict{String,Any}, ::Dict{String,Any}) at C:\Users\yahyaaba\.julia\packages\Atom\lBERI\src\comm.jl:164
   [31] (::Atom.var"#19#21"{Array{Any,1}})() at .\task.jl:333

cglobal: Error During Test at C:\Users\yahyaaba\Documents\GitHub\StaticCompiler.jl\test\ccalls.jl:28
  Test threw exception
  Expression: f() == #= C:\Users\yahyaaba\Documents\GitHub\StaticCompiler.jl\test\ccalls.jl:28 =# @jlrun(f())
  IOError: could not spawn `gcc -shared -fPIC -o test.so '-LC:\Julia-1.3.0\bin/../lib' -ljulia test.o`: no such file or directory (ENOENT)
  Stacktrace:
   [1] _spawn_primitive(::String, ::Cmd, ::Array{Any,1}) at .\process.jl:99
   [2] setup_stdios(::Base.var"#554#555"{Cmd}, ::Array{Any,1}) at .\process.jl:112
   [3] _spawn at .\process.jl:111 [inlined]
   [4] #run#565(::Bool, ::typeof(run), ::Cmd) at .\process.jl:439
   [5] (::Base.var"#kw##run")(::NamedTuple{(:wait,),Tuple{Bool}}, ::typeof(run), ::Cmd) at .\none:0
   [6] macro expansion at C:\Users\yahyaaba\Documents\GitHub\StaticCompiler.jl\test\jlrun.jl:45 [inlined]
   [7] macro expansion at C:\Users\yahyaaba\Documents\GitHub\StaticCompiler.jl\test\ccalls.jl:28 [inlined]
   [8] macro expansion at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.3\Test\src\Test.jl:1107 [inlined]
   [9] top-level scope at C:\Users\yahyaaba\Documents\GitHub\StaticCompiler.jl\test\ccalls.jl:27

Test Summary: | Error  Total
ccalls        |     2      2
  ccalls      |     1      1
  cglobal     |     1      1
ERROR: LoadError: Some tests did not pass: 0 passed, 0 failed, 2 errored, 0 broken.
in expression starting at C:\Users\yahyaaba\Documents\GitHub\StaticCompiler.jl\test\runtests.jl:6

But testing the API example in Readme seems to generate cos file correctly. How can I test the generated o file?

aminya commented 4 years ago

I found the reason: https://github.com/JuliaLang/julia/blob/46ce4d79337bdd257ee2e3d2f4bb1c55ff0a5030/base/libc.jl#L115

usleep works only in Linux

aminya commented 4 years ago

Closed by https://github.com/tshort/StaticCompiler.jl/pull/3