aldebaran / libqi

NAOqi core framework
http://doc.aldebaran.com/libqi/
BSD 3-Clause "New" or "Revised" License
66 stars 53 forks source link

Installation guides faulty or at least unclear. #23

Closed TVerloop closed 3 years ago

TVerloop commented 6 years ago

I started with following the linux guides at. link. Those all seem to work fine. Then i start with making a first service according to link. This however is not possible. My project returns an error that it can not find the package qimodule. After long searching i figured that that belongs to libqi not naoqisdk c++. I tried installing that. A proper way is specified nowhere. Most guides redirect to installing naoqi sdk for c++ which in turn does not contain the cmake qimodule package.

Right at this moment i am building the libqi package from here. God knows if im doing that right. Afterwards i was still not able to build because everything that is located in the libqi can not be found by de build tools. And i do not know what is the best way to let qibuild know where libqi is. Do i add it to the path. do i put everything under /usr/include /usr/lib /usr/share? do i add it to a toolchain, do i add it to my worktree and make a depend on it in my project? Its nowhere specified. according to the installation guide all you should have to do is make install and you're all set.

I tried the last option having libqi source in my worktree and make a depend. this seemed to fix the qibuild package being found. But now qibuild (or CMAKE) cant find GMOCK.cmake. No where is specified where i get this or what it is and where i leave this.

My next step is to just build libqi put it next to the naoqi c++ SDK and de CTC and see if i can add it to the toolchains with qitoolchain add-package -t /path/to/libqi and pray that this works. But i doubt i can use that to cross compile.

I would really suggest that you take someone who has never worked on this project. give him a clean OS. And let him try to install all the sdk's and other tools and let him document everything that is not correct in the documentation.

Firestorm7893 commented 5 years ago

I feel your pain. If anyone managed to get it working, please, tell me how you did it. I'm crying right now and i don't know if is it worth living anymore

TVerloop commented 5 years ago

I really wish i could help but its been a year since i did this, i remember little of it and I dont even work at the company where i did this anymore. I can vaguely remember something about this project not being the correct one but needing the naoqi sdk. By the fact that in a year there has been no response from the devs they dont even care and are probably not going to be of help either. So i wish you the best of luck.

Firestorm7893 commented 5 years ago

We actually managed to use it, but the troubleshooting steps we had to do were insane. Basically it's just the wrong version of the compiler. You HAVE to use gcc 4.8, g++ 4.8 and force cmake and qibuild on using them by updating the alternatives on linux. The documentation never mentions it anywhere but you also need to add the naoqi library you are going to use in the CMakeList file of the project (you can see it in the example projects)

It was horrible.

If anyone else has problems with the c++ sdk we will gladly help you, just ask me.

Sorry for the cry for help in the comment :(

@lorenzo-manini <--- the other guy who worked on the issue

vvigilante commented 3 years ago

Dear @Firestorm7893 i'd like your help. May you write a list of steps for compiling the bloody library? Thank you!

nyibbang commented 3 years ago

Hello @vvigilante,

We're aware that our documentation and installation guide steps are not good, and we are trying to improve them as much as possible with the few maintainers that we have. In the meantime, we might be able to help you directly here if you can describe us what you want to do. Feel free to create an new issue for that.

vvigilante commented 3 years ago

Hello, thank you for your help.

I just want to use the naoqi api to control the robot on my device (arm cpu) but I have no idea how to make that work.

I built the libqi-python, library but when I import qi it says

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "qi/__init__.py", line 87, in <module>
    _on_import_module()
  File "qi/__init__.py", line 81, in _on_import_module
    load_libqipython()
  File "qi/__init__.py", line 58, in load_libqipython
    qilib = get_qilib_path()
  File "qi/__init__.py", line 20, in get_qilib_path
    fp, pathname, description = imp.find_module('_qi')
ImportError: No module named _qi 

Now, where do i find such _qi? I figured that it is in this very repository (libqi) and I attempted to build this, but I get many errors, such as

libqi/src/messaging/messagedispatcher.cpp: In constructor ‘qi::MessageDispatcher::MessageDispatcher(qi::ExecutionContext&)’:
libqi/src/messaging/messagedispatcher.cpp:35:31: error: invalid initialization of non-const reference of type ‘qi::ExecutionContext&’ from an rvalue of type ‘<brace-enclosed initializer list>’
   : _execContext{ execContext }
                               ^
CMakeFiles/qi.dir/build.make:1574: recipe for target 'CMakeFiles/qi.dir/src/messaging/messagedispatcher.cpp.o' failed
make[2]: *** [CMakeFiles/qi.dir/src/messaging/messagedispatcher.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/qi.dir/all' failed

Ubuntu 18.04, g++ 4.8.5

nyibbang commented 3 years ago

The _qi module is a shared library from the libqi-python project and should be in the libqi-python build directory. Under Linux it should be named _qi.so. It is required by the Python part of libqi-python and is the bridge between libqi et the Python interpreter. Depending on the version of Python you used, it should be in build-dir/sdk/lib/pythonX.Y/site-packages.

The error you get on libqi is a mistake from the compiler. I suggest you try using a more recent version of gcc to build libqi. It should compile with gcc 5.5, 7, 8 or 9 (we've had issues with gcc 6 as well). You should be able to install these versions on Ubuntu 18.04 by using the ubuntu-toolchain-r/test repository:

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt update
sudo apt install g++-7 g++-8 g++-9 # choose the one you want
vvigilante commented 3 years ago

Thank you very much for your clear explaination. In this case python setup.py build does not build that library. How do I have that built?

If I try with cmake it says

CMake Warning at tests/CMakeLists.txt:2 (find_package):
  By not providing "Findqimodule.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "qimodule",
  but CMake did not find one.

  Could not find a package configuration file provided by "qimodule" with any
  of the following names:

    qimoduleConfig.cmake
    qimodule-config.cmake

  Add the installation prefix of "qimodule" to CMAKE_PREFIX_PATH or set
  "qimodule_DIR" to a directory containing one of the above files.  If
  "qimodule" provides a separate development package or SDK, be sure it has
  been installed.

CMake Error at tests/CMakeLists.txt:4 (qi_create_module):
  Unknown CMake command "qi_create_module".
nyibbang commented 3 years ago

Yes, unfortunately the setuptools script does not currently build the C++ code (including the _qi library).

Building libqi and libqi-python for ARM yourself is doable but not easy, as you will need to compile the boost C++ libraries v1.64 for that architecture and probably hack a few places to get what you want. We are currently redoing the build system of libqi-python to ease that process but it is not finished yet.

If you want to go through with it, please either open a new issue on https://github.com/aldebaran/libqi-python so that we may assist you through it or contact me directly by email.