ethash icon indicating copy to clipboard operation
ethash copied to clipboard

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

Open emum8 opened this issue 8 years ago • 13 comments

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 avatar Oct 01 '16 08:10 emum8

It fails when installing pyethash

emum8 avatar Oct 01 '16 08:10 emum8

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

emum8 avatar Oct 01 '16 08:10 emum8

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

coreyalane avatar Jun 21 '17 05:06 coreyalane

Has anyone found any solution to this?

artemistomaras avatar Sep 19 '17 08:09 artemistomaras

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

dzabur avatar Feb 13 '18 14:02 dzabur

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 avatar Feb 15 '18 07:02 richbram

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

richbram avatar Feb 15 '18 20:02 richbram

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 avatar Mar 20 '18 06:03 08zhangyi

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 avatar Mar 20 '18 06:03 08zhangyi

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

08zhangyi avatar Mar 26 '18 06:03 08zhangyi

@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.

skyguy126 avatar Mar 26 '18 07:03 skyguy126

@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'

08zhangyi avatar Mar 26 '18 07:03 08zhangyi

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

skyguy126 avatar Mar 26 '18 07:03 skyguy126