build error in MacOs: cmake can't find environmental variables

437 views
Skip to first unread message

Enrique Carlos Toomey

unread,
Dec 6, 2021, 6:42:06 AM12/6/21
to Basilisk Forum
Hi!
I'm building develop branch (commit b84d6d470d217c1199d33aec94c6b90f4facca05 ) in a MacBook (macOs Big Sur Version 11.5.2), with python 3.8.9 ( inside a venv),  cmake version 3.22.0, xcode 1.3.1. The install steps work fine, but I got an error when running cmake:

------------------------------------------------------------------------------------------------------------

% cmake ../src -G Xcode -DBUILD_OPNAV=ON

CMake Error: The source directory "/Users/enrique/src" does not exist.

Specify --help for usage, or press the help button on the CMake GUI.

% cmake ../src -G Xcode -DBUILD_OPNAV=ON

-- The C compiler identification is AppleClang 13.0.0.13000029

-- The CXX compiler identification is AppleClang 13.0.0.13000029

-- Detecting C compiler ABI info

-- Detecting C compiler ABI info - done

-- Check for working C compiler: /Users/enrique/Downloads/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang - skipped

-- Detecting C compile features

-- Detecting C compile features - done

-- Detecting CXX compiler ABI info

-- Detecting CXX compiler ABI info - done

-- Check for working CXX compiler: /Users/enrique/Downloads/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ - skipped

-- Detecting CXX compile features

-- Detecting CXX compile features - done

-- Found PythonInterp: /Users/enrique/basilisk/.venv/bin/python3 (found suitable version "3.8.9", minimum required is "3") 

CMake Error at /usr/local/Cellar/cmake/3.22.0/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message):

  Could NOT find PythonLibs (missing: PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS)

  (Required is at least version "3")

Call Stack (most recent call first):

  /usr/local/Cellar/cmake/3.22.0/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)

  /usr/local/Cellar/cmake/3.22.0/share/cmake/Modules/FindPythonLibs.cmake:310 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)

  CMakeLists.txt:380 (find_package)



-- Configuring incomplete, errors occurred!

See also "/Users/enrique/basilisk/dist3/CMakeFiles/CMakeOutput.log".


---------------------------------------------------------------------------------------------------------------------------------------

I manage to avoid this issue by specifying PYTHON_LIBRARIES and PYTHON_INCLUDE_DIRS to cmake:

% cmake ../src -G Xcode -DBUILD_OPNAV=ON \

-DPYTHON_INCLUDE_DIR=$(python -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())")  \

-DPYTHON_LIBRARY=$(python -c "import distutils.sysconfig as sysconfig; print(sysconfig.get_config_var('LIBDIR'))")


But then it failed because it couldn't find SWIG:

CMake Error at /usr/local/Cellar/cmake/3.22.0/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message):

  Could NOT find SWIG (missing: SWIG_EXECUTABLE SWIG_DIR)


I guess I could try a similar solution than the one used with PYTHON_LIBRARY and PYTHON_INCLUDE_DIRS, but there's something going on with cmake not being able to find things that is puzzling me.

 I would really appreciate some help with this. If there is any context information that is missing to diagnose the problem please let me know.


Thank you very much,


Enrique

Hanspeter Schaub

unread,
Dec 7, 2021, 9:40:59 AM12/7/21
to Basilisk Forum
You are trying to run `cmake` directly?  The build system changed well over a year ago, I think when we moved to BSK 1.8 or so.  Now you run `python3 conanfile.py` from the source directory, and conan will run the cmake file as needed.  If you are upgrading from an older version of BSK to develop, see


to find a discussion on the ways to build BSK.  Further, with the BSK2 release the messaging system changed completely from a central messaging repo to a peer-to-peer system.  You can find info on how to update BSK1 python scripts to run on BSK2 at


and how to upgrade BSK modules you may have written at

Enrique Carlos Toomey

unread,
Dec 21, 2021, 7:49:54 AM12/21/21
to Basilisk Forum

Hi Mr Schaub, 

Thank you for your answer. Actually I was running cmake  directly because python conanfile.py was failing. I was finally able to solve the problem by deleting everything and reinstalling from scratch, I common solution for software, but not that satisfactory in understanding what was failing in the first place. Anyway, I have basilisk up and running again, and using it successfully :)

Enrique Carlos Toomey

unread,
Dec 21, 2021, 8:13:20 AM12/21/21
to Basilisk Forum
The only thing to mention about the installation is that it fails with python 3.9.9:

% python conanfile.py
...
Adding Basilisk module to python

Error /Users/enrique/basilisk/.venv_bsk/lib/python3.9/site-packages/setuptools/__init__.py:148: SetuptoolsDeprecationWarning: setup_requires is deprecated. Supply build dependencies using PEP 517 pyproject.toml build-requires.
  warnings.warn(
/Users/enrique/basilisk/.venv_bsk/lib/python3.9/site-packages/setuptools/command/easy_install.py:156: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
/Users/enrique/basilisk/.venv_bsk/lib/python3.9/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
 while running ['/Users/enrique/basilisk/.venv_bsk/bin/python3.9', 'setup.py', 'develop']
ERROR: Exiting with code: 1

I tracked this to a warning message when executing python setup.py develop. Basilisk is installed successfully, but because of the warning messaged the exit code is 1 instead of 0:

% python setup.py develop
/Users/enrique/basilisk/.venv_bsk/lib/python3.9/site-packages/setuptools/__init__.py:148: SetuptoolsDeprecationWarning: setup_requires is deprecated. Supply build dependencies using PEP 517 pyproject.toml build-requires.
  warnings.warn(
running develop
/Users/enrique/basilisk/.venv_bsk/lib/python3.9/site-packages/setuptools/command/easy_install.py:156: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
/Users/enrique/basilisk/.venv_bsk/lib/python3.9/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
running egg_info
writing dist3/Basilisk.egg-info/PKG-INFO
writing dependency_links to dist3/Basilisk.egg-info/dependency_links.txt
writing top-level names to dist3/Basilisk.egg-info/top_level.txt
reading manifest file 'dist3/Basilisk.egg-info/SOURCES.txt'
adding license file 'LICENSE'
writing manifest file 'dist3/Basilisk.egg-info/SOURCES.txt'
running build_ext
Creating /Users/enrique/basilisk/.venv_bsk/lib/python3.9/site-packages/Basilisk.egg-link (link to dist3)
Basilisk 2.1.1 is already the active version in easy-install.pth

Installed /Users/enrique/basilisk/dist3
Processing dependencies for Basilisk==2.1.1
Finished processing dependencies for Basilisk==2.1.1


I avoid the issue by commenting lines 308-312 in conanfile.py,  but I guess that you would want to address this issue in a cleaner way, as it will become more common as users and developers move to newer versions of python.
I tried creating an issue in bitbucket, but it appears that I need permissions for that.

by the ways, this is the version of pip and setuptools I'm using:

% pip --version
pip 21.3.1 from /Users/enrique/basilisk/.venv_bsk/lib/python3.9/site-packages/pip (python 3.9)

% python -c "import setuptools; print(setuptools.__version__)"
59.0.1 

Cheers,  and I hope this helps improve the already wonderful tool basilisk is.

benjamin....@u-space.fr

unread,
Dec 21, 2021, 8:33:31 AM12/21/21
to Basilisk Forum
Just seconding Enrique here. I had to do the exact same thing to get BSK to work under a python 3.9 Anaconda virtual env.

Hanspeter Schaub

unread,
Dec 21, 2021, 11:45:54 PM12/21/21
to Basilisk Forum
Mm, I wonder what was causing the issue with Python 3.9.9.  I've been running that version of python for months now and no issues on my side.  I do many clean installs each week.  Glad the clean setup fixed the install.  Not hard to get some wires crossed.
Reply all
Reply to author
Forward
0 new messages