PyOgmaNeo2 icon indicating copy to clipboard operation
PyOgmaNeo2 copied to clipboard

installation failed in Ubuntu LTS 20.04?

Open Thanh-Binh opened this issue 4 years ago • 1 comments

Hi Erik I try today to install the lastest version of OgmaNeo2 and then PyOgmaNeo2 python3 setup.py install --user

if I compiled OgmaNeo2 in share mode, I got the error: running install running build_ext CMAKE_BUILD_TYPE not set, setting it to Release -- Build type: Release Python target version: 3 CMake Warning (dev) at /usr/share/cmake-3.18/Modules/UseSWIG.cmake:486 (message): Policy CMP0086 is not set: UseSWIG honors SWIG_MODULE_NAME via -module flag. Run "cmake --help-policy CMP0086" for policy details. Use the cmake_policy command to set the policy and suppress this warning.

Call Stack (most recent call first): /usr/share/cmake-3.18/Modules/UseSWIG.cmake:736 (SWIG_ADD_SOURCE_TO_MODULE) CMakeLists.txt:100 (swig_add_library) This warning is for project developers. Use -Wno-dev to suppress it.

-- Configuring done -- Generating done -- Build files have been written to: /home/binh/experiments/RL/OgmaNeo2020/PyOgmaNeo2/build/temp.linux-x86_64-3.8 cmake --build . --config Release [ 57%] Built target PyOgmaNeoCpp [ 71%] Built target pyogmaneo_swig_compilation make[2]: *** No rule to make target '/home/binh/experiments/RL/OgmaNeo2020/OgmaNeo2/install/lib/libOgmaNeo.a', needed by '_pyogmaneo.so'. Stop.

That means it need static library.

But if I insert the static library, I got other errors: running install running build_ext CMAKE_BUILD_TYPE not set, setting it to Release -- Build type: Release Python target version: 3 CMake Warning (dev) at /usr/share/cmake-3.18/Modules/UseSWIG.cmake:486 (message): Policy CMP0086 is not set: UseSWIG honors SWIG_MODULE_NAME via -module flag. Run "cmake --help-policy CMP0086" for policy details. Use the cmake_policy command to set the policy and suppress this warning.

Call Stack (most recent call first): /usr/share/cmake-3.18/Modules/UseSWIG.cmake:736 (SWIG_ADD_SOURCE_TO_MODULE) CMakeLists.txt:100 (swig_add_library) This warning is for project developers. Use -Wno-dev to suppress it.

-- Configuring done -- Generating done -- Build files have been written to: /home/binh/experiments/RL/OgmaNeo2020/PyOgmaNeo2/build/temp.linux-x86_64-3.8 cmake --build . --config Release [ 57%] Built target PyOgmaNeoCpp [ 71%] Built target pyogmaneo_swig_compilation [ 85%] Linking CXX shared module _pyogmaneo.so /usr/bin/ld: /home/binh/experiments/RL/OgmaNeo2020/OgmaNeo2/install/lib/libOgmaNeo.a(Hierarchy.cpp.o): relocation R_X86_64_PC32 against symbol `_ZNSt14_Function_base13_Base_managerISt5_BindIFPFviRSt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEPKSt6vectorIiSaIiEEPS7_ESt12_PlaceholderILi1EESD_ILi2EES9_SA_EEE10_M_managerERSt9_Any_dataRKSJ_St18_Manager_operation' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: final link failed: bad value collect2: error: ld returned 1 exit status make[2]: *** [CMakeFiles/pyogmaneo.dir/build.make:108: _pyogmaneo.so] Error 1 make[1]: *** [CMakeFiles/Makefile2:126: CMakeFiles/pyogmaneo.dir/all] Error 2 make: *** [Makefile:149: all] Error 2 error: command 'cmake' failed with exit status 2

I found the following solutions that you have to change CMakeList.txt

  1. in OgmaNeo2 by inserting compiling flag -fPIC
  2. in PyOgmaNeo2 1. using C++14 instead of -std=c++14 Then it works ...

Thanh-Binh avatar Dec 06 '20 12:12 Thanh-Binh

Hi,

Thanks for the information, I will try to fix it, but I would recommend switching to AOgmaNeo now, which is the best version so far. It's were most development currently happens. It also is a lot easier to install, it's just

pip install pyaogmaneo

for the Python bindings. It is also Arduino compatible (hence the name), but works great on desktop as well. It has no dependencies (not even standard C++).

222464 avatar Dec 06 '20 13:12 222464