Package will not build in gradebot but builds fine on my end

I have a package, named correctly that builds correctly for me. But when sent to gradebot it can not build correctly. After gradebot fails to build the package, I also can not build it without deleting build,install,log folder and trying again.

Here is the error

user:~/ros2_ws$ colcon build --packages-select services_quiz_srv
[1.352s] WARNING:colcon.colcon_core.package_selection:Some selected packages are already built in one or more underlay workspaces:
        'services_quiz_srv' is in: /home/user/ros2_ws/install/services_quiz_srv
If a package in a merged underlay workspace is overridden and it installs headers, then all packages in the overlay must sort their include directories by workspace order. Failure to do so may result in build failures or undefined behavior at run time.
If the overridden package is used by another package in any underlay, then the overriding package in the overlay must be API and ABI compatible or undefined behavior at run time may occur.

If you understand the risks and want to override a package anyways, add the following to the command line:
        --allow-overriding services_quiz_srv

This may be promoted to an error in a future release of colcon-override-check.
Starting >>> services_quiz_srv
--- stderr: services_quiz_srv
failed to create symbolic link '/home/user/ros2_ws/build/services_quiz_srv/ament_cmake_python/services_quiz_srv/services_quiz_srv' because existing path cannot be removed: Is a directory
gmake[2]: *** [CMakeFiles/ament_cmake_python_symlink_services_quiz_srv.dir/build.make:70: CMakeFiles/ament_cmake_python_symlink_services_quiz_srv] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:421: CMakeFiles/ament_cmake_python_symlink_services_quiz_srv.dir/all] Error 2
gmake: *** [Makefile:146: all] Error 2
---
Failed   <<< services_quiz_srv [0.45s, exited with code 2]

Summary: 0 packages finished [1.19s]
  1 package failed: services_quiz_srv
  1 package had stderr output: services_quiz_srv

here is my cmake

cmake_minimum_required(VERSION 3.5)
project(services_quiz_srv)

# Default to C99
if(NOT CMAKE_C_STANDARD)
  set(CMAKE_C_STANDARD 99)
endif()

# Default to C++14
if(NOT CMAKE_CXX_STANDARD)
  set(CMAKE_CXX_STANDARD 14)
endif()

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
  add_compile_options(-Wall -Wextra -Wpedantic)
endif()

# find dependencies
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(std_msgs REQUIRED)
find_package(rosidl_default_generators REQUIRED)

if(BUILD_TESTING)
  find_package(ament_lint_auto REQUIRED)
  # the following line skips the linter, which checks for copyrights
  # uncomment the line when copyright and license are not present in all source files
  set(ament_cmake_copyright_FOUND TRUE)
  # the following line skips cpplint (only works in a git repo)
  # uncomment the line when this package is not in a git repo
  set(ament_cmake_cpplint_FOUND TRUE)
  ament_lint_auto_find_test_dependencies()
endif()

rosidl_generate_interfaces(${PROJECT_NAME}
  "srv/Turn.srv"
)

ament_package()

here is my package.xml

<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
  <name>services_quiz_srv</name>
  <version>0.0.0</version>
  <description>TODO: Package description</description>
  <maintainer email="user@todo.todo">user</maintainer>
  <license>TODO: License declaration</license>

  <buildtool_depend>ament_cmake</buildtool_depend>

  <depend>rclcpp</depend>
  <depend>std_msgs</depend>

  <build_depend>rosidl_default_generators</build_depend>
  <exec_depend>rosidl_default_runtime</exec_depend>
  <member_of_group>rosidl_interface_packages</member_of_group>

  <test_depend>ament_lint_auto</test_depend>
  <test_depend>ament_lint_common</test_depend>

  <export>
    <build_type>ament_cmake</build_type>
  </export>
</package>

i only have 2 attempts remaining. please help.

The solution is to delete build/install/log folders and DO NOT build it. let gradebot build it.

2 Likes

A two-line fix for gradebot would be to run

cd ~/ros2_ws 
rm -rf build install log

inside the auto-grader. These worked for me.

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.