xpack-dev-tools / arm-none-eabi-gcc-xpack

A binary distribution of the Arm Embedded GCC toolchain
https://xpack-dev-tools.github.io/arm-none-eabi-gcc-xpack/
MIT License
206 stars 25 forks source link

v10.2.1-1.1 linker issue #13

Closed policeman0077 closed 3 years ago

policeman0077 commented 3 years ago

Just downloaded the latest v10.2.1 gave me an error as following. I am not too sure if it is the linker's problem or my code. The code could be built without problem on v9.2.1-1.1.1 and v9.3.1-1.4 Thanks in advance for your input.

Building target: example_apps.elf Invoking: Cross ARM GNU C++ Linker arm-none-eabi-g++ -mcpu=cortex-m3 -mthumb -Og -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -fno-move-loop-invariants -Wall -Wextra -g3 -T mem.ld -T libs.ld -T sections.ld -nostartfiles -Xlinker --gc-sections -L"../src/sdk/ldscripts" -L../src/sdk/lib -Wl,-Map,"example_apps.map" --specs=nano.specs -o "example_apps.elf" ./src/sdk/system/src/stm32f1-stdperiph/misc.o ./src/sdk/system/src/stm32f1-stdperiph/stm32f10x_adc.o ./src/sdk/system/src/stm32f1-stdperiph/stm32f10x_bkp.o ./src/sdk/system/src/stm32f1-stdperiph/stm32f10x_can.o ./src/sdk/system/src/stm32f1-stdperiph/stm32f10x_cec.o ./src/sdk/system/src/stm32f1-stdperiph/stm32f10x_crc.o ./src/sdk/system/src/stm32f1-stdperiph/stm32f10x_dac.o ./src/sdk/system/src/stm32f1-stdperiph/stm32f10x_dbgmcu.o ./src/sdk/system/src/stm32f1-stdperiph/stm32f10x_dma.o ./src/sdk/system/src/stm32f1-stdperiph/stm32f10x_exti.o ./src/sdk/system/src/stm32f1-stdperiph/stm32f10x_flash.o ./src/sdk/system/src/stm32f1-stdperiph/stm32f10x_fsmc.o ./src/sdk/system/src/stm32f1-stdperiph/stm32f10x_gpio.o ./src/sdk/system/src/stm32f1-stdperiph/stm32f10x_i2c.o ./src/sdk/system/src/stm32f1-stdperiph/stm32f10x_iwdg.o ./src/sdk/system/src/stm32f1-stdperiph/stm32f10x_pwr.o ./src/sdk/system/src/stm32f1-stdperiph/stm32f10x_rcc.o ./src/sdk/system/src/stm32f1-stdperiph/stm32f10x_rtc.o ./src/sdk/system/src/stm32f1-stdperiph/stm32f10x_sdio.o ./src/sdk/system/src/stm32f1-stdperiph/stm32f10x_spi.o ./src/sdk/system/src/stm32f1-stdperiph/stm32f10x_tim.o ./src/sdk/system/src/stm32f1-stdperiph/stm32f10x_usart.o ./src/sdk/system/src/stm32f1-stdperiph/stm32f10x_wwdg.o ./src/sdk/system/src/newlib/_cxx.o ./src/sdk/system/src/newlib/_exit.o ./src/sdk/system/src/newlib/_sbrk.o ./src/sdk/system/src/newlib/_startup.o ./src/sdk/system/src/newlib/_syscalls.o ./src/sdk/system/src/newlib/assert.o ./src/sdk/system/src/diag/Trace.o ./src/sdk/system/src/diag/trace_impl.o ./src/sdk/system/src/cortexm/_initialize_hardware.o ./src/sdk/system/src/cortexm/_reset_hardware.o ./src/sdk/system/src/cortexm/exception_handlers.o ./src/sdk/system/src/cmsis/system_stm32f10x.o ./src/sdk/system/src/cmsis/vectors_stm32f10x.o ./src/sdk/system/src/main.o ./src/sdk/middleware/sys/tipot_debug_util.o ./src/sdk/middleware/support/clock.o ./src/sdk/middleware/support/gpio_test.o ./src/sdk/middleware/support/interrupts.o ./src/sdk/middleware/support/rtimer-arch.o ./src/sdk/middleware/radio/radio-driver.o ./src/sdk/middleware/ethernet/ip64-null-driver.o ./src/sdk/middleware/ethernet/ip64-tap-driver.o ./src/contiki/core/sys/arg.o ./src/contiki/core/sys/autostart.o ./src/contiki/core/sys/compower.o ./src/contiki/core/sys/ctimer.o ./src/contiki/core/sys/energest.o ./src/contiki/core/sys/etimer.o ./src/contiki/core/sys/mt.o ./src/contiki/core/sys/process.o ./src/contiki/core/sys/procinit.o ./src/contiki/core/sys/rtimer.o ./src/contiki/core/sys/stimer.o ./src/contiki/core/sys/timer.o ./src/contiki/core/net/rpl/rpl-dag.o ./src/contiki/core/net/rpl/rpl-ext-header.o ./src/contiki/core/net/rpl/rpl-icmp6.o ./src/contiki/core/net/rpl/rpl-mrhof.o ./src/contiki/core/net/rpl/rpl-nbr-policy.o ./src/contiki/core/net/rpl/rpl-ns.o ./src/contiki/core/net/rpl/rpl-of0.o ./src/contiki/core/net/rpl/rpl-timers.o ./src/contiki/core/net/rpl/rpl.o ./src/contiki/core/net/mac/sicslowmac/sicslowmac.o ./src/contiki/core/net/mac/cxmac/cxmac.o ./src/contiki/core/net/mac/contikimac/contikimac-framer.o ./src/contiki/core/net/mac/contikimac/contikimac.o ./src/contiki/core/net/mac/csma.o ./src/contiki/core/net/mac/frame802154.o ./src/contiki/core/net/mac/frame802154e-ie.o ./src/contiki/core/net/mac/framer-802154.o ./src/contiki/core/net/mac/framer-nullmac.o ./src/contiki/core/net/mac/mac-sequence.o ./src/contiki/core/net/mac/mac.o ./src/contiki/core/net/mac/nordc.o ./src/contiki/core/net/mac/nullmac.o ./src/contiki/core/net/mac/nullrdc-noframer.o ./src/contiki/core/net/mac/nullrdc.o ./src/contiki/core/net/mac/phase.o ./src/contiki/core/net/llsec/noncoresec/noncoresec.o ./src/contiki/core/net/llsec/anti-replay.o ./src/contiki/core/net/llsec/ccm-star-packetbuf.o ./src/contiki/core/net/llsec/nullsec.o ./src/contiki/core/net/ipv6/multicast/esmrf.o ./src/contiki/core/net/ipv6/multicast/roll-tm.o ./src/contiki/core/net/ipv6/multicast/smrf.o ./src/contiki/core/net/ipv6/multicast/uip-mcast6-route.o ./src/contiki/core/net/ipv6/multicast/uip-mcast6-stats.o ./src/contiki/core/net/ipv6/sicslowpan.o ./src/contiki/core/net/ipv6/uip-ds6-nbr.o ./src/contiki/core/net/ipv6/uip-ds6-route.o ./src/contiki/core/net/ipv6/uip-ds6.o ./src/contiki/core/net/ipv6/uip-icmp6.o ./src/contiki/core/net/ipv6/uip-nd6.o ./src/contiki/core/net/ipv6/uip6.o ./src/contiki/core/net/ipv6/websocket-http-client.o ./src/contiki/core/net/ipv6/websocket.o ./src/contiki/core/net/ipv4/uaodv-rt.o ./src/contiki/core/net/ipv4/uaodv.o ./src/contiki/core/net/ipv4/uip-fw-drv.o ./src/contiki/core/net/ipv4/uip-fw.o ./src/contiki/core/net/ipv4/uip-neighbor.o ./src/contiki/core/net/ipv4/uip-over-mesh.o ./src/contiki/core/net/ipv4/uip_arp.o ./src/contiki/core/net/ip64/ip64-addrmap.o ./src/contiki/core/net/ip64/ip64-arp.o ./src/contiki/core/net/ip64/ip64-dhcpc.o ./src/contiki/core/net/ip64/ip64-dns64.o ./src/contiki/core/net/ip64/ip64-eth-interface.o ./src/contiki/core/net/ip64/ip64-eth.o ./src/contiki/core/net/ip64/ip64-ipv4-dhcp.o ./src/contiki/core/net/ip64/ip64-null-driver.o ./src/contiki/core/net/ip64/ip64-slip-interface.o ./src/contiki/core/net/ip64/ip64-special-ports.o ./src/contiki/core/net/ip64/ip64.o ./src/contiki/core/net/ip/dhcpc.o ./src/contiki/core/net/ip/ip64-addr.o ./src/contiki/core/net/ip/psock.o ./src/contiki/core/net/ip/resolv.o ./src/contiki/core/net/ip/simple-udp.o ./src/contiki/core/net/ip/slipdev.o ./src/contiki/core/net/ip/tcp-socket.o ./src/contiki/core/net/ip/tcpip.o ./src/contiki/core/net/ip/udp-socket.o ./src/contiki/core/net/ip/uip-debug.o ./src/contiki/core/net/ip/uip-nameserver.o ./src/contiki/core/net/ip/uip-packetqueue.o ./src/contiki/core/net/ip/uip-split.o ./src/contiki/core/net/ip/uip-udp-packet.o ./src/contiki/core/net/ip/uiplib.o ./src/contiki/core/net/http-socket/http-socket.o ./src/contiki/core/net/link-stats.o ./src/contiki/core/net/linkaddr.o ./src/contiki/core/net/nbr-table.o ./src/contiki/core/net/net-debug.o ./src/contiki/core/net/netstack.o ./src/contiki/core/net/packetbuf.o ./src/contiki/core/net/queuebuf.o ./src/contiki/core/lib/strncasecmp/strncasecmp.o ./src/contiki/core/lib/aes-128.o ./src/contiki/core/lib/assert.o ./src/contiki/core/lib/ccm-star.o ./src/contiki/core/lib/crc16.o ./src/contiki/core/lib/gcr.o ./src/contiki/core/lib/ifft.o ./src/contiki/core/lib/list.o ./src/contiki/core/lib/me.o ./src/contiki/core/lib/me_tabs.o ./src/contiki/core/lib/memb.o ./src/contiki/core/lib/mmem.o ./src/contiki/core/lib/petsciiconv.o ./src/contiki/core/lib/print-stats.o ./src/contiki/core/lib/random.o ./src/contiki/core/lib/ringbuf.o ./src/contiki/core/lib/ringbufindex.o ./src/contiki/core/lib/sensors.o ./src/contiki/core/lib/settings.o ./src/contiki/core/lib/trickle-timer.o ./src/contiki/core/dev/leds.o ./src/contiki/core/dev/nullradio.o ./src/contiki/core/dev/serial-line.o ./src/contiki/core/dev/slip.o ./src/contiki/core/cfs/cfs-coffee.o ./src/apps/utility/comcommands.o ./src/apps/utility/tipot_com_util.o ./src/apps/9_hands-on/lab9_gateway.o ./src/apps/9_hands-on/lab9_mote.o ./src/apps/9_hands-on/lab9_udp_server.o ./src/apps/8_security/Secure_CloudApp/tipot_gateway.o ./src/apps/8_security/Secure_CloudApp/tipot_gateway_udp_server.o ./src/apps/8_security/Secure_CloudApp/tipot_mote.o ./src/apps/8_security/Encrypt_UDP/Encrypt_client.o ./src/apps/8_security/Encrypt_UDP/Encrypt_server.o ./src/apps/7_cloudapp/psock_client.o ./src/apps/7_cloudapp/psock_server.o ./src/apps/6_UDP/simple_client.o ./src/apps/6_UDP/simple_client1.o ./src/apps/6_UDP/simple_server.o ./src/apps/6_UDP/simple_server1.o ./src/apps/5_sensors/lab5.o ./src/apps/5_sensors/light.o ./src/apps/5_sensors/temperature_humidity.o ./src/apps/5_sensors/water.o ./src/apps/4_outputdevices/4_4adcTest/adcTest1.o ./src/apps/4_outputdevices/4_4adcTest/adcTest2.o ./src/apps/4_outputdevices/4_3button/button-demo1.o ./src/apps/4_outputdevices/4_3button/button-demo2.o ./src/apps/4_outputdevices/4_3button/button-demo3.o ./src/apps/4_outputdevices/4_2lcd/lcdprocess1.o ./src/apps/4_outputdevices/4_2lcd/lcdprocess2.o ./src/apps/4_outputdevices/4_1blink/blink1.o ./src/apps/4_outputdevices/4_1blink/blink2.o ./src/apps/3_interface/gpio_test_process/gpio_test_process.o ./src/apps/3_interface/gpio_test_process/gpio_test_process2.o ./src/apps/3_interface/eeprom/eeprom-demo.o ./src/apps/3_interface/dimmable/dimmable.o ./src/apps/2_hello-world/hello-world1.o ./src/apps/2_hello-world/hello-world2.o ./src/apps/2_hello-world/hello-world3.o ./src/apps/tipot_app_start.o -lTipotLabCrypto -ldrivers /Users/diandizhu/Library/xPacks/@xpack-dev-tools/arm-none-eabi-gcc/10.2.1-1.1.2/.content/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: ./src/apps/9_hands-on/lab9_gateway.o:/Users/diandizhu/Downloads/xy_tech/firmware/tipot-lab-firmware/Debug/../src/apps/utility/comcommands.h:23: multiple definition of 'pb8_event'; ./src/apps/utility/comcommands.o:/Users/diandizhu/Downloads/xy_tech/firmware/tipot-lab-firmware/Debug/../src/apps/utility/comcommands.h:23: first defined here

.....


collect2: error: ld returned 1 exit status
make: *** [example_apps.elf] Error 1
"make -j11 all" terminated with exit code 2. Build might be incomplete.

16:17:15 Build Failed. 24 errors, 368 warnings. (took 4s.753ms)`
ilg-ul commented 3 years ago

First, remove the parallel build option, to clearly see the errors, and analyse them.

policeman0077 commented 3 years ago

hi ilg, thank you for immediate reply. I disabled parallel build, linker gives me same error

image image
policeman0077 commented 3 years ago

I found the solution here:https://github.com/intel/intel-hybrid-driver/issues/27 gcc10 checks linker error by default. quote "To fix this, use extern in header files when declaring global variables, and ensure each global is defined in exactly one C file. "

policeman0077 commented 3 years ago

this could be closed, thanks ilg 😄