Build Error: collect2.exe: error: ld returned 1 exit status

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Build Error: collect2.exe: error: ld returned 1 exit status

4,505 Views
michaelsteffenf
NXP Employee
NXP Employee

I created a project FRDM-KL25 and built it in MCUXpresso (just installed). 

 

Got this error after compiling...Project is attached.

 

collect2.exe: error: ld returned 1 exit status

make: *** [MKL25Z128xxx4_Project.axf] Error 1

 

Any idea how to solve or fix this?

 

Michael Steffen

Senior Field Applications Engineer

Member of the Technical Staff

NXP Semiconductors

 

Original Attachment has been moved to: SIP.zip

Labels (1)
0 Kudos
4 Replies

2,620 Views
lpcxpresso_supp
NXP Employee
NXP Employee

Check the full build log (you might need to clean first), or the Problems view. This message generally indicates a problem higher up in the build output.

Details of accessing the Build log in the Console view can be found in the MCUXpresso IDE v10.0.0 User Guide,  section 14.7 - Appendix : The Console View

Regards,

MCUXpresso IDE Support

0 Kudos

2,620 Views
michaelsteffenf
NXP Employee
NXP Employee

I have cleaned and built 20 times.  The error is still there.

What else could be causing this?

Mike

Here is the full Console View:

15:28:49 **** Build of configuration Debug for project MKL25Z128xxx4_Project ****

make -r -j8 all

Building file: ../startup/startup_mkl25z4.c

Building file: ../source/MKL25Z128xxx4_Project.c

Building file: ../source/board.c

make: stat: source/pin_mux.o: Bad file number

Building file: ../source/clock_config.c

Building file: ../source/common.c

Building file: ../source/i2c1.c

Building file: ../source/mtb.c

Invoking: MCU C Compiler

Invoking: MCU C Compiler

arm-none-eabi-gcc -DCR_INTEGER_PRINTF -DSDK_DEBUGCONSOLE=0 -D__MCUXPRESSO -D__USE_CMSIS -DDEBUG -DFSL_RTOS_BM -DSDK_OS_BAREMETAL -DCPU_MKL25Z128VFM4_cm0plus -DCPU_MKL25Z128VFM4 -D__REDLIB__ -I"C:\Users\r80133\Documents\MCUXpressoIDE_10.0.0_344\workspace\MKL25Z128xxx4_Project\source" -I"C:\Users\r80133\Documents\MCUXpressoIDE_10.0.0_344\workspace\MKL25Z128xxx4_Project" -I"C:\Users\r80133\Documents\MCUXpressoIDE_10.0.0_344\workspace\MKL25Z128xxx4_Project\startup" -I"C:\Users\r80133\Documents\MCUXpressoIDE_10.0.0_344\workspace\MKL25Z128xxx4_Project\CMSIS" -O0 -fno-common -g3 -Wall -c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -mcpu=cortex-m0plus -mthumb -D__REDLIB__ -specs=redlib.specs -MMD -MP -MF"startup/startup_mkl25z4.d" -MT"startup/startup_mkl25z4.o" -MT"startup/startup_mkl25z4.d" -o "startup/startup_mkl25z4.o" "../startup/startup_mkl25z4.c"

Building file: ../source/main.c

arm-none-eabi-gcc -DCR_INTEGER_PRINTF -DSDK_DEBUGCONSOLE=0 -D__MCUXPRESSO -D__USE_CMSIS -DDEBUG -DFSL_RTOS_BM -DSDK_OS_BAREMETAL -DCPU_MKL25Z128VFM4_cm0plus -DCPU_MKL25Z128VFM4 -D__REDLIB__ -I"C:\Users\r80133\Documents\MCUXpressoIDE_10.0.0_344\workspace\MKL25Z128xxx4_Project\source" -I"C:\Users\r80133\Documents\MCUXpressoIDE_10.0.0_344\workspace\MKL25Z128xxx4_Project" -I"C:\Users\r80133\Documents\MCUXpressoIDE_10.0.0_344\workspace\MKL25Z128xxx4_Project\startup" -I"C:\Users\r80133\Documents\MCUXpressoIDE_10.0.0_344\workspace\MKL25Z128xxx4_Project\CMSIS" -O0 -fno-common -g3 -Wall -c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -mcpu=cortex-m0plus -mthumb -D__REDLIB__ -specs=redlib.specs -MMD -MP -MF"source/board.d" -MT"source/board.o" -MT"source/board.d" -o "source/board.o" "../source/board.c"

Invoking: MCU C Compiler

Invoking: MCU C Compiler

Invoking: MCU C Compiler

arm-none-eabi-gcc -DCR_INTEGER_PRINTF -DSDK_DEBUGCONSOLE=0 -D__MCUXPRESSO -D__USE_CMSIS -DDEBUG -DFSL_RTOS_BM -DSDK_OS_BAREMETAL -DCPU_MKL25Z128VFM4_cm0plus -DCPU_MKL25Z128VFM4 -D__REDLIB__ -I"C:\Users\r80133\Documents\MCUXpressoIDE_10.0.0_344\workspace\MKL25Z128xxx4_Project\source" -I"C:\Users\r80133\Documents\MCUXpressoIDE_10.0.0_344\workspace\MKL25Z128xxx4_Project" -I"C:\Users\r80133\Documents\MCUXpressoIDE_10.0.0_344\workspace\MKL25Z128xxx4_Project\startup" -I"C:\Users\r80133\Documents\MCUXpressoIDE_10.0.0_344\workspace\MKL25Z128xxx4_Project\CMSIS" -O0 -fno-common -g3 -Wall -c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -mcpu=cortex-m0plus -mthumb -D__REDLIB__ -specs=redlib.specs -MMD -MP -MF"source/common.d" -MT"source/common.o" -MT"source/common.d" -o "source/common.o" "../source/common.c"

Invoking: MCU C Compiler

arm-none-eabi-gcc -DCR_INTEGER_PRINTF -DSDK_DEBUGCONSOLE=0 -D__MCUXPRESSO -D__USE_CMSIS -DDEBUG -DFSL_RTOS_BM -DSDK_OS_BAREMETAL -DCPU_MKL25Z128VFM4_cm0plus -DCPU_MKL25Z128VFM4 -D__REDLIB__ -I"C:\Users\r80133\Documents\MCUXpressoIDE_10.0.0_344\workspace\MKL25Z128xxx4_Project\source" -I"C:\Users\r80133\Documents\MCUXpressoIDE_10.0.0_344\workspace\MKL25Z128xxx4_Project" -I"C:\Users\r80133\Documents\MCUXpressoIDE_10.0.0_344\workspace\MKL25Z128xxx4_Project\startup" -I"C:\Users\r80133\Documents\MCUXpressoIDE_10.0.0_344\workspace\MKL25Z128xxx4_Project\CMSIS" -O0 -fno-common -g3 -Wall -c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -mcpu=cortex-m0plus -mthumb -D__REDLIB__ -specs=redlib.specs -MMD -MP -MF"source/MKL25Z128xxx4_Project.d" -MT"source/MKL25Z128xxx4_Project.o" -MT"source/MKL25Z128xxx4_Project.d" -o "source/MKL25Z128xxx4_Project.o" "../source/MKL25Z128xxx4_Project.c"

Invoking: MCU C Compiler

arm-none-eabi-gcc -DCR_INTEGER_PRINTF -DSDK_DEBUGCONSOLE=0 -D__MCUXPRESSO -D__USE_CMSIS -DDEBUG -DFSL_RTOS_BM -DSDK_OS_BAREMETAL -DCPU_MKL25Z128VFM4_cm0plus -DCPU_MKL25Z128VFM4 -D__REDLIB__ -I"C:\Users\r80133\Documents\MCUXpressoIDE_10.0.0_344\workspace\MKL25Z128xxx4_Project\source" -I"C:\Users\r80133\Documents\MCUXpressoIDE_10.0.0_344\workspace\MKL25Z128xxx4_Project" -I"C:\Users\r80133\Documents\MCUXpressoIDE_10.0.0_344\workspace\MKL25Z128xxx4_Project\startup" -I"C:\Users\r80133\Documents\MCUXpressoIDE_10.0.0_344\workspace\MKL25Z128xxx4_Project\CMSIS" -O0 -fno-common -g3 -Wall -c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -mcpu=cortex-m0plus -mthumb -D__REDLIB__ -specs=redlib.specs -MMD -MP -MF"source/clock_config.d" -MT"source/clock_config.o" -MT"source/clock_config.d" -o "source/clock_config.o" "../source/clock_config.c"

arm-none-eabi-gcc -DCR_INTEGER_PRINTF -DSDK_DEBUGCONSOLE=0 -D__MCUXPRESSO -D__USE_CMSIS -DDEBUG -DFSL_RTOS_BM -DSDK_OS_BAREMETAL -DCPU_MKL25Z128VFM4_cm0plus -DCPU_MKL25Z128VFM4 -D__REDLIB__ -I"C:\Users\r80133\Documents\MCUXpressoIDE_10.0.0_344\workspace\MKL25Z128xxx4_Project\source" -I"C:\Users\r80133\Documents\MCUXpressoIDE_10.0.0_344\workspace\MKL25Z128xxx4_Project" -I"C:\Users\r80133\Documents\MCUXpressoIDE_10.0.0_344\workspace\MKL25Z128xxx4_Project\startup" -I"C:\Users\r80133\Documents\MCUXpressoIDE_10.0.0_344\workspace\MKL25Z128xxx4_Project\CMSIS" -O0 -fno-common -g3 -Wall -c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -mcpu=cortex-m0plus -mthumb -D__REDLIB__ -specs=redlib.specs -MMD -MP -MF"source/mtb.d" -MT"source/mtb.o" -MT"source/mtb.d" -o "source/mtb.o" "../source/mtb.c"

arm-none-eabi-gcc -DCR_INTEGER_PRINTF -DSDK_DEBUGCONSOLE=0 -D__MCUXPRESSO -D__USE_CMSIS -DDEBUG -DFSL_RTOS_BM -DSDK_OS_BAREMETAL -DCPU_MKL25Z128VFM4_cm0plus -DCPU_MKL25Z128VFM4 -D__REDLIB__ -I"C:\Users\r80133\Documents\MCUXpressoIDE_10.0.0_344\workspace\MKL25Z128xxx4_Project\source" -I"C:\Users\r80133\Documents\MCUXpressoIDE_10.0.0_344\workspace\MKL25Z128xxx4_Project" -I"C:\Users\r80133\Documents\MCUXpressoIDE_10.0.0_344\workspace\MKL25Z128xxx4_Project\startup" -I"C:\Users\r80133\Documents\MCUXpressoIDE_10.0.0_344\workspace\MKL25Z128xxx4_Project\CMSIS" -O0 -fno-common -g3 -Wall -c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -mcpu=cortex-m0plus -mthumb -D__REDLIB__ -specs=redlib.specs -MMD -MP -MF"source/i2c1.d" -MT"source/i2c1.o" -MT"source/i2c1.d" -o "source/i2c1.o" "../source/i2c1.c"

Invoking: MCU C Compiler

arm-none-eabi-gcc -DCR_INTEGER_PRINTF -DSDK_DEBUGCONSOLE=0 -D__MCUXPRESSO -D__USE_CMSIS -DDEBUG -DFSL_RTOS_BM -DSDK_OS_BAREMETAL -DCPU_MKL25Z128VFM4_cm0plus -DCPU_MKL25Z128VFM4 -D__REDLIB__ -I"C:\Users\r80133\Documents\MCUXpressoIDE_10.0.0_344\workspace\MKL25Z128xxx4_Project\source" -I"C:\Users\r80133\Documents\MCUXpressoIDE_10.0.0_344\workspace\MKL25Z128xxx4_Project" -I"C:\Users\r80133\Documents\MCUXpressoIDE_10.0.0_344\workspace\MKL25Z128xxx4_Project\startup" -I"C:\Users\r80133\Documents\MCUXpressoIDE_10.0.0_344\workspace\MKL25Z128xxx4_Project\CMSIS" -O0 -fno-common -g3 -Wall -c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -mcpu=cortex-m0plus -mthumb -D__REDLIB__ -specs=redlib.specs -MMD -MP -MF"source/main.d" -MT"source/main.o" -MT"source/main.d" -o "source/main.o" "../source/main.c"

Finished building: ../source/board.c

Finished building: ../startup/startup_mkl25z4.c

Finished building: ../source/mtb.c

Finished building: ../source/i2c1.c

Finished building: ../source/clock_config.c

Finished building: ../source/MKL25Z128xxx4_Project.c

Finished building: ../source/common.c

make: stat: CMSIS/system_MKL25Z4.o: Bad file number

Finished building: ../source/main.c

Building file: ../source/pin_mux.c

Building file: ../source/uart.c

Building file: ../CMSIS/system_MKL25Z4.c

Invoking: MCU C Compiler

arm-none-eabi-gcc -DCR_INTEGER_PRINTF -DSDK_DEBUGCONSOLE=0 -D__MCUXPRESSO -D__USE_CMSIS -DDEBUG -DFSL_RTOS_BM -DSDK_OS_BAREMETAL -DCPU_MKL25Z128VFM4_cm0plus -DCPU_MKL25Z128VFM4 -D__REDLIB__ -I"C:\Users\r80133\Documents\MCUXpressoIDE_10.0.0_344\workspace\MKL25Z128xxx4_Project\source" -I"C:\Users\r80133\Documents\MCUXpressoIDE_10.0.0_344\workspace\MKL25Z128xxx4_Project" -I"C:\Users\r80133\Documents\MCUXpressoIDE_10.0.0_344\workspace\MKL25Z128xxx4_Project\startup" -I"C:\Users\r80133\Documents\MCUXpressoIDE_10.0.0_344\workspace\MKL25Z128xxx4_Project\CMSIS" -O0 -fno-common -g3 -Wall -c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -mcpu=cortex-m0plus -mthumb -D__REDLIB__ -specs=redlib.specs -MMD -MP -MF"source/pin_mux.d" -MT"source/pin_mux.o" -MT"source/pin_mux.d" -o "source/pin_mux.o" "../source/pin_mux.c"

Invoking: MCU C Compiler

arm-none-eabi-gcc -DCR_INTEGER_PRINTF -DSDK_DEBUGCONSOLE=0 -D__MCUXPRESSO -D__USE_CMSIS -DDEBUG -DFSL_RTOS_BM -DSDK_OS_BAREMETAL -DCPU_MKL25Z128VFM4_cm0plus -DCPU_MKL25Z128VFM4 -D__REDLIB__ -I"C:\Users\r80133\Documents\MCUXpressoIDE_10.0.0_344\workspace\MKL25Z128xxx4_Project\source" -I"C:\Users\r80133\Documents\MCUXpressoIDE_10.0.0_344\workspace\MKL25Z128xxx4_Project" -I"C:\Users\r80133\Documents\MCUXpressoIDE_10.0.0_344\workspace\MKL25Z128xxx4_Project\startup" -I"C:\Users\r80133\Documents\MCUXpressoIDE_10.0.0_344\workspace\MKL25Z128xxx4_Project\CMSIS" -O0 -fno-common -g3 -Wall -c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -mcpu=cortex-m0plus -mthumb -D__REDLIB__ -specs=redlib.specs -MMD -MP -MF"source/uart.d" -MT"source/uart.o" -MT"source/uart.d" -o "source/uart.o" "../source/uart.c"

Invoking: MCU C Compiler

arm-none-eabi-gcc -DCR_INTEGER_PRINTF -DSDK_DEBUGCONSOLE=0 -D__MCUXPRESSO -D__USE_CMSIS -DDEBUG -DFSL_RTOS_BM -DSDK_OS_BAREMETAL -DCPU_MKL25Z128VFM4_cm0plus -DCPU_MKL25Z128VFM4 -D__REDLIB__ -I"C:\Users\r80133\Documents\MCUXpressoIDE_10.0.0_344\workspace\MKL25Z128xxx4_Project\source" -I"C:\Users\r80133\Documents\MCUXpressoIDE_10.0.0_344\workspace\MKL25Z128xxx4_Project" -I"C:\Users\r80133\Documents\MCUXpressoIDE_10.0.0_344\workspace\MKL25Z128xxx4_Project\startup" -I"C:\Users\r80133\Documents\MCUXpressoIDE_10.0.0_344\workspace\MKL25Z128xxx4_Project\CMSIS" -O0 -fno-common -g3 -Wall -c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -mcpu=cortex-m0plus -mthumb -D__REDLIB__ -specs=redlib.specs -MMD -MP -MF"CMSIS/system_MKL25Z4.d" -MT"CMSIS/system_MKL25Z4.o" -MT"CMSIS/system_MKL25Z4.d" -o "CMSIS/system_MKL25Z4.o" "../CMSIS/system_MKL25Z4.c"

Finished building: ../source/pin_mux.c

Finished building: ../source/uart.c

Finished building: ../CMSIS/system_MKL25Z4.c

Building target: MKL25Z128xxx4_Project.axf

Invoking: MCU Linker

arm-none-eabi-gcc -nostdlib -Xlinker -Map="MKL25Z128xxx4_Project.map" -Xlinker --gc-sections -Xlinker -print-memory-usage -mcpu=cortex-m0plus -mthumb -T MKL25Z128xxx4_Project_Debug.ld -o "MKL25Z128xxx4_Project.axf" ./startup/startup_mkl25z4.o ./source/MKL25Z128xxx4_Project.o ./source/board.o ./source/clock_config.o ./source/common.o ./source/i2c1.o ./source/main.o ./source/mtb.o ./source/pin_mux.o ./source/uart.o ./CMSIS/system_MKL25Z4.o

Memory region Used Size Region Size %age Used

PROGRAM_FLASH: 8716 B 128 KB 6.65%

./source/common.o:(.bss.val+0x0): multiple definition of `val'

./source/MKL25Z128xxx4_Project.o:(.bss.val+0x0): first defined here

./source/main.o:(.bss.cin+0x0): multiple definition of `cin'

./source/MKL25Z128xxx4_Project.o:(.bss.cin+0x0): first defined here

./source/main.o:(.bss.adr+0x0): multiple definition of `adr'

./source/MKL25Z128xxx4_Project.o:(.bss.adr+0x0): first defined here

./source/main.o:(.bss.reg+0x0): multiple definition of `reg'

./source/MKL25Z128xxx4_Project.o:(.bss.reg+0x0): first defined here

./source/main.o:(.bss.i2cerr+0x0): multiple definition of `i2cerr'

./source/MKL25Z128xxx4_Project.o:(.bss.i2cerr+0x0): first defined here

./source/main.o:(.bss.val+0x0): multiple definition of `val'

./source/MKL25Z128xxx4_Project.o:(.bss.val+0x0): first defined here

./source/main.o:(.bss.fndnb+0x0): multiple definition of `fndnb'

./source/MKL25Z128xxx4_Project.o:(.bss.fndnb+0x0): first defined here

./source/main.o:(.bss.fndsa+0x0): multiple definition of `fndsa'

./source/MKL25Z128xxx4_Project.o:(.bss.fndsa+0x0): first defined here

./source/main.o:(.bss.slaves+0x0): multiple definition of `slaves'

./source/MKL25Z128xxx4_Project.o:(.bss.slaves+0x0): first defined here

./source/main.o:(.bss.time+0x0): multiple definition of `time'

./source/MKL25Z128xxx4_Project.o:(.bss.time+0x0): first defined here

./source/main.o: In function `main':

main.c:(.text.main+0x0): multiple definition of `main'

./source/MKL25Z128xxx4_Project.o:MKL25Z128xxx4_Project.c:(.text.main+0x0): first defined here

./source/main.o: In function `Generic_I2C_Read':

main.c:(.text.Generic_I2C_Read+0x0): multiple definition of `Generic_I2C_Read'

./source/MKL25Z128xxx4_Project.o:MKL25Z128xxx4_Project.c:(.text.Generic_I2C_Read+0x0): first defined here

./source/main.o: In function `Generic_I2C_Write':

main.c:(.text.Generic_I2C_Write+0x0): multiple definition of `Generic_I2C_Write'

./source/MKL25Z128xxx4_Project.o:MKL25Z128xxx4_Project.c:(.text.Generic_I2C_Write+0x0): first defined here

./source/main.o: In function `Generic_I2C_FindSlaves':

main.c:(.text.Generic_I2C_FindSlaves+0x0): multiple definition of `Generic_I2C_FindSlaves'

./source/MKL25Z128xxx4_Project.o:MKL25Z128xxx4_Project.c:(.text.Generic_I2C_FindSlaves+0x0): first defined here

./source/main.o: In function `Generic_I2C_SetAdr':

main.c:(.text.Generic_I2C_SetAdr+0x0): multiple definition of `Generic_I2C_SetAdr'

./source/MKL25Z128xxx4_Project.o:MKL25Z128xxx4_Project.c:(.text.Generic_I2C_SetAdr+0x0): first defined here

collect2.exe: error: ld returned 1 exit status

SRAM: 2368 B 16 KB 14.45%

make: *** [MKL25Z128xxx4_Project.axf] Error 1

15:28:51 Build Finished (took 2s.30ms)

0 Kudos

2,620 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi Michael,

You have a main.c in your project, you also have a MKL25Z128xxx4_Project.c. I guess they have same functions. So maybe you should merge two file and recompile.

 

Pan Jing

0 Kudos

2,620 Views
BlackNight
NXP Employee
NXP Employee

Hi Michael,

can you share your project? The error is that you have functions defined/implemented twice.

I think you are including a .c file instead a header file.

Search for all

#include

and check if they are including a header file and not a .c file?

Erich

0 Kudos