Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Colcon shows "package had stderr output" if it has any message in external project added by CMake ExternalProject_Add #203

Closed
Mygao opened this issue Jul 18, 2019 · 3 comments
Labels
question Further information is requested

Comments

@Mygao
Copy link

Mygao commented Jul 18, 2019

Hi

I'm building ros2 project with the external library and this external library depends on another third-party libary with CMake's ExternalProject_Add functionality.(I installed colcon with apt(sudo apt install python3-colcon-common-extensions) and OS is Ubuntu 18.04 LTS2)

So my project has structure like below

  • main
  • third-party
    • another third-party with external project add function

The problem is, if the third-party's external project has any CMake message function inside it and executed, colcon output shows build has stderr output even if the code compilation itself has no errors or warnings.
The output below is what I got when build my project and "OS is linux" and "LIB_DIR: lib" is just the CMake messages

Starting >>> azero_interfaces
Finished <<< azero_interfaces [2.97s]                       
Starting >>> azero_core
Starting >>> azero_drive_configurator
Starting >>> azero_drive_status_monitor
Starting >>> azero_joy_controller                        
Finished <<< azero_drive_configurator [0.75s]                  
Finished <<< azero_drive_status_monitor [0.74s]
Finished <<< azero_joy_controller [0.94s]                      
--- stderr: azero_core                                 
OS is linux
LIB_DIR: lib
OS is linux
LIB_DIR: lib
---
Finished <<< azero_core [8.21s]

Summary: 5 packages finished [11.3s]
  1 package had stderr output: azero_core

The part of CMakelist.txt of third-party's external project is something like below.

elseif(UNIX AND NOT APPLE)
  set(OS "linux")
  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Werror")
  set(OS_LIBS pthread rt)
  message("HI")
elseif(APPLE)
  # This must come *before* linux or MacOSX will identify as Unix.
  set(OS "macosx")
  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Werror")
  set(OS_LIBS pthread pcap)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "rt-kernel")
  set(OS "rtk")
  message("ARCH is ${ARCH}")
  message("BSP is ${BSP}")
  include_directories(oshw/${OS}/${ARCH})
  file(GLOB OSHW_EXTRA_SOURCES oshw/${OS}/${ARCH}/*.c)
  set(OSHW_SOURCES "${OS_HW_SOURCES} ${OSHW_ARCHSOURCES}")
  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Werror")
  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-but-set-variable")
  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-function")
  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-format")
  set(OS_LIBS "-Wl,--start-group -l${BSP} -l${ARCH} -lkern -ldev -lsio -lblock -lfs -lusb -llwip -leth -li2c -lrtc -lcan -lnand -lspi -lnor -lpwm -ladc -ltrace -lc -lm -Wl,--end-group")
elseif(${CMAKE_SYSTEM_NAME} MATCHES "rtems")
  message("Building for RTEMS")
  set(OS "rtems")
  set(SOEM_LIB_INSTALL_DIR ${LIB_DIR})
  set(BUILD_TESTS FALSE)
endif()

message("OS is ${OS}")

file(GLOB SOEM_SOURCES soem/*.c)
file(GLOB OSAL_SOURCES osal/${OS}/*.c)
file(GLOB OSHW_SOURCES oshw/${OS}/*.c)

file(GLOB SOEM_HEADERS soem/*.h)
file(GLOB OSAL_HEADERS osal/osal.h osal/${OS}/*.h)
file(GLOB OSHW_HEADERS oshw/${OS}/*.h)

include_directories(soem)
include_directories(osal)
include_directories(osal/${OS})
include_directories(oshw/${OS})

add_library(soem STATIC
  ${SOEM_SOURCES}
  ${OSAL_SOURCES}
  ${OSHW_SOURCES}
  ${OSHW_EXTRA_SOURCES})
target_link_libraries(soem ${OS_LIBS})

message("LIB_DIR: ${SOEM_LIB_INSTALL_DIR}")

install(TARGETS soem DESTINATION ${SOEM_LIB_INSTALL_DIR})
install(FILES
  ${SOEM_HEADERS}
  ${OSAL_HEADERS}
  ${OSHW_HEADERS}
  DESTINATION ${SOEM_INCLUDE_INSTALL_DIR})

I tested with different messages and showed same stderr output.
If the messages are commeted out, colcon showed success with no error.

Thank you in advance.

@dirk-thomas
Copy link
Member

colcon simply shows you all the output which CMake prints on stderr. The build succeeded either way.

Please see the CMake docs about message(). A message() call without specifying a severity as a first keyword results in an "important" message to be printed to stderr.

If you don't want the message to appear in stderr (which I would only suggest for errors / problems / warning) you might want to use message(STATUS ...) instead.

@dirk-thomas dirk-thomas added the question Further information is requested label Jul 18, 2019
@Mygao
Copy link
Author

Mygao commented Jul 18, 2019

Thank you very much for the detailed answer!

@Mygao Mygao closed this as completed Jul 18, 2019
@aakashraawat
Copy link

You should check if you have installed pip3 list on your terminal , if not install it by cmd (sudo apt install python3-pip) and than check for pip3 lists . Further check your setuptools vesion by cmd ( pip3 list | grep setuptools) and it will be something like 5.9.xx you should downgrade it to 5.8.2 by cmd ( pip install setuptools==58.2.0) for me this removed it and package was build successfully

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Development

No branches or pull requests

3 participants