Skip to content

Bug: Duplicate symbols if there multiple source files have the same name #683

Closed
@jerry73204

Description

@jerry73204

The compile() complains about duplicate symbols when there are multiple input files with the same name but in different directories. The cc names the object file by its source file and places them under OUT_DIR. It causes one object file to replace the other file, and pack the last object file twice in the .a static library.

This is an example of the occurrence. The target/debug/build/xxx/output log shows that two empty__functions.c files from different dirs are compiled into empty_functions.o in the same directory.

running: "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64" "-I" "/xxx/include" "-Wall" "-Wextra" "-o" "/my-crate/target/debug/build/rclrust-msg-ac6046ca5e70df07/out/empty__functions.o" "-c" "/xxx/include/std_msgs/msg/detail/empty__functions.c"
...
running: "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64" "-I" "/xxx/include" "-Wall" "-Wextra" "-o" "/my-crate/target/debug/build/rclrust-msg-ac6046ca5e70df07/out/empty__functions.o" "-c" "/xxx/include/std_srvs/srv/detail/empty__functions.c"
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions