aeonix / aeon-legacy

Legacy Aeon coin sources from before May 2018 code rebase
222 stars 117 forks source link

macos src/crypto/oaes_lib.c:34:10: fatal error: 'malloc.h' file not found #85

Closed vcambur closed 6 years ago

vcambur commented 6 years ago

Hi, MacOS and some others do not need malloc.h Is it possible to incorporate the following snippet from monero ?

// OS X, FreeBSD, and OpenBSD don't need malloc.h
#if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__OpenBSD__) \
  && !defined(__DragonFly__)
 #include <malloc.h>
#endif

It's the only show stopper for macos Thank you for your hard work

sammy007 commented 6 years ago

Even if it's maybe needed, it's not a show stopper for OSX because it works at least for me. Check out also https://github.com/sammy007/homebrew-cryptonight

vcambur commented 6 years ago

I just tried to compile directly, not using homebrew and it stopped at

[ 21%] Building C object src/CMakeFiles/crypto.dir/crypto/hash.c.o
[ 22%] Building C object src/CMakeFiles/crypto.dir/crypto/jh.c.o
[ 23%] Building C object src/CMakeFiles/crypto.dir/crypto/keccak.c.o
[ 24%] Building C object src/CMakeFiles/crypto.dir/crypto/oaes_lib.c.o
/Users/none/src/aeon-0.9.13.0/src/crypto/oaes_lib.c:34:10: fatal error: 'malloc.h' file not found
#include <malloc.h>
         ^~~~~~~~~~
1 error generated.
make[3]: *** [src/CMakeFiles/crypto.dir/crypto/oaes_lib.c.o] Error 1
make[2]: *** [src/CMakeFiles/crypto.dir/all] Error 2
make[1]: *** [all] Error 2
make: *** [build-release] Error 2
➜  aeon-0.9.13.0
vcambur commented 6 years ago

Sammy007, I've just tried brew install aeon and got

➜  ~ brew install aeon
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 2 taps (homebrew/core, sammy007/cryptonight).
==> New Formulae
bwfmetaedit                  clac                         dvanalyzer                   gdcm                         libbitcoin-server            ssh-vault                    ykman
==> Updated Formulae
angular-cli                  citus                        erlang                       groonga                      librem                       ndpi                         selenium-server-standalone
apache-brooklyn-cli          coffeescript                 etcd                         gsmartcontrol                libsmi                       nedit                        sqlparse
apktool                      convox                       faac                         gtkextra                     libtensorflow                ninja                        stone-soup
app-engine-java              coreutils                    faad2                        heroku                       libuecc                      nss                          swimat
arangodb                     cppad                        faas-cli                     hh                           libwebsockets                numpy                        tarantool
autoconf-archive             cython                       fdroidserver                 idutils                      logstalgia                   orientdb                     telegraf
bandcamp-dl                  dbus                         fio                          influxdb                     mame                         osmfilter                    terragrunt
bazel                        digdag                       flow                         ipython                      mariadb                      osquery                      testssl
bluepill                     direnv                       fluent-bit                   jenkins                      mariadb@10.1                 paket                        tig
bower                        docker                       git-annex                    jfrog-cli-go                 metabase                     prometheus                   ttyd
bulk_extractor               docker-completion            git-lfs                      jhipster                     micro                        r                            twemcache
bullet                       dwarf                        glide                        jose                         mosquitto                    rom-tools                    twtxt
caf                          efl                          gnatsd                       kubernetes-cli               mpage                        s-nail                       typescript
chronograf                   elixir                       grafana                      lean-cli                     mycli                        sammy007/cryptonight/aeon    wxmaxima
==> Renamed Formulae
gitlab-ci-multi-runner -> gitlab-runner                              httpd24 -> httpd                                                     mobile-shell -> mosh

==> Installing aeon from sammy007/cryptonight
==> Downloading https://github.com/aeonix/aeon/archive/v0.9.13.0.tar.gz
==> Downloading from https://codeload.github.com/aeonix/aeon/tar.gz/v0.9.13.0
######################################################################## 100.0%
==> make
Last 15 lines from /Users/none/Library/Logs/Homebrew/aeon/01.make:
make[2]: *** [src/CMakeFiles/crypto.dir/all] Error 2
make[2]: *** Waiting for unfinished jobs....
[ 32%] Building CXX object src/CMakeFiles/cryptonote_core.dir/cryptonote_core/checkpoints.cpp.o
[ 33%] Building CXX object src/CMakeFiles/cryptonote_core.dir/cryptonote_core/cryptonote_basic_impl.cpp.o
[ 33%] Building CXX object src/CMakeFiles/cryptonote_core.dir/cryptonote_core/cryptonote_core.cpp.o
[ 34%] Building CXX object src/CMakeFiles/cryptonote_core.dir/cryptonote_core/cryptonote_format_utils.cpp.o
[ 35%] Building CXX object src/CMakeFiles/cryptonote_core.dir/cryptonote_core/difficulty.cpp.o
[ 36%] Building CXX object src/CMakeFiles/cryptonote_core.dir/cryptonote_core/miner.cpp.o
[ 37%] Building CXX object src/CMakeFiles/cryptonote_core.dir/cryptonote_core/tx_pool.cpp.o
[ 38%] Linking CXX static library libwallet.a
[ 38%] Built target wallet
[ 38%] Linking CXX static library libcryptonote_core.a
[ 38%] Built target cryptonote_core
make[1]: *** [all] Error 2
make: *** [build-release] Error 2

If reporting this issue please do so at (not Homebrew/brew or Homebrew/core):
https://github.com/sammy007/homebrew-cryptonight/issues

These open issues may also help:
Problem at "brew install --HEAD aeon -v" https://github.com/sammy007/homebrew-cryptonight/issues/8
Problem installing wallet on mac - Homebrew. https://github.com/sammy007/homebrew-cryptonight/issues/9
➜  ~ 

Compile fails because of malloc.h inclusion (homebrew log is attached) I'm on high sierra, maybe it's related somehow.

01.make.log

sammy007 commented 6 years ago

https://github.com/aeonix/aeon/blob/master/CMakeLists.txt#L19

It seems high sierra fucked up again. I didn't test on it yet. Previous versions contains /usr/include/malloc/ with malloc.h in it.

sammy007 commented 6 years ago

I see /usr/include/malloc/malloc.h on High Sierra (10.13). I have got clean system with brew & command line tools.

vcambur commented 6 years ago

I'm sorry, it's my fault, I just forgot to install comand line tools so there was no /usr/include at all. Cmake used everything from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include and it was ok but for malloc it just checked /usr/include/malloc/ and not /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/malloc/ I guess it would be good to require xcode-select --install before build or make cmake check /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/malloc too.

stoffu commented 6 years ago

@vcambur Thank you for reporting the solution, I also had the same issue after upgrading to macOS 10.12.

SHAmraq commented 6 years ago

I just tried and failed to install on OSX 10.12.6 - i don't know how fix the malloc.h file if I'm doing this brew install b/c I am an idiot.

aeon_install_error.log