OSX Cross compiling not working: Missing boost osx Header - fatal error: ‘unistd.h’ file not found #10926

issue globaltoken openend this issue on July 25, 2017
  1. globaltoken commented at 12:02 pm on July 25, 2017: none

    Hey,

    If I compile OSX with Cross Compiling under Linux 14.04 LTS x64 it says if I do this step:

    make HOST=x86_64-apple-darwin11 DARWIN_SDK_PATH=$PWD/MacOSX10.11.sdk -j4

    Output:

    /home/globaltoken/wallet-compile/Compilers/compile-processor-osx/depends/work/download/native_biplist-0.9/biplist-0.9.tar.gz.temp: OK Extracting native_biplist… /home/globaltoken/wallet-compile/Compilers/compile-processor-osx/depends/sources/biplist-0.9.tar.gz: OK Preprocessing native_biplist… patching file biplist/init.py Configuring native_biplist… Building native_biplist… Traceback (most recent call last): File “setup.py”, line 6, in import ez_setup ImportError: No module named ez_setup make: *** [/home/globaltoken/wallet-compile/Compilers/compile-processor-osx/depends/work/build/x86_64-apple-darwin11/native_biplist/0.9-d766a97a608/./.stamp_built] Error 1

    But it doesnt crash it keeps going to compile OSX Wallets. The thing is that they dont work. If I try to run them on OSX it says “Cannot run binaries”

    My steps I did:

    Cloning the repos

    cd compile-processor-osx cd depends make HOST=x86_64-apple-darwin11 DARWIN_SDK_PATH=$PWD/MacOSX10.11.sdk -j4 cd .. ./autogen.sh # not required when building from tarball CONFIG_SITE=$PWD/depends/x86_64-apple-darwin11/share/config.site ./configure –prefix=/ make -j4

    Thanks!

  2. globaltoken renamed this:
    OSX Corss compiling ImportError: No module named ez_setup
    OSX Cross compiling ImportError: No module named ez_setup
    on Jul 25, 2017
  3. fanquake commented at 12:05 pm on July 25, 2017: member
    See this thread #8913, is the OSX SDK available?
  4. fanquake added the label Build system on Jul 25, 2017
  5. fanquake added the label MacOSX on Jul 25, 2017
  6. globaltoken commented at 12:08 pm on July 25, 2017: none
    Yeah I used the extract-osx-sdk.sh to get the MacOSX SDK Folder.
  7. globaltoken commented at 12:52 pm on July 25, 2017: none
    Okay I had missing dependencies but he’s not correctly building. If I build by these steps above he is compiling the qt and everything but if I run them under OSX OSX is saying “cannot execute binary file” - what did i miss ?
  8. globaltoken commented at 1:15 pm on July 25, 2017: none

    Okay, when he’s compiling I got everytime when he’s compiling boost 1.64.0 this Error:

    In file included from libs/program_options/src/value_semantic.cpp:7: In file included from ./boost/program_options/config.hpp:10: In file included from ./boost/config.hpp:57: In file included from ./boost/config/platform/macos.hpp:28: ./boost/config/posix_features.hpp:18:15: fatal error: ‘unistd.h’ file not found

    include <unistd.h>

  9. globaltoken commented at 1:24 pm on July 25, 2017: none
    The DARWIN_SDK_PATH=$PWD/MacOSX10.11.sdk -j4 was wrong I think, I’m compiling again and let you know about the result.
  10. globaltoken commented at 1:53 pm on July 25, 2017: none

    Okay, I used now the correct DARWIN_SDK_PATH but it says always:

    l -gdwarf-2 -fexceptions -pthread -arch x86_64 -DBOOST_ALL_NO_LIB=1 -DNDEBUG -I"." -c -o “bin.v2/libs/program_options/build/darwin-4.2.1/release/link-static/threading-multi/cmdline.o” “libs/program_options/src/cmdline.cpp”

    In file included from libs/program_options/src/cmdline.cpp:7: In file included from ./boost/program_options/config.hpp:10: In file included from ./boost/config.hpp:57: In file included from ./boost/config/platform/macos.hpp:28: ./boost/config/posix_features.hpp:18:15: fatal error: ‘unistd.h’ file not found

    include <unistd.h>

              ^
    

    1 error generated.

  11. globaltoken commented at 2:14 pm on July 25, 2017: none

    Here it skipped & failed :(

    In file included from ./boost/thread/detail/config.hpp:11: In file included from ./boost/config.hpp:57: In file included from ./boost/config/platform/macos.hpp:28: ./boost/config/posix_features.hpp:18:15: fatal error: ‘unistd.h’ file not found

    include <unistd.h>

              ^
    

    1 error generated. …failed darwin.compile.c++ bin.v2/libs/thread/build/darwin-4.2.1/release/link-static/threading-multi/pthread/thread.o… …skipped <pbin.v2/libs/thread/build/darwin-4.2.1/release/link-static/threading-multi>libboost_thread-mt.a(clean) for lack of <pbin.v2/libs/thread/build/darwin-4.2.1/release/link-static/threading-multi>pthread/thread.o… …skipped <pbin.v2/libs/thread/build/darwin-4.2.1/release/link-static/threading-multi>libboost_thread-mt.a for lack of <pbin.v2/libs/thread/build/darwin-4.2.1/release/link-static/threading-multi>pthread/thread.o… …skipped <pstage/lib>libboost_thread-mt.a for lack of <pbin.v2/libs/thread/build/darwin-4.2.1/release/link-static/threading-multi>libboost_thread-mt.a… …failed updating 49 targets… …skipped 30 targets… …updated 45 targets…

  12. jimhashhq commented at 6:29 pm on July 25, 2017: none
    It sounds like you are doing a cross-compile from Linux, targeting Mac OS-X here. I just wanted to point out that I just now posted some personal macOS Sierra native build/install/run findings to bitcointalk.org.
    Of interest to you, I could not get bitcoind or bitcoin-cli to run unless I set DYLD_LIBRARY_PATH as described there. The supplied build/run environment in that post should be self-contained and steps outlined should be very repeatable for macOS Sierra at least. I only mention this in case you need to get a build out quickly, and are running into endless obstacles with cross compiles. Years ago I did many Unix Auto Tools builds and found cross-compiles to be finicky and frustrating. I feel for you here – good luck – hang in there!
  13. globaltoken commented at 6:34 pm on July 25, 2017: none

    Thanks mate, that means you are compiling on OSX? Is there a possibility to compile on Linux that OSX with that Attribute DYLD_LIBRARY_PATH ?

    I’m very sure that it fails because of there is not the header File as boost require. Any suggestions how to get it ?

    Cheers.

  14. jimhashhq commented at 7:21 pm on July 25, 2017: none

    DYLD_LIBRARY_PATH is only to allow macOS to locate dynamic libraries at runtime, basically the same as LD_LIBRARY_PATH works on Unix systems. So sorry, no, DYLD_LIBRARY_PATH is not a build environment setting, but a runtime-only setting.

    For compile time header file location/inclusion, you may look at explicitly setting CPPFLAGS, though this should not really be needed if the Autotools probe is working properly on your system and all dependencies (transitive or otherwise) are all properly in place. If you do set CPPFLAGS, then you will probably need to set LDFLAGS as well to pick up the corresponding platform libraries.

    Really, the point I was trying to make up above is that I personally found cross compiling to be pretty darn finicky in my professional experience. Further, some might consider cross-compiling to be outside the purview of Bitcoin-specific questions, and really more of a Unix Autotools-specific question.

    I am suggesting here that you might want to go another route here – instead of cross-compiling, try building native on macOS. Especially since sometimes these cross-compile tasks can turn into endless “onion peeling” of issue after issue, after issue, whereas native builds can be more straightforward. In either case you will need runtime environment settings to run natively anyways.

    For more on Autotools, see the book: Autotools A Practitioner’s Guide to GNU Autoconf, Automake, and Libtool by John Calcote

    Good luck, I feel for you here.

  15. globaltoken commented at 7:26 pm on July 25, 2017: none

    Okay thanks, the thing is that I don’t have a Mac and I just have the possibility to compile on Unix :(

    So any other Solutions how to pass it on Linux ?

  16. jimhashhq commented at 8:45 pm on July 25, 2017: none

    Above, I read

    if I run them under OSX OSX is saying..

    If you’re determined to cross-compile, you probably should read the book referenced above; it is available on https://www.safaribooksonline.com free for some initial term. I checked and there is indeed a chapter on cross compiling. Really though, I don’t think Autotools cross compiling is a Bitcoin issue; you might want to search around for other folks doing cross compiles of native Linux apps for macOS for more specifics. Good luck with everything – keep at it!

  17. globaltoken commented at 9:11 pm on July 25, 2017: none
    What I mean how did the actual Devs did it ? To compile these files?
  18. jimhashhq commented at 11:33 pm on July 25, 2017: none

    I apologize for misinterpreting the question, I am very sorry. Mac OS X Build Instructions and Notes; is the currently endorsed procedure for producing binaries for Mac OS-X, but I’m not sure that’s what you are asking.

    In general, when running into a build issue and starting over, a thorough approach would be the following steps:

    1. make clean
    2. rm configure
    3. ./autogen.sh –with-gui=yes
    4. ./configure
    5. (then do your make command here)

    (these commands would be run from your project workspace). It’s tempting to want to re-start the build at step 3 (or worse yet, step 5), but steps 1&2 scrub the development workspace to ensure that no artifacts are left over from a prior broken build, and steps 3&4 ensure that any environment changes/fixes are re-incorporated into newly generated “makefiles” (really “Makefile.in” files).

    If you rerun the above steps and upload your configure.log to pastebin or somewhere, I could have a look. Please note that I am not a Bitcoin Core developer, but do have considerable Unix Autotools experience from decades of Unix software development. I did not mean to try and dissuade you from cross compiling, it’s just that I feel that cross compiles can be finicky, and I personally try and build native when doing builds for my own purposes.

  19. sipa commented at 11:36 pm on July 25, 2017: member

    The Bitcoin Core release binaries for macOS are built using cross-compiling in Linux.

    See the depends/ directory and documentation on gitian (our deterministic build environment) for more information.

  20. globaltoken commented at 11:37 pm on July 25, 2017: none
    Okay, but that would build more a Linux Distributable Version not MacOSX, remember - I like to Compile the Full Wallets for Distribution :) on my Linux 14.04 LTS :)
  21. globaltoken commented at 11:44 pm on July 25, 2017: none

    Can I use gitian Bulding without a Virtual Machine ? I have a Real Ubuntu :D

    Because thats the point why I can just start Cross Compiling. I followed all steps for Cross Compiling, but it doesnt works for me.

    All other Distribution Versions like Linux, Windows, ARM are fully compiling, osx is the only one which doesnt works. I installed all dependencies gitian-build wants, and all which I found in the build notes.

    But something went wrong with the boost 1.64 Version. It’s missing a Header file :(

    cd depends cp /home/ftp/Xcode_7.3.1.dmg $PWD cp ../contrib/macdeploy/extract-osx-sdk.sh $PWD ./extract-osx-sdk.sh make download-osx make HOST=x86_64-apple-darwin11 DARWIN_SDK_PATH=$PWD/MacOSX10.11.sdk cd .. ./autogen.sh # not required when building from tarball CONFIG_SITE=$PWD/depends/x86_64-apple-darwin11/share/config.site ./configure –host=“x86_64-apple-darwin11” –prefix=$(pwd)/depends/x86_64-apple-darwin11 –enable-reduce-exports –disable-bench –disable-gui-tests make

    And it’s already not working at the make HOST step :(

    Cheers.

  22. globaltoken renamed this:
    OSX Cross compiling ImportError: No module named ez_setup
    OSX Cross compiling not working: Missing boost osx Header - fatal error: 'unistd.h' file not found
    on Jul 25, 2017
  23. globaltoken commented at 11:59 pm on July 25, 2017: none

    I try compiling now with

    make HOST=x86_64-apple-darwin11 SDK_PATH=$PWD/MacOSX10.11.sdk

    I will let you know about the Result in some hours.

  24. globaltoken commented at 7:01 am on July 26, 2017: none

    It doesn’t works it still gives me the Error:

    make: *** [/home/globaltoken/wallet-compile/Compilers/compile-processor-osx/depends/work/build/x86_64-apple-darwin11/boost/1_64_0-fd7fbae355f/./.stamp_built] Error 1

  25. globaltoken commented at 7:23 am on July 26, 2017: none

    Okay, I fixxed that Include Error now, but it shows another one ???

    In file included from libs/filesystem/src/unique_path.cpp:20: In file included from ./boost/filesystem/operations.hpp:25: In file included from ./boost/filesystem/path.hpp:25: In file included from ./boost/filesystem/path_traits.hpp:23: In file included from ./boost/system/error_code.hpp:15: ./boost/cstdint.hpp:106:11: error: no member named ‘int8_t’ in the global namespace using ::int8_t; ~~^ ./boost/cstdint.hpp:107:11: error: no member named ‘int_least8_t’ in the global namespace using ::int_least8_t; ~~^ ./boost/cstdint.hpp:108:11: error: no member named ‘int_fast8_t’ in the global namespace using ::int_fast8_t; ~~^ ./boost/cstdint.hpp:109:11: error: no member named ‘uint8_t’ in the global namespace using ::uint8_t; ~~^ ./boost/cstdint.hpp:110:11: error: no member named ‘uint_least8_t’ in the global namespace using ::uint_least8_t; ~~^ ./boost/cstdint.hpp:111:11: error: no member named ‘uint_fast8_t’ in the global namespace using ::uint_fast8_t; ~~^ ./boost/cstdint.hpp:113:11: error: no member named ‘int16_t’ in the global namespace using ::int16_t; ~~^ ./boost/cstdint.hpp:114:11: error: no member named ‘int_least16_t’ in the global namespace using ::int_least16_t; ~~^ ./boost/cstdint.hpp:115:11: error: no member named ‘int_fast16_t’ in the global namespace using ::int_fast16_t; ~~^ ./boost/cstdint.hpp:116:11: error: no member named ‘uint16_t’ in the global namespace using ::uint16_t; ~~^ ./boost/cstdint.hpp:117:11: error: no member named ‘uint_least16_t’ in the global namespace using ::uint_least16_t; ~~^ ./boost/cstdint.hpp:118:11: error: no member named ‘uint_fast16_t’ in the global namespace using ::uint_fast16_t; ~~^ ./boost/cstdint.hpp:120:11: error: no member named ‘int32_t’ in the global namespace using ::int32_t; ~~^ ./boost/cstdint.hpp:121:11: error: no member named ‘int_least32_t’ in the global namespace using ::int_least32_t; ~~^ ./boost/cstdint.hpp:122:11: error: no member named ‘int_fast32_t’ in the global namespace using ::int_fast32_t; ~~^ ./boost/cstdint.hpp:123:11: error: no member named ‘uint32_t’ in the global namespace using ::uint32_t; ~~^ ./boost/cstdint.hpp:124:11: error: no member named ‘uint_least32_t’ in the global namespace using ::uint_least32_t; ~~^ ./boost/cstdint.hpp:125:11: error: no member named ‘uint_fast32_t’ in the global namespace using ::uint_fast32_t; ~~^ ./boost/cstdint.hpp:129:11: error: no member named ‘int64_t’ in the global namespace using ::int64_t; ~~^ fatal error: too many errors emitted, stopping now [-ferror-limit=] 20 errors generated.

    Any suggestion here ? :)

    Thanks.

  26. globaltoken commented at 6:44 pm on July 27, 2017: none

    IMPORTANT UPDATE GUYS: :)

    I tried building now on 16.04 LTS instead of 14.04 LTS, and I didn’t got those Errors. But on 16.04 LTS is Windows Compiling not possible.

    So it would be helpful to Update it that all Wallets can be compiled on one OS. If I have some time I will contribute a second Doc called build-deploys to explain how to compile Distributable Versions, not just for Local OS like build-osx described.

    I will let you know about my Result, and If my build was successful. Please let this open, I will help to improve this Issue.

    Cheers and good luck for first August ;)

  27. globaltoken commented at 9:16 am on July 28, 2017: none
    Okay 16.04 LTS compiling is working, 14.04 made that Include missing Error. Make sure you give the SDK for make Param, so it compiles with no issues.
  28. fanquake closed this on Aug 9, 2017

  29. eMosbat commented at 6:55 pm on August 30, 2017: none

    could you tell me what steps you did with success on 14.04? I get this error

    Error: found a Linux system but no libcap header. Install libcap-dev.

  30. globaltoken commented at 1:56 am on August 31, 2017: none
    Go to doc and make sure you met all dependencies for your target os.
  31. jagaricoin-project commented at 8:15 am on April 6, 2018: none
    I also get cross-compilation errors (ubuntu 16.04 / debian 8.5 / gitian). It is the same even if it meets the dependency relationship. Please handle bugs.
  32. globaltoken commented at 6:03 am on April 9, 2018: none
    @jagaricoin-project Do you have the DARWIN_SDK passed as arg?
  33. jagaricoin-project commented at 4:06 pm on April 9, 2018: none

    Thank you for your reply. Yes. I’m doing make as below.

    make HOST=“x86_64-apple-darwin11” DARWIN_SDK_PATH=$PWD/depends/SDKs/MacOSX10.11.sdk

  34. globaltoken commented at 4:19 pm on April 9, 2018: none
    What is your issue? Post your output here pls.
  35. jagaricoin-project commented at 3:19 am on April 16, 2018: none

    Hi, I’m sorry that your reply was delayed.

    I’m sorry. The reason why build can not be done seems to be in my environment. It seems that the file name was partially garbled. My problem was solved. Thank you for your support.

  36. 2a5A1Ghu1 commented at 2:35 pm on May 27, 2018: none
    Did you ever run into this issue #13169 because “cannot execute binary file” is a result of the make deploy issue
  37. MarwenBenTalebAli commented at 6:30 pm on July 7, 2018: none
    I am facing the same problem ‘unistd.h’ file not found. can you tell me how did you solve it and what is the dependence missing?
  38. cryptozeny commented at 5:01 pm on November 1, 2018: none
    same here.. unistd.h problem… i cannot build on ubuntu 16.04 0.16.3 for osx
  39. globaltoken commented at 11:32 pm on November 1, 2018: none
    Are you missing then OSX SDK?
  40. cryptozeny commented at 0:00 am on November 2, 2018: none
    no i already installed osx sdk…😭
  41. globaltoken commented at 7:42 am on November 2, 2018: none

    You must pass it while building the environment

    ./configure HOST=darwin.. SDK_PATH=PATH/TO/MacOSX.sdk

    Am 02.11.2018 um 01:02 schrieb cryptozeny:

    no i already installed osx sdk…😭

    — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/bitcoin/bitcoin/issues/10926#issuecomment-435226874, or mute the thread https://github.com/notifications/unsubscribe-auth/AXrkKDg9YZ45L-HjOXsVTHOj2pgent7Vks5uq4uUgaJpZM4OidTC.

  42. riordant commented at 9:41 pm on January 15, 2019: contributor
  43. cryptozeny commented at 10:37 am on March 5, 2019: none

    I did resolve cross build issue with gitian.

    https://gist.github.com/cryptozeny/0d31e89e6be5631dd0379aa424affcf3

    hope this helps

  44. barrystyle commented at 3:22 pm on April 7, 2019: none

    just before boost cross-compile dies, note which directory the depends makefile is looking at for the Mac SDK (in my case was ../depends/SDKs/MacOSX10.9.sdk). appears older versions of the makefile do not honour the DARWIN_SDK_PATH= parameter.

    instead - just move your SDK to where it’s looking, and recompile.

  45. BlockMechanic commented at 10:14 pm on July 10, 2019: contributor

    could you tell me what steps you did with success on 14.04? I get this error

    Error: found a Linux system but no libcap header. Install libcap-dev.

    I just ran into this on 18.04 as well , any workaround ?

  46. ach-group commented at 10:12 pm on July 15, 2019: none

    Thanks guys i have learning much here how to cross compile for MacOSX.

    i have using Ubuntu 16.04 WSL its working goods i give full instructions here for easy setup:

    Install dependency

    0    sudo apt-get install -y \
    1    git ruby apt-cacher-ng qemu-utils debootstrap lxc python-cheetah parted kpartx bridge-utils \
    2    make curl firewalld ca-certificates curl g++ git-core pkg-config autoconf librsvg2-bin libtiff-tools \
    3    libtool automake faketime bsdmainutils cmake imagemagick libcap-dev libz-dev libbz2-dev python python-dev \
    4    python-setuptools fonts-tuffy
    

    Cross MacOSX compiling

     0    git clone https://github.com/VSCD-Core/VSCD.git
     1    cd VSCD/depends/
     2    chmod 755 Makefile
     3    chmod 755 config.guess
     4    chmod 755 config.site.in 
     5    chmod 755 config.sub
     6    chmod 755 funcs.mk
     7    git clone https://github.com/MZaf/MacOSX10.11.sdk.git (Make sure cloning into depends directory)
     8    mv SDK SDKs
     9    cd SDKs
    10    tar -xzvf MacOSX10.11.sdk.tar
    11    cd - (back to VSCD/depends directory)
    12    make HOST="x86_64-apple-darwin11" DARWIN_SDK_PATH=$PWD/depends/SDKs/MacOSX10.11.sdk
    

    wait MacOSX cross-compile completed

    0    cd ~/VSCD/
    1    chmod 755 autogen.sh
    2    chmod 755 ./share/genbuild.sh
    3    chmod 755 ./src/secp256k1/autogen.sh
    4    chmod 755 ./src/leveldb/build_detect_platform
    5    ./autogen.sh
    6    ./configure --prefix=`pwd`/depends/x86_64-apple-darwin11 --disable-tests
    7    make install DESTDIR=/mnt/c/v1/MacOSX-11  
    

    Finish and check MacOSC wallet-qt on C:\v1\MacOSX-11\bin

    Hopefully it will benefit all

    Best Regards Village-Boy

  47. ghost commented at 7:27 am on August 26, 2019: none
                                             Cross compiling for OSX on Ubuntu 18.04 :
    

    sudo apt-get update

    sudo apt-get install build-essential libtool autotools-dev automake pkg-config libssl-dev libevent-dev bsdmainutils python3

    sudo apt-get install libboost-all-dev

    sudo apt-get install software-properties-common

    sudo add-apt-repository ppa:bitcoin/bitcoin

    sudo apt-get update

    sudo apt-get install libdb4.8-dev libdb4.8++-dev

    sudo apt-get install libminiupnpc-dev

    sudo apt-get install libzmq3-dev

    sudo apt-get install libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools libprotobuf-dev protobuf-compiler

    sudo apt-get install libqrencode-dev

    sudo apt install python-pip

    pip install setuptools

    sudo apt install cmake

    sudo apt install libcap-dev

    sudo apt install libbz2-dev

                                                        From the source directory :
    

    make -C depends HOST=x86_64-apple-darwin11 -j8 ( the number 8 is in fact the number of cpus you have )

    ./autogen.sh

    ./configure –prefix=$PWD/depends/x86_64-apple-darwin11 –disable-tests –disable-bench –disable-gui-tests ( the disable stuff is to compile faster, but is optional )

    make -j8

  48. MerlinMagic2018 commented at 2:47 am on November 19, 2019: none
    You also need https://github.com/phracker/MacOSX-SDKs/releases/download/10.13/MacOSX10.11.sdk.tar.xz and you have to extract it and put it here : depends/SDKs/MacOSX10.11.sdk You will have to create the “SDKs” directory.
  49. DrahtBot locked this on Dec 16, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-12-19 03:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me