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

Error compiling task.c on Windows 7 #258

Closed
antoine-soubret opened this issue May 17, 2017 · 10 comments
Closed

Error compiling task.c on Windows 7 #258

antoine-soubret opened this issue May 17, 2017 · 10 comments
Labels

Comments

@antoine-soubret
Copy link

Hi,

I am trying to run Turing on a Windows 7 machine with Julia 0.5.2.
Here is my configuration as returned by the versioninfo julia command:

Julia Version 0.5.2
Commit f4c6c9d (2017-05-06 16:34 UTC)
Platform Info:
OS: Windows (x86_64-w64-mingw32)
CPU: Intel(R) Core(TM) i5-6300U CPU @ 2.40GHz
WORD_SIZE: 64
BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell)
LAPACK: libopenblas64_
LIBM: libopenlibm
LLVM: libLLVM-3.7.1 (ORCJIT, broadwell)

Unfortunately, I get errors when julia is trying to compile the task.c file.
When I first ran the command Pkg.build("Turing") in Julia, I got an error suggesting to add the flag -march=pentium4 to compile task.c (see Error message I below).

Then, I ran the gcc compilation command in a separate Windows terminal in adding this flag.
However, I still got an error asking to specify the option -std=c99, -std=gnu99, -std=c11 or -std=gnu11 (see Error message II below).
Finally, I have tried all the different options but I always get an error (see Error message III for the -std=c99 option).

Does it mean that Turing is not working on Windows 7 or that my compiler toolset is not appropriate?

For information, I am using gcc 4.9.3 coming with the R development toolset (i.e. Rtools 3.4 https://cran.r-project.org/bin/windows/Rtools/).

Thanks for your help,

Antoine Soubret

Error message I
Pkg.build("Turing")

INFO: Building Rmath
INFO: Building Turing
process_begin: CreateProcess(NULL, uname, ...) failed.
mingw32-make: makefile:15: pipe: No error
process_begin: CreateProcess(NULL, uname, ...) failed.
mingw32-make: makefile:17: pipe: No error
gcc -DJULIA_ENABLE_THREADING=1 -DJULIA_INIT_DIR="C:\\Portable\\APPS\\Julia\\Julia-0.5.2\\lib" -IC:\Portable\APPS\Julia\Julia-0.5.2\include\julia -O2 -shared -fPIC task.c -LC:\Portable\APPS\Julia\Julia-0.5.2\bin -ljulia -lopenlibm -o libtask.dll
task.c:1:0: warning: -fPIC ignored for target (all code is position independent)
/*
^
In file included from C:\Portable\APPS\Julia\Julia-0.5.2\include\julia/julia.h:59:0,
from task.c:6:
C:\Portable\APPS\Julia\Julia-0.5.2\include\julia/julia_threads.h:17:4: error: #error Julia can only be built for architectures above Pentium 4. Pass -march=pentium4, or set MARCH=pentium4 and ensure that -march is not passed separately with an older architecture.
error Julia can only be built for architectures above Pentium 4. Pass -march=pentium4, or set MARCH=pentium4 and ensure that -march is not passed separately with an older architecture.
^
In file included from task.c:6:0:
C:\Portable\APPS\Julia\Julia-0.5.2\include\julia/julia.h: In function 'jl_eh_restore_state':
C:\Portable\APPS\Julia\Julia-0.5.2\include\julia/julia.h:1513:9: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
for (size_t i = locks->len;i > eh->locks_len;i--)
^
C:\Portable\APPS\Julia\Julia-0.5.2\include\julia/julia.h:1513:9: note: use option -std=c99, -std=gnu99, -std=c11 or -std=gnu11 to compile your code
makefile:12: recipe for target 'task' failed
mingw32-make: *** [task] Error 1
===============================[ ERROR: Turing]================================
LoadError: failed process: Process(mingw32-make, ProcessExited(2)) [2]
while loading C:\Portable\APPS\Julia\JuliaPackages\v0.5\Turing\deps\build.jl, in expression starting on line 2
===============================================================================================================[ BUILD ERRORS]================================
WARNING: Turing had build errors.
packages with build errors remain installed in C:\Portable\APPS\Julia\JuliaPackages\v0.5
build the package(s) and all dependencies with Pkg.build("Turing")
build a single package by running its deps/build.jl script
================================================================================

Error message II
gcc -DJULIA_ENABLE_THREADI NG=1 -march=pentium4 -DJULIA_INIT_DIR=\"C:\\\\Portable\\\\APPS\\\\Julia\\\\Julia -0.5.2\\\\lib\" -IC:\\Portable\\APPS\\Julia\\Julia-0.5.2\\include\\julia -O2 -shared -fPIC task.c -LC:\\Portable\\APPS\\Julia\\Julia-0.5.2\\bin -ljulia -lopenlibm -o libtask.dll

task.c:1:0: warning: -fPIC ignored for target (all code is position independent)
/*
^
In file included from task.c:6:0:
C:\Portable\APPS\Julia\Julia-0.5.2\include\julia/julia.h: In function 'jl_
eh_restore_state':
C:\Portable\APPS\Julia\Julia-0.5.2\include\julia/julia.h:1513:9: error: 'f
or' loop initial declarations are only allowed in C99 or C11 mode
for (size_t i = locks->len;i > eh->locks_len;i--)
^
C:\Portable\APPS\Julia\Julia-0.5.2\include\julia/julia.h:1513:9: note: use
option -std=c99, -std=gnu99, -std=c11 or -std=gnu11 to compile your code

Error message III
C:\Portable\APPS\Julia\JuliaPackages\v0.5\Turing\deps>gcc -DJULIA_ENABLE_THREADI NG=1 -march=pentium4 -std=c99 -DJULIA_INIT_DIR=\"C:\\\\Portable\\\\APPS\\\\Julia \\\\Julia-0.5.2\\\\lib\" -IC:\\Portable\\APPS\\Julia\\Julia-0.5.2\\include\\julia -O2 -shared -fPIC task.c -LC:\\Portable\\APPS\\Julia\\Julia-0.5.2\\bin -ljulia -lopenlibm -o libtask.dll

task.c:1:0: warning: -fPIC ignored for target (all code is position independent)
/*
^
In file included from C:\Portable\APPS\Julia\Julia-0.5.2\include\julia/lib
support.h:12:0,
from C:\Portable\APPS\Julia\Julia-0.5.2\include\julia/jul
ia.h:12,
from task.c:6:
C:\Portable\APPS\Julia\Julia-0.5.2\include\julia/utils.h: In function 'Byt
eSwap64':
C:\Portable\APPS\Julia\Julia-0.5.2\include\julia/utils.h:68:3: warning: im
plicit declaration of function 'asm' [-Wimplicit-function-declaration]
asm("xchgl %0,%1":
^
C:\Portable\APPS\Julia\Julia-0.5.2\include\julia/utils.h:68:23: error: exp
ected ')' before ':' token
asm("xchgl %0,%1":
^

@yebai
Copy link
Member

yebai commented May 17, 2017

Hi Antoine,

Turing does work on Windows machines. The compiling script for task.c depends on both MinGW and msys2. Try install msys2 from the following link and make sure the msys2\bin added to PATH.

http://www.msys2.org/

@yebai yebai added the doc label May 17, 2017
@miguelraz
Copy link

miguelraz commented Jul 6, 2017

Hello!
I cannot get this working on windows.

julia> Pkg.build("Turing")                                                                       
 INFO: Building Rmath                                                                             
 INFO: Building WinRPM                                                                           
  INFO: Downloading 
https://cache.julialang.org/http://download.opensuse.org/repositories/windows:/mingw:/win32/openSUSE_Leap_42.2/repodata/repomd.xml                                               
 INFO: Downloading https://cache.julialang.org/http://download.opensuse.org/repositories/windows:/mingw:/win64/openSUSE_Leap_42.2/repodata/repomd.xml                                               
 INFO: Building Cairo                                                                              
WARNING: BinDeps.shlib_ext is deprecated. likely near C:\Users\miguel\.julia\v0.6\Cairo\deps\build.jl:112                                
 INFO: Updating WinRPM package list                                                                
INFO: Downloading https://cache.julialang.org/http://download.opensuse.org/repositories/windows:/mingw:/win32/openSUSE_Leap_42.2/repodata/repomd.xml                                                
INFO: Downloading https://cache.julialang.org/http://download.opensuse.org/repositories/windows:/mingw:/win64/openSUSE_Leap_42.2/repodata/repomd.xml 
   INFO: Building Turing                                                                             ========================================[ ERROR: Turing ]=========================================                                                                                                  LoadError: could not spawn `mingw32-make`: no such file or directory (ENOENT)                     while loading C:\Users\miguel\.julia\v0.6\Turing\deps\build.jl, in expression starting on line 2                                                                                                    ==================================================================================================                                                                                                  =========================================[ BUILD ERRORS ]=========================================                                                                                                  WARNING: Turing had build errors.                                                                                                                                                                    - packages with build errors remain installed in C:\Users\miguel\.julia\v0.6                  
 - build the package(s) and all dependencies with `Pkg.build("Turing")` 
   - build a single package by running its `deps/build.jl` script  

Should I PR the README.md with a workaround/announcement that Windows10 doesn't run out of the box?

Julia Version 0.6.0-rc3.0     
Commit ad290e93e4* (2017-06-07 11:53 UTC)                                                       
  Platform Info:
 OS: Windows (x86_64-w64-mingw32)
CPU: AMD Athlon(tm) II X2 250 Processor
 WORD_SIZE: 64 
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Barcelona)                                LAPACK: libopenblas64_
LIBM: libopenlibm                                                                                
 LLVM: libLLVM-3.9.1 (ORCJIT, amdfam10) 

@xukai92
Copy link
Member

xukai92 commented Jul 6, 2017

Turing.jl does not yet support Julia 0.6. Can you try if it works with 0.5 instead?

@miguelraz
Copy link

miguelraz commented Jul 6, 2017

I got the same error again.

========================================[ ERROR:Turing]=========================================
 LoadError: could not spawn `mingw32-make`: no such file or directory (ENOENT)  

@xukai92
Copy link
Member

xukai92 commented Jul 6, 2017

@yebai Do you know how to resolve that?

@miguelraz
Copy link

No - I have had issues with mingw32 before, but installed it and solved the previous problem.
Any links would be very helpful - I've exhausted the google options so far.

@yebai
Copy link
Member

yebai commented Jul 6, 2017

@miguelraz Turing depends on a small c file (task.c) in order to support efficient particle MCMC enference. Currently, we need MinGW32 and Msys2 to build this c library. You should install these libraries and make them available in the PATH environment variable.

@FishAres
Copy link

Probably silly question, but after adding mingw32/bin to system environment variables Julia still returns "can't spawn mingw32-make: no such file or directory". Does this need to be added to the julia ENV["Path"]? How does one do that properly? It doesn't seem very intuitive.

Thanks!

@yebai
Copy link
Member

yebai commented Apr 18, 2018

Closed in favour of #422.

@yebai yebai closed this as completed Apr 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants