JGCRI/gcamwrapper

Possible approach for arm64 Mac users with GCAM Ver.7 + Conda

Closed this issue · 0 comments

It is fascinating that GCAM7 provides pre-built release for Mac OS with arm64 system.
However, I faced several problems while connecting GCAM7 and latest GCAM-Wrapper.
(such as : lack of boost.python library, etc.)

I could solve this through following steps, and I would like to share with others who are having same problems
Even though followings are a bit rough way to solve the issue,
I hope this can help with people who wants to use GCAM / GCAM-wrapper and Conda

<<< Build GCAM, RMK : don't use brew for java and boost>>>

  1. Download GCAM7 source code from github (not pre-built version) and unzip
  2. install tbb : "brew install tbb"
  3. install java : a. download zip file from openjdk
    b. unzip
    c. move unzipped folder under "/Library/Java/JavaVirtualMachines/"
  4. install boost : a. download boost source code zip file from the boost website
    b. unzip the boost source code file under "boost-lib" (anywhere you would like)
  5. Build boost : "cd boost-lib"
    "cd unzipped_boost_folder"
    "./bootstrap.sh"
    "./b2"
  6. put eigen, jars, hector as instructed in GCAM Documentations "How to Setup and Build"
  7. "vim ~/.zshrc"
    export BOOST_INCLUDE=your_boost_directory
    export JARS_LIB=your_gcam_directory/libs/jars/*
    export JAVA_INCLUDE=/Library/Java/JavaVirtualMachines/jdk-...jdk/Contents/Home/include
    export JAVA_LIB=/Library/Java/JavaVirtualMachines/jdk-
    ...jdk/Contents/Home/lib/server
    export EIGEN_INCLUDE=your_gcam_directory/libs/eigen
    export TBB_INCLUDE=/opt/homebrew/Cellar/tbb/202*../include
    export TBB_LIB=/opt/homebrew/Cellar/tbb/202*../lib
    "source ~/.zshrc"
  8. "cd your_gcam_directory/cvs/objects/build/linux"
    "vim ./config.system"
    export CXX=g++ -fPIC >>>. you can put it in the first line
    "make gcam -j 8"

<<< Build GCAM-Wrapper on Conda environment>>>

  1. "conda create -n test_39 python==3.9.0"
    "conda activate test_39"
    "conda install numpy pandas pyyaml" >>>. These three packages should be installed with conda at the first place
  2. unzip the boost source code file under "boost-lib" (the name of unzipped folder for this step should be different from before)
    "conda activate test_39" >>>. Just to make sure this boost is build with the conda environment
    "cd boost-lib"
    "cd unzipped_boost_folder"
    "./bootstrap.sh"
    "./b2" >>>. I am not sure about the reason, but this "./b2" is needed to avoid error
    "./b2 --with-python address-model=64 stage "
  3. "vim ~/.zshrc"
    • Mask all the exports from previous step (step 7.)
      export GCAM_INCLUDE=your_gcam_directory/cvs/objects
      export GCAM_LIB=your_gcam_directory/cvs/objects/build/linux
      export BOOST_INCLUDE=your_NEW!!!_boost_directory
      export BOOST_LIB=your_NEW!!!_boost_directory/stage/lib
      export EIGEN_INCLUDE=your_gcam_directory/libs/eigen
      export TBB_INCLUDE=/opt/homebrew/Cellar/tbb/202*../include
      export TBB_LIB=/opt/homebrew/Cellar/tbb/202*../lib
      export CXX='c++ -std=c++14'
      "source ~/.zshrc"
  4. "conda activate test_39" >>>. Just to make sure this boost is build with the conda environment
  5. a. download gcam-wrapper latest source code (for ver.6) from the github
    b. unzip
    c. "cd dir_to_gcam_wrapper"
    d. "vim ./setup.py"
    * Mask the line with "python_requires='>=3.6.*, <4' " >>>. it is a source of error, and it seems
    you just need to use python version between 3.6 and 4
    e. "pip3 install."