Build with error when env is python 3.7 or above, cannot run in python 3.5 env
kkwilllo opened this issue · 7 comments
Describe the bug
I am trying to build and run the service with the use of python, below is the log of build and run
Log
(ccapi_env) macuser@MacBook-Pro binding % sh python-version-unix.sh
[INFO] Running
PATH_CORE=/Users/macuser/Desktop/GitRes/ccapi/binding
PATH_CMAKE_REQ=python-version-unix.cmake
macOS
Warning: openssl@1.1 1.1.1k is already installed and up-to-date.
To reinstall 1.1.1k, run:
brew reinstall openssl@1.1
mkdir: build: File exists
-- BUILD_VERSION: ...
CMake Warning (dev) at /usr/local/Cellar/cmake/3.21.1/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
The package name passed to `find_package_handle_standard_args` (OpenSSL)
does not match the name of the calling package (openssl). This can lead to
problems in calling code that expects `find_package` result variables
(e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
/usr/local/Cellar/cmake/3.21.1/share/cmake/Modules/Findopenssl.cmake:574 (find_package_handle_standard_args)
python-version-unix.cmake:49 (find_package)
CMakeLists.txt:5 (project)
This warning is for project developers. Use -Wno-dev to suppress it.
-- CMAKE_BUILD_TYPE: Release
-- CMAKE_INSTALL_LIBDIR: lib
-- Build Python: ON
-- CCAPI_PROJECT_DIR: /Users/macuser/Desktop/GitRes/ccapi
CMake Warning (dev) at /usr/local/Cellar/cmake/3.21.1/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
The package name passed to `find_package_handle_standard_args` (OpenSSL)
does not match the name of the calling package (openssl). This can lead to
problems in calling code that expects `find_package` result variables
(e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
/usr/local/Cellar/cmake/3.21.1/share/cmake/Modules/Findopenssl.cmake:574 (find_package_handle_standard_args)
python-version-unix.cmake:49 (find_package)
python/CMakeLists.txt:5 (project)
This warning is for project developers. Use -Wno-dev to suppress it.
-- Found Python: /Users/macuser/anaconda3/envs/ccapi_env/bin/python3.5 (found version "3.5.6") found components: Interpreter Development Development.Module Development.Embed
-- Python_VERSION: 3.5.6
-- Python_EXECUTABLE: /Users/macuser/anaconda3/envs/ccapi_env/bin/python3.5
-- Found python module: setuptools (found version "40.2.0")
-- Found python module: wheel (found version "0.36.2")
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/macuser/Desktop/GitRes/ccapi/binding/build
[ 25%] Swig compile /Users/macuser/Desktop/GitRes/ccapi/binding/swig_interface.i for python
/Users/macuser/Desktop/GitRes/ccapi/include/ccapi_cpp/ccapi_event.h:79: Warning 509: Overloaded method ccapi::Event::addMessage(ccapi::Message &) effectively ignored,
/Users/macuser/Desktop/GitRes/ccapi/include/ccapi_cpp/ccapi_event.h:78: Warning 509: as it is shadowed by ccapi::Event::addMessage(ccapi::Message const &).
/Users/macuser/Desktop/GitRes/ccapi/include/ccapi_cpp/ccapi_logger.h:110: Warning 454: Setting a pointer/reference variable may leak memory.
[ 25%] Built target ccapi_binding_python_swig_compilation
Consolidate compiler generated dependencies of target ccapi_binding_python
[ 75%] Building CXX object python/CMakeFiles/ccapi_binding_python.dir/ccapi_binding_python/swig_interfacePYTHON_wrap.cxx.o
[ 75%] Building CXX object python/CMakeFiles/ccapi_binding_python.dir/__/ccapi_logger.cpp.o
[100%] Linking CXX shared module ../lib/_ccapi_binding_python.so
[100%] Built target ccapi_binding_python
WARNING: '' not a valid package name; please use only .-separated package names in setup.py
/Users/macuser/anaconda3/envs/ccapi_env/lib/python3.5/site-packages/setuptools/dist.py:407: UserWarning: The version specified ('...') is an invalid version, this may not work as expected with newer versions of setuptools, pip, and PyPI. Please see PEP 440 for more details.
"details." % self.metadata.version
running bdist_wheel
running build
running build_py
copying ccapi.py -> build/lib
copying _ccapi_binding_python.so -> build/lib
running build_ext
installing to build/bdist.macosx-10.6-x86_64/wheel
running install
running install_lib
creating build/bdist.macosx-10.6-x86_64
creating build/bdist.macosx-10.6-x86_64/wheel
copying build/lib/_ccapi_binding_python.so -> build/bdist.macosx-10.6-x86_64/wheel
copying build/lib/ccapi.py -> build/bdist.macosx-10.6-x86_64/wheel
running install_egg_info
running egg_info
writing top-level names to ccapi.egg-info/top_level.txt
writing ccapi.egg-info/PKG-INFO
writing dependency_links to ccapi.egg-info/dependency_links.txt
reading manifest file 'ccapi.egg-info/SOURCES.txt'
writing manifest file 'ccapi.egg-info/SOURCES.txt'
Copying ccapi.egg-info to build/bdist.macosx-10.6-x86_64/wheel/ccapi-...-py3.5.egg-info
running install_scripts
[WARNING] This wheel needs a higher macOS version than the version your Python interpreter is compiled against. To silence this warning, set MACOSX_DEPLOYMENT_TARGET to at least 11_0 or recreate these files with lower MACOSX_DEPLOYMENT_TARGET:
build/bdist.macosx-10.6-x86_64/wheel/_ccapi_binding_python.so[WARNING] This wheel needs a higher macOS version than the version your Python interpreter is compiled against. To silence this warning, set MACOSX_DEPLOYMENT_TARGET to at least 11_0 or recreate these files with lower MACOSX_DEPLOYMENT_TARGET:
build/bdist.macosx-10.6-x86_64/wheel/_ccapi_binding_python.socreating build/bdist.macosx-10.6-x86_64/wheel/ccapi-....dist-info/WHEEL
creating 'dist/ccapi-...-cp35-cp35m-macosx_11_0_x86_64.whl' and adding 'build/bdist.macosx-10.6-x86_64/wheel' to it
adding '_ccapi_binding_python.so'
adding 'ccapi.py'
adding 'ccapi-....dist-info/METADATA'
adding 'ccapi-....dist-info/WHEEL'
adding 'ccapi-....dist-info/top_level.txt'
adding 'ccapi-....dist-info/RECORD'
removing build/bdist.macosx-10.6-x86_64/wheel
[100%] Built target python_packaging
-- Install configuration: "Release"
Processing /Users/macuser/Desktop/GitRes/ccapi/binding/build/python/packaging
Building wheels for collected packages: ccapi
Running setup.py bdist_wheel for ccapi: started
Running setup.py bdist_wheel for ccapi: finished with status 'done'
Stored in directory: /private/var/folders/rc/909vssg96nx8frmzmnhx0s9w0000gp/T/pip-ephem-wheel-cache-7vq85zxr/wheels/2b/62/67/00047fd5374cc52f956b927443bb129a1c1c174574cb2dc0c5
Successfully built ccapi
Installing collected packages: ccapi
Found existing installation: ccapi ...
Can't uninstall 'ccapi'. No files were found to uninstall.
Successfully installed ccapi-...
You are using pip version 10.0.1, however version 20.3.4 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
(ccapi_env) macuser@MacBook-Pro binding % python
Python 3.5.6 |Anaconda, Inc.| (default, Aug 26 2018, 16:30:03)
[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
i>>> import ccapi
zsh: segmentation fault python
And below is the sh script i used to run the installation:
python-version-unix.sh
#!/bin/sh
cd `dirname $0`
PATH_CORE=`pwd`
PATH_CMAKE_REQ=python-version-unix.cmake
echo "[INFO] Running"
echo "PATH_CORE=${PATH_CORE}"
echo "PATH_CMAKE_REQ=${PATH_CMAKE_REQ}"
######################
if [[ $OSTYPE == 'darwin'* ]]; then
echo 'macOS'
brew install openssl
OPENSSL_ROOT_DIR=/usr/local/opt/openssl/
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
echo "Linux Machine - Like Ubuntu"
sudo apt-get install libssl-dev
fi
mkdir build
cd build
cmake -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl@1.1 -DCMAKE_PROJECT_INCLUDE=${PATH_CORE}/${PATH_CMAKE_REQ} -DBUIL$
cmake --build . -j
cmake --install .
python-version-unix.cmake
add_compile_definitions(CCAPI_ENABLE_SERVICE_MARKET_DATA)
#
add_compile_definitions(CCAPI_ENABLE_SERVICE_EXECUTION_MANAGEMENT)
#
add_compile_definitions(CCAPI_ENABLE_SERVICE_FIX)
#
add_compile_definitions(CCAPI_ENABLE_EXCHANGE_COINBASE)
#
# add_compile_definitions(CCAPI_ENABLE_EXCHANGE_GEMINI)
#
# add_compile_definitions(CCAPI_ENABLE_EXCHANGE_KRAKEN)
#
# add_compile_definitions(CCAPI_ENABLE_EXCHANGE_BITSTAMP)
#
# add_compile_definitions(CCAPI_ENABLE_EXCHANGE_BITFINEX)
#
# add_compile_definitions(CCAPI_ENABLE_EXCHANGE_BITMEX)
#
add_compile_definitions(CCAPI_ENABLE_EXCHANGE_BINANCE_US)
add_compile_definitions(CCAPI_ENABLE_EXCHANGE_BINANCE)
add_compile_definitions(CCAPI_ENABLE_EXCHANGE_BINANCE_USDS_FUTURES)
add_compile_definitions(CCAPI_ENABLE_EXCHANGE_BINANCE_COIN_FUTURES)
#
add_compile_definitions(CCAPI_ENABLE_EXCHANGE_HUOBI)
add_compile_definitions(CCAPI_ENABLE_EXCHANGE_HUOBI_USDT_SWAP)
add_compile_definitions(CCAPI_ENABLE_EXCHANGE_HUOBI_COIN_SWAP)
#
add_compile_definitions(CCAPI_ENABLE_EXCHANGE_OKEX)
#
# add_compile_definitions(CCAPI_ENABLE_EXCHANGE_ERISX)
#
# add_compile_definitions(CCAPI_ENABLE_EXCHANGE_KUCOIN)
#
add_compile_definitions(CCAPI_ENABLE_EXCHANGE_FTX)
add_compile_definitions(CCAPI_ENABLE_EXCHANGE_FTX_US)
#
add_compile_definitions(CCAPI_ENABLE_LOG_TRACE)
#
add_compile_definitions(CCAPI_ENABLE_LOG_DEBUG)
#
add_compile_definitions(CCAPI_ENABLE_LOG_INFO)
#
add_compile_definitions(CCAPI_ENABLE_LOG_WARN)
#
add_compile_definitions(CCAPI_ENABLE_LOG_ERROR)
#
add_compile_definitions(CCAPI_ENABLE_LOG_FATAL)
#
find_package(openssl REQUIRED)
find_package(ZLIB REQUIRED)
link_libraries(ZLIB::ZLIB)
Could you please also let me know whether the same crash happens when you put "import ccapi" in a .py file and execute that file with python? Thank you.
yes same situation even i run as a file
below is more error message, when i use previous console execute method:
Python 3.6.13 |Anaconda, Inc.| (default, Feb 23 2021, 12:58:59)
[GCC Clang 10.0.0 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import faulthandler; faulthandler.enable()
>>> import ccapi
Fatal Python error: Segmentation fault
Current thread 0x0000000114c1ce00 (most recent call first):
File "<frozen importlib._bootstrap>", line 219 in _call_with_frames_removed
File "<frozen importlib._bootstrap_external>", line 922 in create_module
File "<frozen importlib._bootstrap>", line 571 in module_from_spec
File "<frozen importlib._bootstrap>", line 658 in _load_unlocked
File "<frozen importlib._bootstrap>", line 955 in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 971 in _find_and_load
File "/Users/macuser/miniconda3/envs/py36/lib/python3.6/site-packages/ccapi.py", line 15 in <module>
File "<frozen importlib._bootstrap>", line 219 in _call_with_frames_removed
File "<frozen importlib._bootstrap_external>", line 678 in exec_module
File "<frozen importlib._bootstrap>", line 665 in _load_unlocked
File "<frozen importlib._bootstrap>", line 955 in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 971 in _find_and_load
File "<stdin>", line 1 in <module>
zsh: segmentation fault python
May i know your testing envrionment?
I used Mac, cmake 3.19, SWIG 4.0, and Python 3.7. Join us on Discord https://discord.gg/b5EKcp9s8T and friend me. I noticed that you built the project with Python 3.5 and ran it with 3.6: what if you built and ran it with the same minor version: remember to conda remove ccapi, then rm -rf * the build folder, to start fresh. :)
Hopefully you've resolved the issue. Do feel free to reopen it at any time if it comes back.
This could happen if the macOS version is relatively new but and Python version is relatively old. The solution is to upgrade Python version.
Hi thanks for your advice
What do u mean by update python version? using python 3.7/3.6 in conda/venv still not work
At least Python 3.8