Ask Your Question

Why the software has to "detect OS" ? What about writing portable code ?

asked 2020-06-23 17:33:17 -0500

mtm gravatar image

updated 2020-07-01 04:06:11 -0500

gvdhoorn gravatar image

OS is Mageia Linux localhost.localdomain 5.6.14-desktop-2.mga7

ERROR: Rosdep experienced an error: Could not detect OS, tried ['zorin', 'windows', 'nixos', 'clearlinux', 'ubuntu', 'slackware', 'rhel', 'qnx', 'pop', 'osx', 'sailfishos', 'tizen', 'opensuse', 'opensuse', 'opensuse', 'opensuse', 'openembedded', 'neon', 'mx', 'mint', 'linaro', 'gentoo', 'funtoo', 'freebsd', 'fedora', 'elementary', 'elementary', 'debian', 'cygwin', 'centos', 'manjaro', 'arch', 'alpine']
Please go to the rosdep page [1] and file a bug report with the stack trace below.
[1] :

rosdep version: 0.19.0

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/rosdep2/", line 144, in rosdep_main
    exit_code = _rosdep_main(args)
  File "/usr/local/lib/python3.7/site-packages/rosdep2/", line 428, in _rosdep_main
    return _no_args_handler(command, parser, options, args)
  File "/usr/local/lib/python3.7/site-packages/rosdep2/", line 437, in _no_args_handler
    return command_handlers[command](options)
  File "/usr/local/lib/python3.7/site-packages/rosdep2/", line 649, in command_update
  File "/usr/local/lib/python3.7/site-packages/rosdep2/", line 507, in update_sources_list
    rosdep_data = get_gbprepo_as_rosdep_data(dist_name)
  File "/usr/local/lib/python3.7/site-packages/rosdep2/", line 150, in get_gbprepo_as_rosdep_data
    ctx = create_default_installer_context()
  File "/usr/local/lib/python3.7/site-packages/rosdep2/", line 90, in create_default_installer_context
  File "/usr/local/lib/python3.7/site-packages/rosdep2/platforms/", line 55, in register_platforms
  File "/usr/local/lib/python3.7/site-packages/rosdep2/platforms/", line 82, in register_elementary
    (os_name, os_version) = context.get_os_name_and_version()
  File "/usr/local/lib/python3.7/site-packages/rosdep2/", line 115, in get_os_name_and_version
    os_name = self.os_detect.get_name()
  File "/usr/local/lib/python3.7/site-packages/rospkg/", line 698, in get_name
  File "/usr/local/lib/python3.7/site-packages/rospkg/", line 668, in detect_os
    raise OsNotDetected("Could not detect OS, tried %s" % attempted)
rospkg.os_detect.OsNotDetected: Could not detect OS, tried ['zorin', 'windows', 'nixos', 'clearlinux', 'ubuntu', 'slackware', 'rhel', 'qnx', 'pop', 'osx', 'sailfishos', 'tizen', 'opensuse', 'opensuse', 'opensuse', 'opensuse', 'openembedded', 'neon', 'mx', 'mint', 'linaro', 'gentoo', 'funtoo', 'freebsd', 'fedora', 'elementary', 'elementary', 'debian', 'cygwin', 'centos', 'manjaro', 'arch', 'alpine']

Edit: Found the following issue:

-- Searching for Poco library...
CMake Error at /home/mtm/TP/ROS/ros_catkin_ws/install_isolated/share/cmake_modules/cmake/Modules/FindPoco.cmake:189 (MESSAGE):
  Poco was not found.  Set the Poco_INCLUDE_DIR cmake cache entry to the
  top-level directory containing the poco include directories.  E.g
  /usr/local/include/ or c:\poco\include\poco-1.3.2
Call Stack (most recent call first):
  CMakeLists.txt:24 (find_package)

I downloaded, compiled and installed poco in /opt/poco

I set the variable specified in:


also in


I also set the environment variable export POCO_ROOT=/opt/poco/

before launching

./src/catkin/bin/catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release

Nothing changes. I purposely added some junk in FindPoco.cmake to make sure it is actually executed. It was not !!!

Therefore, all this compilation framework created some cache and it seems to not be looking anymore for changed in the files ... (more)

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2020-06-24 04:44:00 -0500

gvdhoorn gravatar image

updated 2020-07-01 02:35:21 -0500

If the question is: why do we need rosdep, perhaps #q215059 can provide some insight.

As to the error: support for your OS will have to be added to rospkg. I'd suggest to open an issue over at ros-infrastructure/rospkg.

Edit: let's not make this a generic how-to-install-ROS-on-Mageia topic.

You asked why rosdep threw the error about not being able to detect your OS. That was -- hopefully -- answered.

If you have further questions, please post those as new questions.

ROS Answers is an instance of AskBot, and, similar to Stack Overflow, works best with a 1-to-1 ratio of questions to answers. It is not a forum, where you can keep posting additional comments.

edit flag offensive delete link more


Thank you for your answer. I passed the detection phase by adding:

class Mageia(OsDetector):
    Detect Mageia Linux.
    def is_os(self):
        return platform.system() == "Linux" and platform.release().find("mga") > 1

    def get_version(self):
        if self.is_os():
            return platform.release().split("mga")[1]
        raise OsNotDetected('called in incorrect OS')

    def get_codename(self):
        if self.is_os():
            return "Mageia"+self.get_version();
        raise OsNotDetected('called in incorrect OS')

Beside having to download and compile by hand some libs (console_bridge and Poco), should I expect any other issues ? I see the Detector really do not do anything else to set-up the stuff. Is the detector that provides the key to look-up in the database ? If yes, is the get_codename() method ? tnx.

mtm gravatar image mtm  ( 2020-06-30 15:03:25 -0500 )edit

I passed the detection phase by adding:

That's great.

Could you submit a Pull Request to ros-infrastructure/rospkg to add support for Mageia?

That would be very much appreciated.

gvdhoorn gravatar image gvdhoorn  ( 2020-07-01 02:36:34 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2020-06-23 17:33:17 -0500

Seen: 35 times

Last updated: Jul 01