papyrusjs icon indicating copy to clipboard operation
papyrusjs copied to clipboard

Compiling on a Mac

Open pogzie opened this issue 4 years ago • 3 comments

Hi, as the feature to incrementally render maps is still on the way, I would need to manually run this on my Mac. Unfortunately, I dont think that the binary would work (ye, I tried it) so im left with compiling from scratch.

I've tried installing the dependencies via:

brew install node cmake gcc 
sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /

The last line being a way to install zlib (https://stackoverflow.com/questions/52741673/how-can-i-install-zlib-on-mac-os-x-mojave-10-14). Which then gets me:

$cmake --version
cmake version 3.15.0
CMake suite maintained and supported by Kitware (kitware.com/cmake).

g++ --version
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 10.0.1 (clang-1001.0.46.4)
Target: x86_64-apple-darwin18.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

But it seems that first im getting a lot of warnings about deprecations in MacOS 10.12

In file included from ./port/port_posix.h:47:
./port/atomic_pointer.h:64:3: warning: 'OSMemoryBarrier' is deprecated: first deprecated in macOS 10.12 - Use std::atomic_thread_fence() from <atomic> instead
      [-Wdeprecated-declarations]
  OSMemoryBarrier();
  ^

Then started getting C++11 related issues

In file included from /Users/pogz/Downloads/papyrusjs/node_modules/leveldb-mcpe/src/entrypoint.cpp:2:
/Users/pogz/Downloads/papyrusjs/node_modules/nan/nan.h:50:3: error: This version of node/NAN/v8 requires a C++11 compiler
# error This version of node/NAN/v8 requires a C++11 compiler
  ^

Anyone tried this successfully to compile on a Mac?

pogzie avatar Jul 22 '19 06:07 pogzie

hi, I use docker on my mac git clone https://github.com/clarkx86/papyrusjs.git cd papyrusjs docker run -ti --rm -v $(pwd):/srv node bash

and inside docker cd /srv/ apt update apt install cmake g++ zlib1g-dev npm install

agareev avatar Jul 23 '19 21:07 agareev

This would make your life easier if you want to use Docker (it would also host the site for you): https://hub.docker.com/r/pogzie/papyrusjs

I was hoping to have this running on my mac without docker and run it as a cron job every couple of hours.

pogzie avatar Aug 16 '19 15:08 pogzie

I successfully did npm install on mac, you need to link gcc to brew's gcc. For example, my Homebrew version installed was 9, run this before running npm install:

export CC=/usr/local/bin/gcc-9
export CXX=/usr/local/bin/g++-9
export CPP=/usr/local/bin/cpp-9
export LD=/usr/local/bin/gcc-9

alias gcc='gcc-9'
alias cc='gcc-9'
alias g++='g++-9'
alias c++='c++-9'

asanrivas avatar Sep 19 '19 04:09 asanrivas