colcon / colcon-core

Command line tool to build sets of software packages
http://colcon.readthedocs.io
Apache License 2.0
107 stars 46 forks source link

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

Closed Mygao closed 5 years ago

Mygao commented 5 years ago

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

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 commented 5 years ago

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.

Mygao commented 5 years ago

Thank you very much for the detailed answer!

aakashraawat commented 8 months ago

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

PeymanAmirii commented 3 months ago

As a possible solution, you can check the version of the package setuptools and upgrade or downgrade it to 58.2.0. This solution has been described here: https://www.youtube.com/watch?v=iBGZ8LEvkCY&t=551s