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

[Bug] Could not compile with the massdrop/ctrl keyboard: multiple definition of dmac_desc #9733

Closed
3 tasks
yu17 opened this issue Jul 15, 2020 · 3 comments
Closed
3 tasks

Comments

@yu17
Copy link

yu17 commented Jul 15, 2020

The firmware could not be compiled with the massdrop/ctrl keyboard. The compilation exits with a bunch of multiple definition of 'dmac_desc' errors.

Describe the Bug

Steps to reproduce:

Cloning a fresh copy of QMK by:

qmk setup

Then compile the firmware with:

qmk compile -kb massdrop/ctrl -km default

And the following errors would occur:

Linking: .build/massdrop_ctrl_default.elf                                                           [ERRORS]
 | 
 | /usr/lib/gcc/arm-none-eabi/10.1.0/../../../../arm-none-eabi/bin/ld: .build/obj_massdrop_ctrl_default/config_led.o:/home/($HOME)/QMK/qmk_firmware.test/tmk_core/protocol/arm_atsam/i2c_master.h:28: multiple definition of `dmac_desc_wb'; .build/obj_massdrop_ctrl_default/matrix.o:/home/($HOME)/QMK/qmk_firmware.test/tmk_core/protocol/arm_atsam/i2c_master.h:28: first defined here
 | /usr/lib/gcc/arm-none-eabi/10.1.0/../../../../arm-none-eabi/bin/ld: .build/obj_massdrop_ctrl_default/config_led.o:/home/($HOME)/QMK/qmk_firmware.test/tmk_core/protocol/arm_atsam/i2c_master.h:27: multiple definition of `dmac_desc'; .build/obj_massdrop_ctrl_default/matrix.o:/home/($HOME)/QMK/qmk_firmware.test/tmk_core/protocol/arm_atsam/i2c_master.h:27: first defined here
 | /usr/lib/gcc/arm-none-eabi/10.1.0/../../../../arm-none-eabi/bin/ld: .build/obj_massdrop_ctrl_default/keyboards/massdrop/ctrl/keymaps/default/keymap.o:/home/($HOME)/QMK/qmk_firmware.test/tmk_core/protocol/arm_atsam/i2c_master.h:28: multiple definition of `dmac_desc_wb'; .build/obj_massdrop_ctrl_default/matrix.o:/home/($HOME)/QMK/qmk_firmware.test/tmk_core/protocol/arm_atsam/i2c_master.h:28: first defined here
 | /usr/lib/gcc/arm-none-eabi/10.1.0/../../../../arm-none-eabi/bin/ld: .build/obj_massdrop_ctrl_default/keyboards/massdrop/ctrl/keymaps/default/keymap.o:/home/($HOME)/QMK/qmk_firmware.test/tmk_core/protocol/arm_atsam/i2c_master.h:27: multiple definition of `dmac_desc'; .build/obj_massdrop_ctrl_default/matrix.o:/home/($HOME)/QMK/qmk_firmware.test/tmk_core/protocol/arm_atsam/i2c_master.h:27: first defined here
 | /usr/lib/gcc/arm-none-eabi/10.1.0/../../../../arm-none-eabi/bin/ld: .build/obj_massdrop_ctrl_default/common/arm_atsam/suspend.o:/home/($HOME)/QMK/qmk_firmware.test/tmk_core/protocol/arm_atsam/i2c_master.h:28: multiple definition of `dmac_desc_wb'; .build/obj_massdrop_ctrl_default/matrix.o:/home/($HOME)/QMK/qmk_firmware.test/tmk_core/protocol/arm_atsam/i2c_master.h:28: first defined here
 | /usr/lib/gcc/arm-none-eabi/10.1.0/../../../../arm-none-eabi/bin/ld: .build/obj_massdrop_ctrl_default/common/arm_atsam/suspend.o:/home/($HOME)/QMK/qmk_firmware.test/tmk_core/protocol/arm_atsam/i2c_master.h:27: multiple definition of `dmac_desc'; .build/obj_massdrop_ctrl_default/matrix.o:/home/($HOME)/QMK/qmk_firmware.test/tmk_core/protocol/arm_atsam/i2c_master.h:27: first defined here
 | /usr/lib/gcc/arm-none-eabi/10.1.0/../../../../arm-none-eabi/bin/ld: .build/obj_massdrop_ctrl_default/common/magic.o:/home/($HOME)/QMK/qmk_firmware.test/quantum/keycode_config.h:44: multiple definition of `keymap_config'; .build/obj_massdrop_ctrl_default/keyboards/massdrop/ctrl/keymaps/default/keymap.o:(.bss+0x4): first defined here
 | /usr/lib/gcc/arm-none-eabi/10.1.0/../../../../arm-none-eabi/bin/ld: .build/obj_massdrop_ctrl_default/protocol/arm_atsam/adc.o:/home/($HOME)/QMK/qmk_firmware.test/tmk_core/protocol/arm_atsam/i2c_master.h:28: multiple definition of `dmac_desc_wb'; .build/obj_massdrop_ctrl_default/matrix.o:/home/($HOME)/QMK/qmk_firmware.test/tmk_core/protocol/arm_atsam/i2c_master.h:28: first defined here
 | /usr/lib/gcc/arm-none-eabi/10.1.0/../../../../arm-none-eabi/bin/ld: .build/obj_massdrop_ctrl_default/protocol/arm_atsam/adc.o:/home/($HOME)/QMK/qmk_firmware.test/tmk_core/protocol/arm_atsam/i2c_master.h:27: multiple definition of `dmac_desc'; .build/obj_massdrop_ctrl_default/matrix.o:/home/($HOME)/QMK/qmk_firmware.test/tmk_core/protocol/arm_atsam/i2c_master.h:27: first defined here
 | /usr/lib/gcc/arm-none-eabi/10.1.0/../../../../arm-none-eabi/bin/ld: .build/obj_massdrop_ctrl_default/protocol/arm_atsam/clks.o:/home/($HOME)/QMK/qmk_firmware.test/tmk_core/protocol/arm_atsam/i2c_master.h:28: multiple definition of `dmac_desc_wb'; .build/obj_massdrop_ctrl_default/matrix.o:/home/($HOME)/QMK/qmk_firmware.test/tmk_core/protocol/arm_atsam/i2c_master.h:28: first defined here
 | /usr/lib/gcc/arm-none-eabi/10.1.0/../../../../arm-none-eabi/bin/ld: .build/obj_massdrop_ctrl_default/protocol/arm_atsam/clks.o:/home/($HOME)/QMK/qmk_firmware.test/tmk_core/protocol/arm_atsam/i2c_master.h:27: multiple definition of `dmac_desc'; .build/obj_massdrop_ctrl_default/matrix.o:/home/($HOME)/QMK/qmk_firmware.test/tmk_core/protocol/arm_atsam/i2c_master.h:27: first defined here
 | /usr/lib/gcc/arm-none-eabi/10.1.0/../../../../arm-none-eabi/bin/ld: .build/obj_massdrop_ctrl_default/protocol/arm_atsam/i2c_master.o:/home/($HOME)/QMK/qmk_firmware.test/tmk_core/protocol/arm_atsam/i2c_master.h:28: multiple definition of `dmac_desc_wb'; .build/obj_massdrop_ctrl_default/matrix.o:/home/($HOME)/QMK/qmk_firmware.test/tmk_core/protocol/arm_atsam/i2c_master.h:28: first defined here
 | /usr/lib/gcc/arm-none-eabi/10.1.0/../../../../arm-none-eabi/bin/ld: .build/obj_massdrop_ctrl_default/protocol/arm_atsam/i2c_master.o:/home/($HOME)/QMK/qmk_firmware.test/tmk_core/protocol/arm_atsam/i2c_master.h:27: multiple definition of `dmac_desc'; .build/obj_massdrop_ctrl_default/matrix.o:/home/($HOME)/QMK/qmk_firmware.test/tmk_core/protocol/arm_atsam/i2c_master.h:27: first defined here
 | /usr/lib/gcc/arm-none-eabi/10.1.0/../../../../arm-none-eabi/bin/ld: .build/obj_massdrop_ctrl_default/protocol/arm_atsam/led_matrix.o:/home/($HOME)/QMK/qmk_firmware.test/tmk_core/protocol/arm_atsam/i2c_master.h:28: multiple definition of `dmac_desc_wb'; .build/obj_massdrop_ctrl_default/matrix.o:/home/($HOME)/QMK/qmk_firmware.test/tmk_core/protocol/arm_atsam/i2c_master.h:28: first defined here
 | /usr/lib/gcc/arm-none-eabi/10.1.0/../../../../arm-none-eabi/bin/ld: .build/obj_massdrop_ctrl_default/protocol/arm_atsam/led_matrix.o:/home/($HOME)/QMK/qmk_firmware.test/tmk_core/protocol/arm_atsam/i2c_master.h:27: multiple definition of `dmac_desc'; .build/obj_massdrop_ctrl_default/matrix.o:/home/($HOME)/QMK/qmk_firmware.test/tmk_core/protocol/arm_atsam/i2c_master.h:27: first defined here
 | /usr/lib/gcc/arm-none-eabi/10.1.0/../../../../arm-none-eabi/bin/ld: .build/obj_massdrop_ctrl_default/protocol/arm_atsam/main_arm_atsam.o:/home/($HOME)/QMK/qmk_firmware.test/tmk_core/protocol/arm_atsam/i2c_master.h:28: multiple definition of `dmac_desc_wb'; .build/obj_massdrop_ctrl_default/matrix.o:/home/($HOME)/QMK/qmk_firmware.test/tmk_core/protocol/arm_atsam/i2c_master.h:28: first defined here
 | /usr/lib/gcc/arm-none-eabi/10.1.0/../../../../arm-none-eabi/bin/ld: .build/obj_massdrop_ctrl_default/protocol/arm_atsam/main_arm_atsam.o:/home/($HOME)/QMK/qmk_firmware.test/tmk_core/protocol/arm_atsam/i2c_master.h:27: multiple definition of `dmac_desc'; .build/obj_massdrop_ctrl_default/matrix.o:/home/($HOME)/QMK/qmk_firmware.test/tmk_core/protocol/arm_atsam/i2c_master.h:27: first defined here
 | /usr/lib/gcc/arm-none-eabi/10.1.0/../../../../arm-none-eabi/bin/ld: .build/obj_massdrop_ctrl_default/protocol/arm_atsam/spi.o:/home/($HOME)/QMK/qmk_firmware.test/tmk_core/protocol/arm_atsam/i2c_master.h:28: multiple definition of `dmac_desc_wb'; .build/obj_massdrop_ctrl_default/matrix.o:/home/($HOME)/QMK/qmk_firmware.test/tmk_core/protocol/arm_atsam/i2c_master.h:28: first defined here
 | /usr/lib/gcc/arm-none-eabi/10.1.0/../../../../arm-none-eabi/bin/ld: .build/obj_massdrop_ctrl_default/protocol/arm_atsam/spi.o:/home/($HOME)/QMK/qmk_firmware.test/tmk_core/protocol/arm_atsam/i2c_master.h:27: multiple definition of `dmac_desc'; .build/obj_massdrop_ctrl_default/matrix.o:/home/($HOME)/QMK/qmk_firmware.test/tmk_core/protocol/arm_atsam/i2c_master.h:27: first defined here
 | /usr/lib/gcc/arm-none-eabi/10.1.0/../../../../arm-none-eabi/bin/ld: .build/obj_massdrop_ctrl_default/protocol/arm_atsam/usb/usb2422.o:/home/($HOME)/QMK/qmk_firmware.test/tmk_core/protocol/arm_atsam/i2c_master.h:28: multiple definition of `dmac_desc_wb'; .build/obj_massdrop_ctrl_default/matrix.o:/home/($HOME)/QMK/qmk_firmware.test/tmk_core/protocol/arm_atsam/i2c_master.h:28: first defined here
 | /usr/lib/gcc/arm-none-eabi/10.1.0/../../../../arm-none-eabi/bin/ld: .build/obj_massdrop_ctrl_default/protocol/arm_atsam/usb/usb2422.o:/home/($HOME)/QMK/qmk_firmware.test/tmk_core/protocol/arm_atsam/i2c_master.h:27: multiple definition of `dmac_desc'; .build/obj_massdrop_ctrl_default/matrix.o:/home/($HOME)/QMK/qmk_firmware.test/tmk_core/protocol/arm_atsam/i2c_master.h:27: first defined here
 | collect2: error: ld returned 1 exit status
 | 
make[1]: *** [tmk_core/rules.mk:306: .build/massdrop_ctrl_default.elf] Error 1
Make finished with errors
make: *** [Makefile:584: massdrop/ctrl:default] Error 1

System Information

  • Keyboard: massdrop/ctrl
    • Revision (if applicable):
  • Operating system: Arch Linux 5.7.8-arch1-1
  • AVR GCC version: 8.3.0
  • ARM GCC version: 10.1.10
  • QMK Firmware version: 0.9.38
  • Any keyboard related software installed?
    • AutoHotKey
    • Karabiner
    • Other:

Additional Context

I had looked into this issue, and the problem is with these two files: tmk_core/protocol/arm_atsam/i2c_master.h and tmk_core/protocol/arm_atsam/i2c_master.c.

Since the issue is about duplicate definitions in the linking stage, it could actually be fixed by removing the following two lines:

__attribute__((__aligned__(16))) DmacDescriptor dmac_desc;
__attribute__((__aligned__(16))) DmacDescriptor dmac_desc_wb;

from tmk_core/protocol/arm_atsam/i2c_master.h and add them to tmk_core/protocol/arm_atsam/i2c_master.c.

However, I'm not quite familiar with the __attribute__ thing, and am not sure if this is a proper fix for this problem.

@fauxpark
Copy link
Member

#9485

@zvecr
Copy link
Member

zvecr commented Feb 27, 2021

Fixed by 9485

@chrisdonlan
Copy link

chrisdonlan commented May 29, 2021

Recompiling for a keyboard that worked in 2017, and I am running into this bug again.

After checking #9485, it looks like the "fix" was immediately un-fixed.

The fix was not really a fix: more permissive compiler settings were added to tmk_core/rules.mk such that, project wide, the compiler no longer checked for duplicate definitions.

Instead, add CFLAGS += -fcommon to your massdrop rules.mk files to get things working again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants