WinRPM.jl icon indicating copy to clipboard operation
WinRPM.jl copied to clipboard

Problems with gcc

Open dhoegh opened this issue 10 years ago • 4 comments

I am working on solving JuliaLang/julia#9973. The changes I am working on to close JuliaLang/julia#9973 can be found here: https://github.com/dhoegh/julia/commit/a9bb795846fc1d29bd258819d5acc95b47176b5b

During this I have bumped into some problems with mingw installed by WinRPM. It feels like the mingw build is somehow broke, here is my case. When I try to run the following command in windows cmd:

C:\Users\Hoegh\Julia-0.4.0-dev_19_1>C:\Users\Hoegh\.julia\v0.4\WinRPM\deps\usr\x86_64-w64-mingw32\sys-root\mingw\bin\gcc.exe -g -Wl,--no-as-needed -D_WIN32_WINNT=0x0600 -IC:\Users\Hoegh\Julia-0.4.0-dev_19_1\include\julia -IC:\Users\Hoegh\src -IC:\Users\Hoegh\src/support -IC:\Users\Hoegh\usr/include C:\Users\Hoegh\AppData\Local\Temp\jul268E.tmp\start_func.c -o C:\Users\Hoegh\Julia-0.4.0-dev_19_1\bin\eps_to_pdf.exe

It pops up with an error that states libgmp-10.dll is missing

If I add the bin folder in mingw to the path as suggested here http://stackoverflow.com/questions/6951938/libgmp-10-dll-is-missing I get:

C:\Users\Hoegh\Julia-0.4.0-dev_19_1>SET PATH=%PATH%;C:\Users\Hoegh\.julia\v0.4\WinRPM\deps\usr\x86_64-w64-mingw32\sys-root\mingw\bin

C:\Users\Hoegh\Julia-0.4.0-dev_19_1>C:\Users\Hoegh\.julia\v0.4\WinRPM\deps\usr\x86_64-w64-mingw32\sys-root\mingw\bin\gcc.exe -g -Wl,--no-as-needed -D_WIN32_WINNT=0x0600 -IC:\Users\Hoegh\Julia-0.4.0-dev_19_1\include\julia -IC:\Users\Hoegh\src -IC:\Users\Hoegh\src/support -IC:\Users\Hoegh\usr/include C:\Users\Hoegh\AppData\Local\Temp\jul268E.tmp\start_func.c -o C:\Users\Hoegh\Julia-0.4.0-dev_19_1\bin\eps_to_pdf.exe
In file included from C:\Users\Hoegh\Julia-0.4.0-dev_19_1\include\julia/julia.h:10:0,
                 from C:\Users\Hoegh\AppData\Local\Temp\jul268E.tmp\start_func.c:1:
C:\Users\Hoegh\Julia-0.4.0-dev_19_1\include\julia/libsupport.h:6:20: fatal error: stdlib.h: No such file or directory
 #include <stdlib.h>
                    ^
compilation terminated.

If I change to use the gcc registered in my path by Anaconda, then it builds succesfully. The gcc shipped with my Anaconda is: 4.7.0.

By looking at Anaconda's mingw I saw that the include folder where in the x86_64-w64-mingw32 folder and not in the sys-root\mingw folder so I tried to copy the include folder sys-root\\mingw\\include to sys-root\\mingw\\x86_64-w64-mingw32\\include and reran the command and it worked. However, this is kind of a hack and should not be necessary. I hope some of you have a deeper understanding of what could be wrong.

dhoegh avatar Jan 31 '15 20:01 dhoegh

Nevermind, sys-root is already under an arch-specific folder. It looks like whatever they're doing to try to make the default include paths built into this gcc relocatable isn't working quite right. If you add -I to where the includes actually are, does it work? I don't that's too bad of a solution. We could contact the maintainers of the openSUSE mingw project and ask them about it, they're quite responsive to bug reports.

tkelman avatar Feb 01 '15 00:02 tkelman

Thank you it did the trick. If some of the paths are wrong it could also explain why I need to set the path temporarily to the bin folder.

dhoegh avatar Feb 01 '15 01:02 dhoegh

Breadcrumb: in using this opensuse-built gcc to compile Julia itself, I did have to create a link here https://github.com/JuliaLang/julia/blob/398cea6e875c3acfc813badac270d9312b5a12ca/contrib/windows/get_toolchain.sh#L56 from sys-root/mingw/include to sys-root/mingw/x86_64-w64-mingw32/include. Still kind of a hack, but seems to work.

tkelman avatar Jul 31 '15 05:07 tkelman

This issue is still open, a workaround is to run:

gcc -I$(Pkg.dir("WinRPM", "deps", "usr", "$(Sys.ARCH)-w64-mingw32", "sys-root", "mingw", "include"))

Where should this issue be reported?

lucatrv avatar Nov 19 '17 21:11 lucatrv