ethereum / ethash

188 stars 515 forks source link

include alloca.h only on Linux #107

Closed Mischi closed 6 years ago

Mischi commented 6 years ago

Hi.

This PR only includes the alloca.h header if compiled for Linux systems.

It appears that the alloca.h header is only available on Linux systems. ALl BSD's and MacOS expose alloca through stdlib.h Windows exposes alloca through malloc.h

The Windows part is from @fireflystorm via #104

I've tested this patch under OpenBSD and it works fine.

This should close the issues #80, #87, #104,

Cheers, Fabian

References: stdlib.h http://man.openbsd.org/OpenBSD-6.3/alloca http://man.openbsd.org/FreeBSD-11.1/alloca http://man.openbsd.org/NetBSD-7.1/alloca http://man.openbsd.org/DragonFly-4.8.0/alloca https://www.unix.com/man-page/osx/3/alloca/ https://www.unix.com/man-page/opensolaris/3C/alloca/

alloca.h http://man.openbsd.org/Linux-4.13/alloca

Mischi commented 6 years ago

Just saw that all usages of alloca got removed by @xcthulhu in 950229acd6ae0554642ed2e17e6937179640b3ed... The include could just be removed then. I will close this PR in favor of PR #105.

Thanks, Fabian

rayrapetyan commented 5 years ago

So after 4 years this nasty "alloca.h" is still there in core.c, which makes this module (and all depending modules) fail to install on anything except Linux.

Here is a list of related opened issues\PRs: https://github.com/ethereum/ethash/issues/104 https://github.com/ethereum/ethash/issues/87 https://github.com/ethereum/ethash/issues/80 https://github.com/ethereum/ethash/pull/105

I've tried to remove #include "alloca.h" and it compiled fine on FreeBSD. As per #105 it works on Windows as well. Can someone try to remove it in Linux and confirm it compiles? After that we can finally drop it and close all issues\PRs above.

https://pypi.org/project/pyethash/ should be also updated after that.

Thanks.