ApolloAuto / apollo

An open autonomous driving platform
Apache License 2.0
25.2k stars 9.71k forks source link

new component launch problem #14506

Closed dotorl127 closed 2 years ago

dotorl127 commented 2 years ago

We appreciate you go through Apollo documentations and search previous issues before creating an new one. If neither of the sources helped you with your issues, please report the issue using the following form. Please note missing info can delay the response time.

System information

Steps to reproduce the issue:

Supporting materials (screenshots, command lines, code/script snippets):

E0701 11:22:35.258589 12851 class_loader_utility.cc:218] [mainboard]LibraryLoadException: /apollo/bazel-bin/modules/perception/onboard/component/../../../../_solib_local/libmodules_Sperception_Scamera_Slib_Straffic_Ulight_Sdetector_Srecognition_Slibketi_Uclassify.so: undefined symbol: _ZN6apollo10perception6camera30KETITrafficLightClassification14kOutputChannelE
E0701 11:22:35.258620 12851 class_loader_utility.cc:234] [mainboard]shared library failed: /apollo/bazel-bin/modules/perception/onboard/component/libperception_component_keti_camera.so
E0701 11:22:35.258631 12851 class_loader_manager.h:70] [mainboard]Invalid class name: KetiTrafficLightsPerceptionComponent
E0701 11:22:35.258641 12851 module_controller.cc:67] [mainboard]Failed to load module: /apollo/modules/perception/production/dag/keti_dag_streaming_perception_trafficlights.dag
E0701 11:22:35.258648 12851 class_loader_utility.cc:256] [mainboard]Attempt to UnloadLibrary lib, but can't find lib: /apollo/bazel-bin/modules/perception/onboard/component/libperception_component_keti_camera.so
E0701 11:22:35.258653 12851 mainboard.cc:39] [mainboard]module start error.

and I've found #13047 issue so tried ldd, nm command and got below information

ldd bazel-bin/modules/perception/onboard/component/../../../../_solib_local/libmodules_Sperception_Scamera_Slib_Straffic_Ulight_Sdetector_Srecognition_Slibketi_Uclassify.so
    linux-vdso.so.1 (0x00007ffe34b99000)
    libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f2f450af000)
    libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f2f44e97000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f2f44aa6000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f2f44708000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f2f4565a000)
nm bazel-bin/modules/perception/onboard/component/../../../../_solib_local/libmodules_Sperception_Scamera_Slib_Straffic_Ulight_Sdetector_Srecognition_Slibketi_Uclassify.so | grep _ZN6apollo10perception6camera30KETITrafficLightClassification14kOutputChannelE
                 U _ZN6apollo10perception6camera30KETITrafficLightClassification14kOutputChannelE
daohu527 commented 2 years ago

Although I don't know the exact reason, pls make sure your own module build config like below.

cc_binary(
    name = "libperception_component_camera.so",
    linkshared = True, 
    linkstatic = False,   # be sure to set this
    deps = [":perception_component_inner_camera"],
)
dotorl127 commented 2 years ago

Although I don't know the exact reason, pls make sure your own module build config like below.

cc_binary(
    name = "libperception_component_camera.so",
    linkshared = True, 
    linkstatic = False,   # be sure to set this
    deps = [":perception_component_inner_camera"],
)

hello, I modified BUILD file locate in the onboard/component directory I added my custom component file(.cc, .h) into perception_component_inner_camera but when build with ./apollo.sh build_opt_gpu follow error occurred what should I do?

(03:43:11) ERROR: /apollo/modules/perception/onboard/component/BUILD:29:11: Linking of rule '//modules/perception/onboard/component:perception_component_inner_camera' failed (Exit 1): crosstool_wrapper_driver_is_not_gcc failed: error executing command external/local_config_cuda/crosstool/clang/bin/crosstool_wrapper_driver_is_not_gcc @bazel-out/k8-opt/bin/modules/perception/onboard/component/libperception_component_inner_camera.so-2.params
bazel-out/k8-opt/bin/modules/perception/onboard/component/_objs/perception_component_inner_camera/keti_trafficlights_perception_component.pic.o:(.bss._ZN6apollo10perception7onboard10s_tl_infosE+0x0): multiple definition of `apollo::perception::onboard::s_tl_infos'
bazel-out/k8-opt/bin/modules/perception/onboard/component/_objs/perception_component_inner_camera/trafficlights_perception_component.pic.o:(.bss._ZN6apollo10perception7onboard10s_tl_infosE+0x0): first defined here
collect2: error: ld returned 1 exit status
(03:43:11) INFO: Elapsed time: 4.537s, Critical Path: 2.26s
(03:43:11) INFO: 563 processes: 150 remote cache hit, 413 internal.
(03:43:11) FAILED: Build did NOT complete successfully
dotorl127 commented 2 years ago

Although I don't know the exact reason, pls make sure your own module build config like below.

cc_binary(
    name = "libperception_component_camera.so",
    linkshared = True, 
    linkstatic = False,   # be sure to set this
    deps = [":perception_component_inner_camera"],
)

hello, I modified BUILD file locate in the onboard/component directory I added my custom component file(.cc, .h) into perception_component_inner_camera but when build with ./apollo.sh build_opt_gpu follow error occurred what should I do?

(03:43:11) ERROR: /apollo/modules/perception/onboard/component/BUILD:29:11: Linking of rule '//modules/perception/onboard/component:perception_component_inner_camera' failed (Exit 1): crosstool_wrapper_driver_is_not_gcc failed: error executing command external/local_config_cuda/crosstool/clang/bin/crosstool_wrapper_driver_is_not_gcc @bazel-out/k8-opt/bin/modules/perception/onboard/component/libperception_component_inner_camera.so-2.params
bazel-out/k8-opt/bin/modules/perception/onboard/component/_objs/perception_component_inner_camera/keti_trafficlights_perception_component.pic.o:(.bss._ZN6apollo10perception7onboard10s_tl_infosE+0x0): multiple definition of `apollo::perception::onboard::s_tl_infos'
bazel-out/k8-opt/bin/modules/perception/onboard/component/_objs/perception_component_inner_camera/trafficlights_perception_component.pic.o:(.bss._ZN6apollo10perception7onboard10s_tl_infosE+0x0): first defined here
collect2: error: ld returned 1 exit status
(03:43:11) INFO: Elapsed time: 4.537s, Critical Path: 2.26s
(03:43:11) INFO: 563 processes: 150 remote cache hit, 413 internal.
(03:43:11) FAILED: Build did NOT complete successfully

It has been multiple definition variable problem so I was fixed and succeed build but same error occurred when launch component

E0704 14:01:03.765213 20561 class_loader_utility.cc:218] [mainboard]LibraryLoadException: /apollo/bazel-bin/modules/perception/onboard/component/../../../../_solib_local/libmodules_Sperception_Scamera_Slib_Straffic_Ulight_Sdetector_Srecognition_Slibketi_Uclassify.so: undefined symbol: _ZN6apollo10perception6camera30KETITrafficLightClassification11kInputWidthE
E0704 14:01:03.765256 20561 class_loader_utility.cc:234] [mainboard]shared library failed: /apollo/bazel-bin/modules/perception/onboard/component/libperception_component_camera.so
E0704 14:01:03.765282 20561 class_loader_manager.h:70] [mainboard]Invalid class name: KetiTrafficLightsPerceptionComponent
E0704 14:01:03.765300 20561 module_controller.cc:67] [mainboard]Failed to load module: /apollo/modules/perception/production/dag/keti_dag_streaming_perception_trafficlights.dag
E0704 14:01:03.765312 20561 class_loader_utility.cc:256] [mainboard]Attempt to UnloadLibrary lib, but can't find lib: /apollo/bazel-bin/modules/perception/onboard/component/libperception_component_camera.so
E0704 14:01:03.765321 20561 mainboard.cc:39] [mainboard]module start error.

also I got same result nm below

nm /apollo/bazel-bin/modules/perception/onboard/component/../../../../_solib_local/libmodules_Sperception_Scamera_Slib_Straffic_Ulight_Sdetector_Srecognition_Slibketi_Uclassify.so | grep _ZN6apollo10perception6camera30KETITrafficLightClassification11kInputWidthE
                 U _ZN6apollo10perception6camera30KETITrafficLightClassification11kInputWidthE
daohu527 commented 2 years ago
  1. could you pls show you BUILd file how to build KetiTrafficLightsPerceptionComponent
  2. do you register the component to cyber use CYBER_REGISTER_COMPONENT(KetiTrafficLightsPerceptionComponent)
dotorl127 commented 2 years ago
  1. could you pls show you BUILd file how to build KetiTrafficLightsPerceptionComponent
  2. do you register the component to cyber use CYBER_REGISTER_COMPONENT(KetiTrafficLightsPerceptionComponent)

thank you for reply

  1. below is details of BUILD file
    
    load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
    load("//tools/install:install.bzl", "install")
    load("//tools:cpplint.bzl", "cpplint")

package(default_visibility = ["//visibility:public"])

PERCEPTION_COPTS = ['-DMODULE_NAME=\"perception\"']

install( name = "install", targets = [ ":libperception_component_camera.so", ":libperception_component_lidar.so", ], deps = [ "//cyber:install", "//modules/perception/production:install", ], )

cc_binary( name = "libperception_component_camera.so", linkshared = True, linkstatic = False, deps = [":perception_component_inner_camera"], )

cc_library( name = "perception_component_inner_camera", srcs = [ "camera_obstacle_detection_component.cc", "camera_perception_viz_message.cc", "fusion_camera_detection_component.cc", "lane_detection_component.cc", "trafficlights_perception_component.cc", "keti_trafficlights_perception_component.cc", ], hdrs = [ "camera_obstacle_detection_component.h", "camera_perception_viz_message.h", "fusion_camera_detection_component.h", "lane_detection_component.h", "trafficlights_perception_component.h", "keti_trafficlights_perception_component.h", ], copts = PERCEPTION_COPTS, deps = [ "//cyber", "//cyber/time:clock", "//modules/common/math", "//modules/common/proto:error_code_cc_proto", "//modules/common/proto:geometry_cc_proto", "//modules/common/proto:header_cc_proto", "//modules/common/util:eigen_defs", "//modules/common/util:time_util", "//modules/drivers/proto:sensor_image_cc_proto", "//modules/map/proto:map_cc_proto", "//modules/perception/base", "//modules/perception/camera/lib/interface", "//modules/perception/camera/app:cipv_camera", "//modules/perception/camera/app:lane_camera_perception", "//modules/perception/camera/app:obstacle_camera_perception", "//modules/perception/camera/app:obstacle_detection_camera", "//modules/perception/camera/app:traffic_light_camera_perception", "//modules/perception/camera/lib/traffic_light/preprocessor:tl_preprocessor", "//modules/perception/camera/common", "//modules/perception/camera/lib/motion_service:motion_service_lib", "//modules/perception/camera/tools/offline:transform_server", "//modules/perception/camera/tools/offline:visualizer", "//modules/perception/common/sensor_manager", "//modules/perception/map/hdmap:hdmap_input", "//modules/perception/onboard/common_flags", "//modules/perception/onboard/inner_component_messages", "//modules/perception/onboard/msg_serializer", "//modules/perception/onboard/proto:fusion_camera_detection_component_cc_proto", "//modules/perception/onboard/proto:lane_perception_component_cc_proto", "//modules/perception/onboard/proto:trafficlights_perception_component_cc_proto", "//modules/perception/onboard/transform_wrapper", "//modules/perception/proto:perception_camera_cc_proto", "//modules/perception/proto:perception_lane_cc_proto", "//modules/perception/proto:traffic_light_detection_cc_proto", "//modules/transform/proto:transform_cc_proto", "//modules/v2x/common:v2x_proxy_gflags", "//modules/v2x/proto:v2x_traffic_light_cc_proto", "//modules/perception/onboard/proto:camera_component_config_cc_proto", "//modules/perception/camera/app:keti_traffic_light_camera_perception", "//modules/common/util:string_util", "//modules/perception/lib/registerer", "@eigen", "@opencv//:highgui", "@opencv//:imgcodecs", ], alwayslink = True, )

cc_binary( name = "libperception_component_lidar.so", linkshared = True, linkstatic = False, deps = [":perception_component_inner_lidar"], )

cc_library( name = "perception_component_inner_lidar", copts = [ '-DMODULE_NAME=\"perception\"', ], deps = [ ":detection_component", ":fusion_component", ":radar_detection_component", ":recognition_component", ], alwayslink = True, )

cc_library( name = "detection_component", srcs = ["detection_component.cc"], hdrs = ["detection_component.h"], deps = [ ":lidar_inner_component_messages", "//cyber/time:clock", "//modules/common/util:string_util", "//modules/perception/common/sensor_manager", "//modules/perception/lib/registerer", "//modules/perception/lidar/common", "//modules/perception/lidar/app:lidar_obstacle_detection", "//modules/perception/lidar/lib/ground_detector/spatio_temporal_ground_detector", "//modules/perception/lidar/lib/interface", "//modules/perception/lidar/lib/object_builder", "//modules/perception/lidar/lib/object_filter_bank/roi_boundary_filter", "//modules/perception/lidar/lib/roi_filter/hdmap_roi_filter", "//modules/perception/lidar/lib/scene_manager/ground_service", "//modules/perception/lidar/lib/scene_manager/roi_service", "//modules/perception/lidar/lib/detector/point_pillars_detection:point_pillars_detection", "//modules/perception/lidar/lib/detector/cnn_segmentation:cnn_segmentation", "//modules/perception/lidar/lib/detector/ncut_segmentation:ncut_segmentation", "//modules/perception/onboard/common_flags", "//modules/perception/onboard/proto:lidar_component_config_cc_proto", "//modules/perception/onboard/transform_wrapper", "@eigen", ], )

cc_library( name = "fusion_component", srcs = ["fusion_component.cc"], hdrs = ["fusion_component.h"], deps = [ "//cyber/time:clock", "//modules/common/util:perf_util", "//modules/perception/base", "//modules/perception/fusion/app:obstacle_multi_sensor_fusion", "//modules/perception/fusion/lib/dummy:dummy_algorithms", "//modules/perception/fusion/lib/fusion_system/probabilistic_fusion", "//modules/perception/fusion/lib/interface", "//modules/perception/fusion/lib/interface:base_multisensor_fusion", "//modules/perception/lib/registerer", "//modules/perception/lidar/lib/classifier/fused_classifier", "//modules/perception/lidar/lib/classifier/fused_classifier:ccrf_type_fusion", "//modules/perception/map/hdmap:hdmap_input", "//modules/perception/onboard/common_flags", "//modules/perception/onboard/inner_component_messages", "//modules/perception/onboard/msg_serializer", "//modules/perception/onboard/proto:fusion_component_config_cc_proto", "@eigen", ], alwayslink = True, )

cc_library( name = "radar_detection_component", srcs = [ "radar_detection_component.cc", ], hdrs = [ "radar_detection_component.h", ], deps = [ "//cyber/time:clock", "//modules/common/util:perf_util", "//modules/perception/base", "//modules/perception/common/sensor_manager", "//modules/perception/lib/registerer", "//modules/perception/map/hdmap:hdmap_input", "//modules/perception/onboard/common_flags", "//modules/perception/onboard/inner_component_messages", "//modules/perception/onboard/msg_buffer", "//modules/perception/onboard/proto:radar_component_config_cc_proto", "//modules/perception/onboard/transform_wrapper", "//modules/perception/radar/app:radar_obstacle_perception", "//modules/perception/radar/common:radar_util", "//modules/perception/radar/lib/detector/conti_ars_detector", "//modules/perception/radar/lib/dummy:dummy_algorithms", "//modules/perception/radar/lib/interface:base_detector", "//modules/perception/radar/lib/interface:base_filter", "//modules/perception/radar/lib/interface:base_matcher", "//modules/perception/radar/lib/interface:base_preprocessor", "//modules/perception/radar/lib/interface:base_radar_obstacle_perception", "//modules/perception/radar/lib/interface:base_roi_filter", "//modules/perception/radar/lib/interface:base_tracker", "//modules/perception/radar/lib/preprocessor/conti_ars_preprocessor", "//modules/perception/radar/lib/roi_filter/hdmap_radar_roi_filter", "//modules/perception/radar/lib/tracker/common:radar_track", "//modules/perception/radar/lib/tracker/common:radar_track_manager", "//modules/perception/radar/lib/tracker/conti_ars_tracker", "//modules/perception/radar/lib/tracker/filter:adaptive_kalman_filter", "//modules/perception/radar/lib/tracker/matcher:hm_matcher", ], alwayslink = True, )

cc_library( name = "recognition_component", srcs = [ "recognition_component.cc", ], hdrs = [ "recognition_component.h", ], deps = [ ":lidar_inner_component_messages", "//cyber/time:clock", "//modules/common/util:perf_util", "//modules/perception/base", "//modules/perception/common/sensor_manager", "//modules/perception/lib/registerer", "//modules/perception/lidar/app:lidar_obstacle_tracking", "//modules/perception/lidar/common", "//modules/perception/lidar/lib/interface", "//modules/perception/lidar/lib/tracker/multi_lidar_fusion:mlf_engine", "//modules/perception/lidar/lib/tracker/multi_lidar_fusion:mlf_track_object_matcher", "//modules/perception/lidar/lib/tracker/multi_lidar_fusion:mlf_tracker", "//modules/perception/onboard/proto:lidar_component_config_cc_proto", ], alwayslink = True, )

cc_library( name = "lidar_inner_component_messages", hdrs = [ "lidar_inner_component_messages.h", ], deps = [ "//cyber", "//modules/perception/lidar/common", "//modules/perception/onboard/inner_component_messages", ], )


2. I typed `CYBER_REGISTER_COMPONENT(KetiTrafficLightsPerceptionComponent)` in .h file exactly same
daohu527 commented 2 years ago

I missed the error message before!

the error means the _ZN6apollo10perception6camera30KETITrafficLightClassification11kInputWidthE is missing define. Maybe you should include the .h in your "modules/perception/camera/lib/traffic_light/detector/recognition/keti_classify.cc".

You can use below cmd to find the real name of the class.

nm -C /apollo/bazel-bin/modules/perception/onboard/component/../../../../_solib_local/libmodules_Sperception_Scamera_Slib_Straffic_Ulight_Sdetector_Srecognition_Slibketi_Uclassify.so | grep TrafficLightClassification
dotorl127 commented 2 years ago

I missed the error message before!

the error means the _ZN6apollo10perception6camera30KETITrafficLightClassification11kInputWidthE is missing define. Maybe you should include the .h in your "modules/perception/camera/lib/traffic_light/detector/recognition/keti_classify.cc".

You can use below cmd to find the real name of the class.

nm -C /apollo/bazel-bin/modules/perception/onboard/component/../../../../_solib_local/libmodules_Sperception_Scamera_Slib_Straffic_Ulight_Sdetector_Srecognition_Slibketi_Uclassify.so | grep TrafficLightClassification

I think library is problem, I should check my code and fix thank you

dotorl127 commented 2 years ago

I missed the error message before! the error means the _ZN6apollo10perception6camera30KETITrafficLightClassification11kInputWidthE is missing define. Maybe you should include the .h in your "modules/perception/camera/lib/traffic_light/detector/recognition/keti_classify.cc". You can use below cmd to find the real name of the class.

nm -C /apollo/bazel-bin/modules/perception/onboard/component/../../../../_solib_local/libmodules_Sperception_Scamera_Slib_Straffic_Ulight_Sdetector_Srecognition_Slibketi_Uclassify.so | grep TrafficLightClassification

I think library is problem, I should check my code and fix thank you

I found what is wrong. I defined static variable into library code, that was problem. I fixed code then success build and launch.