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

fatal error C1083: Cannot open include file: 'alloca.h #87

Open
emum8 opened this issue Oct 1, 2016 · 13 comments
Open

fatal error C1083: Cannot open include file: 'alloca.h #87

emum8 opened this issue Oct 1, 2016 · 13 comments

Comments

@emum8
Copy link

emum8 commented Oct 1, 2016

src/python/core.c(2): fatal error C1083: Cannot open include file: 'alloca.h

': No such file or directory
error: command 'E:\apps\Visual Studio 2015\VC\BIN\x86_amd64\cl.exe' fa
iled with exit status 2

I get this error when trying to pip install pyethash

@emum8
Copy link
Author

emum8 commented Oct 1, 2016

It fails when installing pyethash

@emum8
Copy link
Author

emum8 commented Oct 1, 2016

I tried cloning the repo and removing alloca.h from the src/python, it gives this error:

E:\apps\Visual Studio 2015\VC\BIN\x86_amd64\link.exe /nologo /INCREMENTAL:NO

/LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:c:\users\emu\appdata\l
ocal\programs\python\python35\Libs /LIBPATH:e:\projects\ethereum\ethx\venv\libs
/LIBPATH:e:\projects\ethereum\ethx\venv\PCbuild\amd64 "/LIBPATH:E:\apps\Visual S
tudio 2015\VC\LIB\amd64" "/LIBPATH:E:\apps\Visual Studio 2015\VC\ATLMFC\LIB\amd6
4" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.10586.0\ucrt\x64" "
/LIBPATH:C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\lib\um\x64" "/LIBPAT
H:C:\Program Files (x86)\Windows Kits\10\lib\10.0.10586.0\um\x64" /EXPORT:PyInit
_pyethash build\temp.win-amd64-3.5\Release\src/python/core.obj build\temp.win-am
d64-3.5\Release\src/libethash/io.obj build\temp.win-amd64-3.5\Release\src/libeth
ash/internal.obj build\temp.win-amd64-3.5\Release\src/libethash/sha3.obj build\t
emp.win-amd64-3.5\Release\src/libethash/util_win32.obj build\temp.win-amd64-3.5
Release\src/libethash/io_win32.obj build\temp.win-amd64-3.5\Release\src/libethas
h/mmap_win32.obj /OUT:build\lib.win-amd64-3.5\pyethash.cp35-win_amd64.pyd /IMPLI
B:build\temp.win-amd64-3.5\Release\src/python\pyethash.cp35-win_amd64.lib
core.obj : warning LNK4197: export 'PyInit_pyethash' specified multiple time
s; using first specification
Creating library build\temp.win-amd64-3.5\Release\src/python\pyethash.cp3
5-win_amd64.lib and object build\temp.win-amd64-3.5\Release\src/python\pyethash.
cp35-win_amd64.exp
io_win32.obj : error LNK2001: unresolved external symbol __imp_SHGetFolderPa
thA
build\lib.win-amd64-3.5\pyethash.cp35-win_amd64.pyd : fatal error LNK1120: 1
unresolved externals
error: command 'E:\apps\Visual Studio 2015\VC\BIN\x86_amd64\link.exe'
failed with exit status 1120

@coreyalane
Copy link

I'm still getting these same errors with pyethash through pip. Did you ever find a resolution to this?

@artemistomaras
Copy link

Has anyone found any solution to this?

@dzabur
Copy link

dzabur commented Feb 13, 2018

my solution for this:

  1. install mingw & set windows enviroment path to mingw/bin
  2. create file python27/Lib/distutils/distutils.cfg
    and put in it:
    [build]
    compiler=mingw32
    [build_ext]
    compiler=mingw32
  3. in core.c change alloca.h to malloc.h
  4. in src/libethhash/util_win32.c
    comment out the whole debugf function
  5. python setup.py install
    and it worked finally

@richbram
Copy link

richbram commented Feb 15, 2018

dzabur. I tried this and i got further but now:

C:\MinGW\bin\gcc.exe -shared -s build\temp.win-amd64-2.7\Release\src\python\core.o build\temp.win-amd64-2.7\Release\src\libethash\io.o build\temp.win-amd64-2.7\Release\src\libethash\internal.o build\temp.win-amd64-2.7\Release\src\libethash\sha3.o build\temp.win-amd64-2.7\Release\src\libethash\util_win32.o build\temp.win-amd64-2.7\Release\src\libethash\io_win32.o build\temp.win-amd64-2.7\Release\src\libethash\mmap_win32.o build\temp.win-amd64-2.7\Release\src\python\pyethash.def -LC:\Python27\libs -LC:\Python27\PCbuild\amd64 -LC:\Python27\PC\VS9.0\amd64 -lpython27 -lmsvcr90 -o build\lib.win-amd64-2.7\pyethash.pyd
build\temp.win-amd64-2.7\Release\src\python\core.o:core.c:(.text+0x5e): undefined reference to `_imp__PyArg_ParseTuple'

Any ideas? I know it has something to do with 32 vs 64. I thought everything I am running related to Python is 64 bit ....

@richbram
Copy link

I was able to figure it out. It was still pointing to the 32 bit version of MWing.

@08zhangyi
Copy link

When I do as @dzabur saying, I get another issue like "previous declaration of 'printf' was here":

In file included from src/libethash/util_win32.c:23:0:
src/libethash/util.h:32:16: error: conflicting types for 'printf'
#define debugf printf
^
src/libethash/util_win32.c:29:6: note: in expansion of macro 'debugf'
void debugf(char const* str, ...)
^~~~~~
In file included from src/libethash/util_win32.c:22:0:
F:/MinGW/mingw64/x86_64-w64-mingw32/include/stdio.h:380:15: note: previous declaration of 'printf' was here
int __cdecl printf(const char * restrict _Format,...);
^~~~~~
error: command 'F:\MinGW\mingw64\bin\gcc.exe' failed with exit status 1

How to solve this new problem?

@08zhangyi
Copy link

I try to comment out the whole debugf function in src/libethhash/util_win32.c, but a new problem arise:

F:/MinGW/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lmsvcr140
collect2.exe: error: ld returned 1 exit status
error: command 'F:\MinGW\mingw64\bin\gcc.exe' failed with exit status 1

@08zhangyi
Copy link

@skyguy126,in the path: ethash/src/python/core.c

@skyguy126
Copy link

skyguy126 commented Mar 26, 2018

@08zhangyi I'm now getting undefined reference errors, how did you manage to fix these. I am pretty sure I'm using a 64bit version of MinGW, is there any way to check.

build\temp.win-amd64-2.7\Release\src\python\core.o:core.c:(.text+0x183): undefined reference to `_imp__Py_BuildValue'
build\temp.win-amd64-2.7\Release\src\python\core.o:core.c:(.text+0x1ad): undefined reference to `_imp__PyExc_ValueError'
build\temp.win-amd64-2.7\Release\src\python\core.o:core.c:(.text+0x1b8): undefined reference to `_imp__PyErr_SetString'
build\temp.win-amd64-2.7\Release\src\python\core.o:core.c:(.text+0x1e8): undefined reference to `_imp__PyArg_ParseTuple'
build\temp.win-amd64-2.7\Release\src\python\core.o:core.c:(.text+0x228): undefined reference to `_imp__Py_BuildValue'
build\temp.win-amd64-2.7\Release\src\python\core.o:core.c:(.text+0x266): undefined reference to `_imp__PyArg_ParseTuple'
build\temp.win-amd64-2.7\Release\src\python\core.o:core.c:(.text+0x2b0): undefined reference to `_imp__Py_BuildValue'
build\temp.win-amd64-2.7\Release\src\python\core.o:core.c:(.text+0x2e1): undefined reference to `_imp__PyExc_ValueError'
build\temp.win-amd64-2.7\Release\src\python\core.o:core.c:(.text+0x2ec): undefined reference to `_imp__PyErr_SetString'
build\temp.win-amd64-2.7\Release\src\python\core.o:core.c:(.text+0x32c): undefined reference to `_imp__Py_InitModule4'
build\temp.win-amd64-2.7\Release\src\python\core.o:core.c:(.text+0x347): undefined reference to `_imp__PyModule_AddIntConstant'

EDIT: Now I am only getting the error in the last line of what is pasted above.

@08zhangyi
Copy link

@skyguy126 , sorry, I have not meet these problems and I think the source code doesn't has any variuables like imp__Py_BuildValue. I think you can modify these variables' names by deleting the prefix 'imp'

@skyguy126
Copy link

@08zhangyi Figured it out, you have to add -D MS_WIN64 to the compile flags in setup.py. For future reference I guess.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants