Page 1 of 2

Could not find boost_python36 (Ubuntu 18.04)

Posted: Tue Mar 24, 2020 3:05 pm
by Oberlus
I can't compile freeorion after upgrading from Ubuntu 16.04 to 18.04.

Output from cmake:

Code: Select all

~/Projects/FreeOrion/freeorion-build$ cmake ../freeorion
-- Build type CMAKE_BUILD_TYPE set to Release
-- Use CCache for Unix Makefiles called with: ccache program  
-- Boost version: 1.65.1
-- Found the following Boost libraries:
--   filesystem
--   iostreams
--   locale
--   log
--   log_setup
--   serialization
--   system
--   thread
--   regex
--   date_time
--   chrono
--   atomic
CMake Error at cmake/FindBoost.cmake:2161 (message):
  Unable to find the requested Boost libraries.

  Boost version: 1.65.1

  Boost include path: /usr/local/include

  Could not find the following Boost libraries:

          boost_python36

  No Boost libraries were found.  You may need to set BOOST_LIBRARYDIR to the
  directory containing Boost libraries or BOOST_ROOT to the location of
  Boost.
Call Stack (most recent call first):
  CMakeLists.txt:238 (find_package)


-- Boost version: 1.65.1
-- Found the following Boost libraries:
--   filesystem
--   regex
--   system
-- Found SDL: /usr/lib/x86_64-linux-gnu/libSDL2.so (found version "2.0.8") 
-- Could NOT find cppcheck (missing: CPPCHECK_EXECUTABLE) 
-- Could NOT find pycodestyle (missing: PYCODESTYLE_EXECUTABLE) 
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE) 
-- Configuring incomplete, errors occurred!
See also "/home/lucas/Projects/FreeOrion/freeorion-build/CMakeFiles/CMakeOutput.log".
See also "/home/lucas/Projects/FreeOrion/freeorion-build/CMakeFiles/CMakeError.log".
My system seems a bit unstable right now, after I've been installing and uninstalling stuff like a moron trying to compile freeorion master (with the switch to python 3). For example, in one of the reboots I could not enter my password to log in because of a constantly flashing "Authentication failed".

I'm working now on getting a functional laptop for my job (e.g. getting back R), and maybe I've grown some common sense because I've decided not to do any other blind guess to get freeorion working again.

o01eg pointed out that maybe my boost 1.65.1 is not compiled with support for python 3 and that I might need to reinstall libboost-python-dev or libboost-all-dev from the repos, which I did. But that has not solved the problem.

I can't make a fresh Ubuntu install because I am in home confinement (Covid-19) at 500 km from my university and I would lose my VPN credentials for teleworking (the VPN software can only be installed while in the university, which is right now closed, as well as the roads to get there, plus there are patrols of vigilantes beating up people that they think should not be in the streets, this is crazy).

If anyone can help me out, I would greatly appreciate it. I would gladly compile boost myself if that would fix this and if someone can give me a hint on that (I tried it but the instructions I found didn't work for me and were too cryptic for me to tweak).

Re: Could not find boost_python36 (Ubuntu 18.04)

Posted: Tue Mar 24, 2020 3:44 pm
by adrian_broher
CMake locates the boost installation within the `/usr/local/` prefix, which indicates that this was installed manually. Package managers install their packages into the `/usr/` or the `/` prefix, for libaries the former is most common. For more details consult the File Hierachy Standard.

To force CMake Find* modules to use the installation within the `/usr/` prefix try setting the CMake `BOOST_ROOT` to give FindBoost a search preferrence hint or `CMAKE_PREFIX_PATH` to give any Find* module a hint to where to look for dependencies. Create a new and clean build tree and invoke CMake like this within the build tree and report your progress here:

```
cmake -DBOOST_ROOT=/usr <path to source>
```

Re: Could not find boost_python36 (Ubuntu 18.04)

Posted: Tue Mar 24, 2020 4:04 pm
by Oberlus
adrian_broher wrote: Tue Mar 24, 2020 3:44 pm ```
cmake -DBOOST_ROOT=/usr <path to source>
```
I've tried with /usr , / and /usr/local
All returned the same:

Code: Select all

~/Projects/FreeOrion/freeorion-build$ cmake -DBOOST_ROOT=/usr ../freeorion
-- Build type CMAKE_BUILD_TYPE set to Release
-- Use CCache for Unix Makefiles called with: ccache program  
-- Boost version: 1.65.1
-- Found the following Boost libraries:
--   filesystem
--   iostreams
--   locale
--   log
--   log_setup
--   serialization
--   system
--   thread
--   regex
--   date_time
--   chrono
--   atomic
CMake Error at cmake/FindBoost.cmake:2161 (message):
  Unable to find the requested Boost libraries.

  Boost version: 1.65.1

  Boost include path: /usr/include

  Could not find the following Boost libraries:

          boost_python36

  No Boost libraries were found.  You may need to set BOOST_LIBRARYDIR to the
  directory containing Boost libraries or BOOST_ROOT to the location of
  Boost.
Call Stack (most recent call first):
  CMakeLists.txt:238 (find_package)


-- Boost version: 1.65.1
-- Found the following Boost libraries:
--   filesystem
--   regex
--   system
-- Could NOT find cppcheck (missing: CPPCHECK_EXECUTABLE) 
-- Could NOT find pycodestyle (missing: PYCODESTYLE_EXECUTABLE) 
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE) 
-- Configuring incomplete, errors occurred!

Code: Select all

~/Projects/FreeOrion/freeorion-build$ cmake -DBOOST_ROOT=/usr/local ../freeorion
-- Build type CMAKE_BUILD_TYPE set to Release
-- Use CCache for Unix Makefiles called with: ccache program  
-- Boost version: 1.65.1
-- Found the following Boost libraries:
--   filesystem
--   iostreams
--   locale
--   log
--   log_setup
--   serialization
--   system
--   thread
--   regex
--   date_time
--   chrono
--   atomic
CMake Error at cmake/FindBoost.cmake:2161 (message):
  Unable to find the requested Boost libraries.

  Boost version: 1.65.1

  Boost include path: /usr/local/include

  Could not find the following Boost libraries:

          boost_python36

  No Boost libraries were found.  You may need to set BOOST_LIBRARYDIR to the
  directory containing Boost libraries or BOOST_ROOT to the location of
  Boost.
Call Stack (most recent call first):
  CMakeLists.txt:238 (find_package)


-- Boost version: 1.65.1
-- Found the following Boost libraries:
--   filesystem
--   regex
--   system
-- Could NOT find cppcheck (missing: CPPCHECK_EXECUTABLE) 
-- Could NOT find pycodestyle (missing: PYCODESTYLE_EXECUTABLE) 
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE) 
-- Configuring incomplete, errors occurred!

Code: Select all

~/Projects/FreeOrion/freeorion-build$ cmake -DBOOST_ROOT=/ ../freeorion
-- Build type CMAKE_BUILD_TYPE set to Release
-- Use CCache for Unix Makefiles called with: ccache program  
-- Boost version: 1.65.1
-- Found the following Boost libraries:
--   filesystem
--   iostreams
--   locale
--   log
--   log_setup
--   serialization
--   system
--   thread
--   regex
--   date_time
--   chrono
--   atomic
CMake Error at cmake/FindBoost.cmake:2161 (message):
  Unable to find the requested Boost libraries.

  Boost version: 1.65.1

  Boost include path: /usr/local/include

  Could not find the following Boost libraries:

          boost_python36

  No Boost libraries were found.  You may need to set BOOST_LIBRARYDIR to the
  directory containing Boost libraries or BOOST_ROOT to the location of
  Boost.
Call Stack (most recent call first):
  CMakeLists.txt:238 (find_package)


-- Boost version: 1.65.1
-- Found the following Boost libraries:
--   filesystem
--   regex
--   system
-- Could NOT find cppcheck (missing: CPPCHECK_EXECUTABLE) 
-- Could NOT find pycodestyle (missing: PYCODESTYLE_EXECUTABLE) 
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE) 
-- Configuring incomplete, errors occurred!

Re: Could not find boost_python36 (Ubuntu 18.04)

Posted: Tue Mar 24, 2020 4:17 pm
by adrian_broher
From the other thread: Why did you uninstall python2 in the first place? Keep it and install python3 parallel to that. Also install libboost-python-...-dev as o0leg suggested. It contains both the Python 2 and Python 3 binding.

Re: Could not find boost_python36 (Ubuntu 18.04)

Posted: Tue Mar 24, 2020 4:24 pm
by Oberlus
adrian_broher wrote: Tue Mar 24, 2020 4:17 pm From the other thread: Why did you uninstall python2 in the first place? Keep it and install python3 parallel to that. Also install libboost-python-...-dev as o0leg suggested. It contains both the Python 2 and Python 3 binding.
I uninstalled it because I'm a moron with no patience. I wanted to force cmake to find python 3.6 instead of 2.7. Now I know/remember I should have used update-alternatives, or specify the correct paths, or whatever, instead of apt remove essential-stuff.

I've already installed those packages (before opening this thread):

Code: Select all

~/Projects/FreeOrion/freeorion-build$ python -V
Python 2.7.17
~/Projects/FreeOrion/freeorion-build$ python3 -V
Python 3.6.9
~/Projects/FreeOrion/freeorion-build$ sudo apt install libboost-python-dev 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libboost-python-dev is already the newest version (1.65.1.0ubuntu1).
libboost-python-dev set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

Re: Could not find boost_python36 (Ubuntu 18.04)

Posted: Tue Mar 24, 2020 4:37 pm
by adrian_broher
Can you verify that there is a libboost_python somewhere?

`find /usr/lib -iname 'libboost_python*.so*'`

Re: Could not find boost_python36 (Ubuntu 18.04)

Posted: Tue Mar 24, 2020 5:06 pm
by Ophiuchus
So where are the libs in real?

Here in fedora they are in /usr/lib64/

Also i think you can tell cmake to ignore boost if the version is too low:

CMakeLists.txt -

set(MINIMUM_BOOST_VERSION 1.58.0)

Re: Could not find boost_python36 (Ubuntu 18.04)

Posted: Tue Mar 24, 2020 6:28 pm
by Oberlus
adrian_broher wrote: Tue Mar 24, 2020 4:37 pm Can you verify that there is a libboost_python somewhere?

`find /usr/lib -iname 'libboost_python*.so*'`
Yes!

Code: Select all

~$ find /usr/lib -iname 'libboost_python*.so*'
/usr/lib/x86_64-linux-gnu/libboost_python.so
/usr/lib/x86_64-linux-gnu/libboost_python3-py36.so.1.65.1
/usr/lib/x86_64-linux-gnu/libboost_python3.so
/usr/lib/x86_64-linux-gnu/libboost_python-py36.so
/usr/lib/x86_64-linux-gnu/libboost_python3-py36.so
/usr/lib/x86_64-linux-gnu/libboost_python-py27.so
/usr/lib/x86_64-linux-gnu/libboost_python-py27.so.1.65.1

Re: Could not find boost_python36 (Ubuntu 18.04)

Posted: Tue Mar 24, 2020 7:13 pm
by Oberlus
Thanks to adrian_broher's hint to find the libraries I tried this and it worked:

Code: Select all

~/Projects/FreeOrion/freeorion-build$ cmake -DBOOST_LIBRARYDIR=/usr/lib/x86_64-linux-gnu/ ../freeorion
-- Build type CMAKE_BUILD_TYPE set to Release
-- Use CCache for Unix Makefiles called with: ccache program  
-- Boost version: 1.65.1
-- Found the following Boost libraries:
--   filesystem
--   iostreams
--   locale
--   log
--   log_setup
--   serialization
--   system
--   thread
--   regex
--   date_time
--   chrono
--   atomic
-- Boost version: 1.65.1
-- Found the following Boost libraries:
--   python36
-- Boost version: 1.65.1
-- Found the following Boost libraries:
--   filesystem
--   regex
--   system
-- Could NOT find cppcheck (missing: CPPCHECK_EXECUTABLE) 
-- Could NOT find pycodestyle (missing: PYCODESTYLE_EXECUTABLE) 
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE) 
-- Configuring done
-- Generating done
-- Build files have been written to: ~/Projects/FreeOrion/freeorion-build
Now I'm compiling. I don't discard something is amiss (compilation seems way slower than ever before, 2 minutes to get to 15% using make -j3) but I feel joy right now.

Re: Could not find boost_python36 (Ubuntu 18.04)

Posted: Tue Mar 24, 2020 7:28 pm
by Oberlus
Every time I've compiled freeorion I've got a bunch of warnings on variables that were declared but never used. I'd never care to report those.
But these warnings are new to me, maybe you care about them:

Code: Select all

universe/Effects.cpp: In member function ‘virtual void Effect::Conditional::Execute(const ScriptingContext&, const TargetSet&) const’:
universe/Effects.cpp:3705:74: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
         TargetSet& match_targets = *reinterpret_cast<TargetSet*>(&matches);
                                                                          ^
universe/Effects.cpp:3712:82: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
         TargetSet& non_match_targets = *reinterpret_cast<TargetSet*>(&non_matches);
                                                                                  ^
universe/Effects.cpp: In member function ‘virtual void Effect::Conditional::Execute(const ScriptingContext&, const TargetSet&, Effect::AccountingMap*, const Effect::EffectCause&, bool, bool, bool, bool) const’:
universe/Effects.cpp:3747:74: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
         TargetSet& match_targets = *reinterpret_cast<TargetSet*>(&matches);
                                                                          ^
universe/Effects.cpp:3757:82: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
         TargetSet& non_match_targets = *reinterpret_cast<TargetSet*>(&non_matches);
                                                                                  ^
universe/Fleet.cpp:813:32: warning: trigraph ??) converted to ] [-Wtrigraphs]
                     ss << "  (???) (" << sys_id << ")";

Re: Could not find boost_python36 (Ubuntu 18.04)

Posted: Wed Mar 25, 2020 5:44 am
by adrian_broher
Oberlus wrote: Tue Mar 24, 2020 7:28 pm Every time I've compiled freeorion I've got a bunch of warnings on variables that were declared but never used. I'd never care to report those.
But these warnings are new to me, maybe you care about them:
Those are listed in every CI run and are well known but not easily fixed without changing the C++ interface of all Effects and Conditions.

The trigraph '??)' is still converted because it's still part of C++14, C++17 will drop support for trigraphs.

Re: Could not find boost_python36 (Ubuntu 18.04)

Posted: Fri Mar 27, 2020 12:14 pm
by Geoff the Medio
adrian_broher wrote: Wed Mar 25, 2020 5:44 am The trigraph '??)' is still converted because it's still part of C++14, C++17 will drop support for trigraphs.
Would be good to fix those now, though. A pull request to escape the last ? by putting \ before it in those cases would be appreciated (Oberlus).

Re: Could not find boost_python36 (Ubuntu 18.04)

Posted: Fri Mar 27, 2020 2:27 pm
by Oberlus
Geoff the Medio wrote: Fri Mar 27, 2020 12:14 pm
adrian_broher wrote: Wed Mar 25, 2020 5:44 am The trigraph '??)' is still converted because it's still part of C++14, C++17 will drop support for trigraphs.
Would be good to fix those now, though. A pull request to escape the last ? by putting \ before it in those cases would be appreciated (Oberlus).
I don't even know what that piece of code is doing, but I can follow simple instructions :D

To be explicit, I change it like this:

Code: Select all

ss << "  (??\?) (" << sys_id << ")";
It compiles just fine, without warnings. But I really don't understand why scapping the last interrogation makes any sense here or what it really means to the compiler.

Also, why not replace the trygraph with the symbol it is supposed to mean? (']')

In any case, it seems there are no other instances of "??)" or "???" in all FreeOrion code.

Re: Could not find boost_python36 (Ubuntu 18.04)

Posted: Fri Mar 27, 2020 2:47 pm
by adrian_broher
Oberlus wrote: Fri Mar 27, 2020 2:27 pm I don't even know what that piece of code is doing, but I can follow simple instructions :D
Trigraphs are an ancient way to escape certain characters, which are required to write source code on keyboards, which do not have the corresponding keys.

https://en.wikipedia.org/wiki/Digraphs_and_trigraphs

Adding the backslash tells the compiler not to interpret the '??)' as trigraph ']' but as the actual character sequence.

Re: Could not find boost_python36 (Ubuntu 18.04)

Posted: Fri Mar 27, 2020 7:16 pm
by Oberlus
adrian_broher wrote: Fri Mar 27, 2020 2:47 pm Adding the backslash tells the compiler not to interpret the '??)' as trigraph ']' but as the actual character sequence.
So it was really a bug!