Giter Site home page Giter Site logo

gazebosim / gz-utils Goto Github PK

View Code? Open in Web Editor NEW
6.0 6.0 10.0 776 KB

Classes and functions for robot applications

Home Page: https://gazebosim.org/

License: Apache License 2.0

CMake 0.52% C++ 95.34% C 3.29% Python 0.31% Shell 0.32% Starlark 0.23%
cpp robotics cpp17 simulation hacktoberfest ignition-gazebo ignition-libraries utilities-library gazebo gazebosim

gz-utils's Issues

Feature request: add macros for arm64 and armhf in ExtraTestMacros.hh

Desired behavior

Currently there are macros in ExtraTestMacros.hh to disable tests for different platforms, and we seem to be finding more and more test failures in arm64 and armhf platforms. It would be convenient to have macros for skipping tests for those architectures.

Alternatives considered

Implementation suggestion

Additional context

Require DCO

This repository doesn't have DCO checks configured.

fatal error: gz/utils/Export.hh: No such file or directory

Trying to do a clean build of Garden results in:

colcon build --cmake-args -DBUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=Debug -DBUILD_DOCS=OFF --merge-install
Starting >>> OGRE    
Starting >>> ignition-tools2
Finished <<< ignition-tools2 [0.10s]                                                   
Finished <<< OGRE [0.58s]                     
Starting >>> ignition-cmake3
Finished <<< ignition-cmake3 [0.05s]                   
Starting >>> ignition-utils2
--- stderr: ignition-utils2
In file included from /home/matias/Projects/ign/src/ign-utils/include/ignition/utils/Environment.hh:18,
                 from /home/matias/Projects/ign/src/ign-utils/src/Environment.cc:18:
/home/matias/Projects/ign/src/ign-utils/include/gz/utils/Environment.hh:22:10: fatal error: gz/utils/Export.hh: No such file or directory
   22 | #include <gz/utils/Export.hh>
      |          ^~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [src/CMakeFiles/ignition-utils2.dir/build.make:63: src/CMakeFiles/ignition-utils2.dir/Environment.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:363: src/CMakeFiles/ignition-utils2.dir/all] Error 2
make: *** [Makefile:163: all] Error 2
---
Failed   <<< ignition-utils2 [0.05s, exited with code 2]

Summary: 3 packages finished [1.00s]
  1 package failed: ignition-utils2
  1 package had stderr output: ignition-utils2
  13 packages not processed

Environment

  • OS Version: Ubuntu 20.04.4 LTS
  • Source or binary build?
    b802e60

Description

  • Expected behavior: Build correctly
  • Actual behavior: Compiler errors

Steps to reproduce

The ones described in https://gazebosim.org/docs/garden/install_ubuntu_src

Warning suppression macros conflict with those provided by ign-cmake

Both ign-utils and ign-cmake define macros with the same name, such as IGN_UTILS_WARN_IGNORE__NON_VIRTUAL_DESTRUCTOR and DETAIL_IGN_UTILS_WARN_IGNORE__NON_VIRTUAL_DESTRUCTOR:

these header files have different header guards, though, leading to compiler warnings on windows if both are included together:

Perhaps we need to wrap all our #define statements in #ifndef?

Unvendor CLI11 since it is now shipped in all supported platforms

CLI11 was vendored in #2 because it wasn't available in Ubuntu Focal. We can now unvendor it since it's available everywhere we support.

Platform version Link
Ubuntu Noble 2.4.1 https://packages.ubuntu.com/noble/libcli11-dev
Homebrew 2.4.2 https://formulae.brew.sh/formula/cli11
Windows vcpkg 2022 snapshot 2.1.2 https://github.com/microsoft/vcpkg/blob/2022.02.23/ports/cli11/vcpkg.json
Windows (conda) 2.4.1 https://anaconda.org/conda-forge/cli11

cli: add custom formatter for help strings

Desired behavior

The default format of help strings with the cli component is a bit different from the format we have been using in our cmd*.rb commands. Different is not necessarily worse, but I am noticing a specific issue with the formatting while reviewing gazebosim/gz-plugin#65 that makes the output a bit confusing:

$ ign plugin
Print information about plugins.

  ign plugin [options]

Options:

  -i [ --info ]              Get info about a plugin.
                             Requires the -p option.

  -p [ --plugin ] arg        Path to a plugin.
                             Required with -i.

  -v [ --verbose ]           Print verbose info.

  -h [ --help ]              Print this help message.
                                                    
  --force-version <VERSION>  Use a specific library version.
                                                    
  --versions                 Show the available versions.
$ bin/ign-plugin 
Introspect Ignition plugin
Usage: bin/ign-plugin [OPTIONS]

Options:
  -h,--help                   Print this help message and exit
  --help-all                  Show all help
  --version                   
  -v,--verbose                Verbose level
  -i,--info                   Get info about a plugin.
                              Requires the -p option.
  -p,--plugin TEXT Needs: --info
                              Path to a plugin.
                              Required with -i.

My main concern is the line -p,--plugin TEXT Needs: --info. I don't like the Needs: --info right next to TEXT without a delimiter or something to indicate that you shouldn't type Needs: on the command line. I'm guessing people will be able to figure it out, but it would be nice to be able to tidy this up.

Alternatives considered

Leave it as is I suppose.

Implementation suggestion

There is documentation about Formatting help output. One option on that page is Subclassing the CLI::Formatter class. For the -p,--plugin TEXT Needs: --info line mentioned above, this would entail overriding the make_option_opts method (and specifically this line).

We should be careful of modifying our fork of cli11 in case this package is built against an external version.

Additional context

ignition utils 1.2.0 doesn't build with ign-cmake 2.10.0 and with clang-6.0 compiler

Environment

  • OS Version: Ubuntu 18.04
  • Source or binary build?
    • Source build from branch releasing ign-utils 1.2.0 (3991dca05d041dba5477e5aa53f6b058183cd111)
    • compiler clang-6.0 (CC and CXX)
    • ign-cmake 2.10.0 version built from source with clang-6.0 compiler. (source branch: 7eb246daaa6248db3f7c85183789fc1e752423c9)

Description

  • Expected behavior: building ign-utils 1.2.0 with clang-6.0 compiler works
  • Actual behavior: linker error happens when building ign-utils 1.2.0 with clang-6.0 compiler

Steps to reproduce

To reproduce the error, you will need a system with Clang-6.0 compiler

  1. Build ign-cmake 2.10.0 from source with clang-6.0 compiler
  • Clone ign-cmake 2.10.0 from (here)
  • Browse to repository, open a terminal in it and run
mkdir build 
cd build
  • ensure compiler is set to clang-6.0:
export CC=clang-6.0 
export CXX=clang++-6.0
  • create a local installation dir for ign-cmake:
mkdir $HOME/ign-cmake-2.10.0
  • build and install ign-cmake-2.10.0:
cmake -DCMAKE_INSTALL_PREFIX=$HOME/ign-cmake-2.10.0 ..
make
make install
  1. Build ign-uitls 1.2.0 from source with clang-6.0 compiler
  • clone ign-utils 1.2.0 (from here)
  • browse to the repository, open a terminal in it and run
mkdir build 
cd build
  • ensure compilers are set to clang-6.0:
export CC=clang-6.0 
export CXX=clang++-6.0
  • build ign-utils with correct prefix path to ign-cmake-2.10.0:
cmake -DCMAKE_PREFIX_PATH=$HOME/ign-cmake-2.10.0 ..
make

Output

Cmake configuration for ign-utils:

g.gulgulia:~/gg_workspace/ign-utils/build$ export CXX=clang++-6.0
g.gulgulia:~/gg_workspace/ign-utils/build$ export CC=clang-6.0
g.gulgulia:~/gg_workspace/ign-utils/build$ cmake -DCMAKE_PREFIX_PATH=$HOME/ign-cmake-2.10.0 ..
-- The C compiler identification is Clang 6.0.0
-- The CXX compiler identification is Clang 6.0.0
-- Check for working C compiler: /usr/bin/clang-6.0
-- Check for working C compiler: /usr/bin/clang-6.0 -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/clang++-6.0
-- Check for working CXX compiler: /usr/bin/clang++-6.0 -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- ignition-utils1 version 1.2.0
-- Operating system is Linux
-- Found CPack generators: DEB
-- 
-- Searching for host SSE information
-- SSE2 found
-- SSE3 found
-- SSE4.1 found
-- SSE4.2 found
-- Configuring library: ignition-utils1
-- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY
-- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY - Success
-- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY
-- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY - Success
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR - Success
-- Adding 2 UNIT tests
-- No tests have been specified for INTEGRATION
-- Adding 1 INTEGRATION tests
-- No tests have been specified for PERFORMANCE
-- No tests have been specified for REGRESSION
-- Configuring library: ignition-utils1-cli
-- The program [cppcheck] was not found! Skipping codecheck setup
-- Build configuration successful
-- Build type: RelWithDebInfo
-- Install prefix: /usr/local
-- Looking for ronn to generate manpages - found
-- Found Doxygen: /usr/bin/doxygen (found version "1.8.13") found components:  doxygen dot 
-- Configuring done
-- Generating done
-- Build files have been written to: /home/g.gulgulia/gg_workspace/ign-utils/build

To check if ign-cmake 2.10.0 was correctly used, I ran from build dir: ccmake .. . The output is below:

 BUILD_DOCS                       ON                                                                                                                                                                              
 BUILD_SHARED_LIBS                ON                                                                                                                                                                              
 BUILD_TESTING                    ON                                                                                                                                                                              
 CMAKE_BUILD_TYPE                                                                                                                                                                                                 
 CMAKE_INSTALL_PREFIX             /usr/local                                                                                                                                                                      
 CPPCHECK_PATH                    CPPCHECK_PATH-NOTFOUND                                                                                                                                                          
 DPKG_PROGRAM                     /usr/bin/dpkg                                                                                                                                                                   
 FIND_PATH                        /usr/bin/find                                                                                                                                                                   
 GZIP                             /bin/gzip                                                                                                                                                                       
 IGN_UTILS_VENDOR_CLI11           ON                                                                                                                                                                              
 PYTHON_VERSION                                                                                                                                                                                                   
 RONN                             /usr/bin/ronn                                                                                                                                                                   
 RPMBUILD_PROGRAM                 RPMBUILD_PROGRAM-NOTFOUND                                                                                                                                                       
 SSE2_FOUND                       ON                                                                                                                                                                              
 SSE3_FOUND                       ON                                                                                                                                                                              
 SSE4_1_FOUND                     ON                                                                                                                                                                              
 SSE4_2_FOUND                     ON                                                                                                                                                                              
 SSSE3_FOUND                      ON                                                                                                                                                                              
 USE_FULL_RPATH                   OFF                                                                                                                                                                             
 USE_HOST_SSE_FLAGS               ON                                                                                                                                                                              
 USE_IGN_RECOMMENDED_FLAGS        ON                                                                                                                                                                              
 ignition-cmake2_DIR              /home/g.gulgulia/ign-cmake-2.10.0/share/cmake/ignition-cmake2

after that I build ign-utils and encounter a linker error when UNIT_Environment_TEST is being linked against library Environment

g.gulgulia:~/gg_workspace/ign-utils/build$ make
-- ignition-utils1 version 1.2.0
-- Operating system is Linux
-- Found CPack generators: DEB
-- 
-- Searching for host SSE information
-- SSE2 found
-- SSE3 found
-- SSE4.1 found
-- SSE4.2 found
-- Configuring library: ignition-utils1
-- Adding 2 UNIT tests
-- No tests have been specified for INTEGRATION
-- Adding 1 INTEGRATION tests
-- No tests have been specified for PERFORMANCE
-- No tests have been specified for REGRESSION
-- Configuring library: ignition-utils1-cli
-- The program [cppcheck] was not found! Skipping codecheck setup
-- Build configuration successful
-- Build type: RelWithDebInfo
-- Install prefix: /usr/local
-- Looking for ronn to generate manpages - found
-- Configuring done
-- Generating done
-- Build files have been written to: /home/g.gulgulia/gg_workspace/ign-utils/build
Scanning dependencies of target doc
[  6%] Generating API documentation with Doxygen
[  6%] Built target doc
Scanning dependencies of target gtest
[ 13%] Building CXX object test/CMakeFiles/gtest.dir/gtest/src/gtest-all.cc.o
[ 20%] Linking CXX static library ../lib/libgtest.a
[ 20%] Built target gtest
Scanning dependencies of target ignition-utils1
[ 26%] Building CXX object src/CMakeFiles/ignition-utils1.dir/Environment.cc.o
[ 33%] Linking CXX shared library ../lib/libignition-utils1.so
[ 33%] Built target ignition-utils1
Scanning dependencies of target gtest_main
[ 40%] Building CXX object test/CMakeFiles/gtest_main.dir/gtest/src/gtest_main.cc.o
[ 46%] Linking CXX static library ../lib/libgtest_main.a
[ 46%] Built target gtest_main
Scanning dependencies of target UNIT_Environment_TEST
[ 53%] Building CXX object src/CMakeFiles/UNIT_Environment_TEST.dir/Environment_TEST.cc.o
[ 60%] Linking CXX executable ../bin/UNIT_Environment_TEST
CMakeFiles/UNIT_Environment_TEST.dir/Environment_TEST.cc.o: In function `Environment_emptyENV_Test::TestBody()':
/home/g.gulgulia/gg_workspace/ign-utils/src/Environment_TEST.cc:28: undefined reference to `ignition::utils::v1::env(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, bool)'
CMakeFiles/UNIT_Environment_TEST.dir/Environment_TEST.cc.o: In function `Environment_envSet_Test::TestBody()':
/home/g.gulgulia/gg_workspace/ign-utils/src/Environment_TEST.cc:36: undefined reference to `ignition::utils::v1::setenv(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/home/g.gulgulia/gg_workspace/ign-utils/src/Environment_TEST.cc:41: undefined reference to `ignition::utils::v1::env(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, bool)'
/home/g.gulgulia/gg_workspace/ign-utils/src/Environment_TEST.cc:49: undefined reference to `ignition::utils::v1::env(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, bool)'
/home/g.gulgulia/gg_workspace/ign-utils/src/Environment_TEST.cc:57: undefined reference to `ignition::utils::v1::env(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, bool)'
/home/g.gulgulia/gg_workspace/ign-utils/src/Environment_TEST.cc:62: undefined reference to `ignition::utils::v1::unsetenv(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
CMakeFiles/UNIT_Environment_TEST.dir/Environment_TEST.cc.o: In function `Environment_envUnset_Test::TestBody()':
/home/g.gulgulia/gg_workspace/ign-utils/src/Environment_TEST.cc:69: undefined reference to `ignition::utils::v1::unsetenv(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/home/g.gulgulia/gg_workspace/ign-utils/src/Environment_TEST.cc:74: undefined reference to `ignition::utils::v1::env(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, bool)'
/home/g.gulgulia/gg_workspace/ign-utils/src/Environment_TEST.cc:81: undefined reference to `ignition::utils::v1::env(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, bool)'
/home/g.gulgulia/gg_workspace/ign-utils/src/Environment_TEST.cc:88: undefined reference to `ignition::utils::v1::env(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, bool)'
/home/g.gulgulia/gg_workspace/ign-utils/src/Environment_TEST.cc:91: undefined reference to `ignition::utils::v1::unsetenv(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
CMakeFiles/UNIT_Environment_TEST.dir/Environment_TEST.cc.o: In function `Util_TEST_envSetEmpty_Test::TestBody()':
/home/g.gulgulia/gg_workspace/ign-utils/src/Environment_TEST.cc:99: undefined reference to `ignition::utils::v1::setenv(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/home/g.gulgulia/gg_workspace/ign-utils/src/Environment_TEST.cc:100: undefined reference to `ignition::utils::v1::setenv(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/home/g.gulgulia/gg_workspace/ign-utils/src/Environment_TEST.cc:105: undefined reference to `ignition::utils::v1::env(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, bool)'
/home/g.gulgulia/gg_workspace/ign-utils/src/Environment_TEST.cc:121: undefined reference to `ignition::utils::v1::env(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, bool)'
/home/g.gulgulia/gg_workspace/ign-utils/src/Environment_TEST.cc:129: undefined reference to `ignition::utils::v1::env(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, bool)'
/home/g.gulgulia/gg_workspace/ign-utils/src/Environment_TEST.cc:132: undefined reference to `ignition::utils::v1::unsetenv(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
src/CMakeFiles/UNIT_Environment_TEST.dir/build.make:98: recipe for target 'bin/UNIT_Environment_TEST' failed
make[2]: *** [bin/UNIT_Environment_TEST] Error 1
CMakeFiles/Makefile2:1088: recipe for target 'src/CMakeFiles/UNIT_Environment_TEST.dir/all' failed
make[1]: *** [src/CMakeFiles/UNIT_Environment_TEST.dir/all] Error 2
Makefile:162: recipe for target 'all' failed
make: *** [all] Error 2

Here's a screenshot of the error

image

Note: I tried the same steps but with clang-8 and clang-9, and ign-utils could be compiled with clang-8 and clang-9

Empty file/line when logging

Environment

  • OS Version: Ubuntu 24.04 -->
  • Source or binary build? Source using the gz-utils3 branch (aae0d8c)

Description

  • Expected behavior: When logging a message:
logger.RawLogger().trace("trace\n");

we should see:

(2024-09-22 19:48:25.019) [trace] [main.cc:32] trace
  • Actual behavior: Instead, we see:
(2024-09-22 20:28:20.394) [trace] [:] trace

Steps to reproduce

  1. Compile the main.cc example under examples/log and run it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.