Compiling issues: Multiple definition of __dso_handle, _init,_fini in comp.c in KSDK and KDS

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

Compiling issues: Multiple definition of __dso_handle, _init,_fini in comp.c in KSDK and KDS

4,361 Views
ironsean
Contributor V

Hello, I'm experiencing some issues with compilation with the new KDS 2.0.0 and KSDK 1.1.0. I'm attempting to move an old project over from Codewarrior 10.6. I followed this document (How To: Create a New MQX RTOS for KSDK Project in KDS) to make a new project in the KDS, and import the KASK MQX Lib, MQX, and MQX Stdlib, and then I extrapolated from those steps to include the RTCS and MFS libraries.

Next I've been including some of my source files to start trying to get the skeleton of our application compiling again (including discovering what's changes in MFS or RTCS and making those changes). However, I'm running into issues that are either related to the compiler/linker settings, or the library include paths, which are a bit over my head:

I'm getting "multiple definition of" errors for a few functions in comp.c in the mqx_frdmk64f  -> MQX_Generic -> include folder. This error happens when I compile my custom project, not the MQX_frdmk64f library project.

I'm only including these headers in my project for now:

#include <mqx.h>

#include <lwmsgq.h>

#include <mfs.h>

#include <stdio.h>

#include <ipcfg.h>

And I'm unclear where it's including comp.c that is casing it to recompile. The full console output from the build is here:

19:02:48 **** Incremental Build of configuration Debug for project ELMU_KDS_K64 ****

make all

'Building file: ../Sources/config.c'

'Invoking: Cross ARM C Compiler'

arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -O0 -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections  -g3 -D"CPU_MK64FN1M0VMD12=1" -D"FSL_RTOS_MQX=1" -D"_AEABI_LC_CTYPE=C" -D"__STRICT_ANSI__=1" -D"_DEBUG=1" -DMQX_USE_IO_OLD=0 -DPLATFORM_SDK_ENABLED=1 -I"../Sources" -I"D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/platform/drivers/src/enet" -I"D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/tcpip/rtcs/lib/frdmk64f.kds/debug/rtcs" -I"D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/filesystem/mfs/lib/frdmk64f.kds/debug/mfs" -I"../Sources/Board" -I"../Sources/BSP_files" -I"../Sources/Config_files" -I"../Sources/Config_files/Common" -I"../Sources/Utilities" -I"../Project_Settings/Startup_Code" -I"../SDK/platform/CMSIS/Include" -I"../SDK/platform/CMSIS/Include/device" -I"../SDK/platform/CMSIS/Include/device/MK64F12" -I"D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/platform/utilities/inc" -I"D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/platform/utilities/src" -I"D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/rtos/mqx/mqx/source/nio/drivers/nio_serial" -I"D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/rtos/mqx/mqx/source/string" -I"D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/rtos/mqx/config/common" -I"D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/rtos/mqx/mqx/source/psp/cortex_m/core/M4" -I"D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/rtos/mqx/mqx_stdlib/source/include" -I"D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/rtos/mqx/mqx/source/kernel" -I"D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/rtos/mqx/mqx/source/nio/src" -I"D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/rtos/mqx/mqx/source/bsp" -I"D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/rtos/mqx/mqx/source/nio/drivers/nio_serial/src" -I"D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/rtos/mqx/mqx/source/nio" -I"D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/rtos/mqx/mqx_stdlib/source/strings" -I"D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/rtos/mqx/mqx/source/psp/cortex_m" -I"D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/rtos/mqx/mqx/source/nio/drivers/nio_tty/src" -I"D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/rtos/mqx/mqx/source/nio/drivers/nio_dummy/src" -I"D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/rtos/mqx/mqx/source/psp/cortex_m/cpu" -I"D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/rtos/mqx/mqx/source/nio/fs" -I"D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/rtos/mqx/mqx_stdlib/source/stdio" -I"D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/rtos/mqx/mqx/source/psp/cortex_m/compiler/gcc_arm" -I"D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/rtos/mqx/mqx/source/nio/drivers/nio_tty" -I"D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/rtos/mqx/mqx/source/nio/drivers/nio_dummy" -I"D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/rtos/mqx/mqx/source/include" -I"D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/platform/osa/inc" -I"D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/platform/drivers/inc" -I"D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/platform/system/inc" -I"D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/platform/hal/inc" -I"D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/rtos/mqx/lib/frdmk64f.kds/debug/mqx" -I"D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/rtos/mqx/mqx/source/bsp" -I"D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/rtos/mqx/mqx/source/include" -I"D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/rtos/mqx/lib/frdmk64f.kds/debug/config" -std=c99 -MMD -MP -MF"Sources/config.d" -MT"Sources/config.o" -c -o "Sources/config.o" "../Sources/config.c"

In file included from ../Sources/config.c:1:0:

../Sources/config.h:238:2: warning: initialization makes integer from pointer without a cast [enabled by default]

  {NULL, NULL, NULL, NULL, NULL}

  ^

../Sources/config.h:238:2: warning: (near initialization for 'config_filter[19].name[0]') [enabled by default]

../Sources/config.h:238:2: warning: initialization makes integer from pointer without a cast [enabled by default]

../Sources/config.h:238:2: warning: (near initialization for 'config_filter[19].name[1]') [enabled by default]

../Sources/config.h:238:2: warning: initialization makes integer from pointer without a cast [enabled by default]

../Sources/config.h:238:2: warning: (near initialization for 'config_filter[19].name[2]') [enabled by default]

../Sources/config.h:238:2: warning: initialization makes integer from pointer without a cast [enabled by default]

../Sources/config.h:238:2: warning: (near initialization for 'config_filter[19].name[3]') [enabled by default]

../Sources/config.h:238:2: warning: initialization makes integer from pointer without a cast [enabled by default]

../Sources/config.h:238:2: warning: (near initialization for 'config_filter[19].name[4]') [enabled by default]

'Finished building: ../Sources/config.c'

' '

'Building file: ../Sources/main_task.c'

'Invoking: Cross ARM C Compiler'

arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -O0 -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections  -g3 -D"CPU_MK64FN1M0VMD12=1" -D"FSL_RTOS_MQX=1" -D"_AEABI_LC_CTYPE=C" -D"__STRICT_ANSI__=1" -D"_DEBUG=1" -DMQX_USE_IO_OLD=0 -DPLATFORM_SDK_ENABLED=1 -I"../Sources" -I"D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/platform/drivers/src/enet" -I"D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/tcpip/rtcs/lib/frdmk64f.kds/debug/rtcs" -I"D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/filesystem/mfs/lib/frdmk64f.kds/debug/mfs" -I"../Sources/Board" -I"../Sources/BSP_files" -I"../Sources/Config_files" -I"../Sources/Config_files/Common" -I"../Sources/Utilities" -I"../Project_Settings/Startup_Code" -I"../SDK/platform/CMSIS/Include" -I"../SDK/platform/CMSIS/Include/device" -I"../SDK/platform/CMSIS/Include/device/MK64F12" -I"D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/platform/utilities/inc" -I"D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/platform/utilities/src" -I"D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/rtos/mqx/mqx/source/nio/drivers/nio_serial" -I"D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/rtos/mqx/mqx/source/string" -I"D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/rtos/mqx/config/common" -I"D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/rtos/mqx/mqx/source/psp/cortex_m/core/M4" -I"D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/rtos/mqx/mqx_stdlib/source/include" -I"D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/rtos/mqx/mqx/source/kernel" -I"D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/rtos/mqx/mqx/source/nio/src" -I"D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/rtos/mqx/mqx/source/bsp" -I"D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/rtos/mqx/mqx/source/nio/drivers/nio_serial/src" -I"D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/rtos/mqx/mqx/source/nio" -I"D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/rtos/mqx/mqx_stdlib/source/strings" -I"D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/rtos/mqx/mqx/source/psp/cortex_m" -I"D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/rtos/mqx/mqx/source/nio/drivers/nio_tty/src" -I"D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/rtos/mqx/mqx/source/nio/drivers/nio_dummy/src" -I"D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/rtos/mqx/mqx/source/psp/cortex_m/cpu" -I"D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/rtos/mqx/mqx/source/nio/fs" -I"D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/rtos/mqx/mqx_stdlib/source/stdio" -I"D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/rtos/mqx/mqx/source/psp/cortex_m/compiler/gcc_arm" -I"D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/rtos/mqx/mqx/source/nio/drivers/nio_tty" -I"D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/rtos/mqx/mqx/source/nio/drivers/nio_dummy" -I"D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/rtos/mqx/mqx/source/include" -I"D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/platform/osa/inc" -I"D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/platform/drivers/inc" -I"D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/platform/system/inc" -I"D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/platform/hal/inc" -I"D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/rtos/mqx/lib/frdmk64f.kds/debug/mqx" -I"D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/rtos/mqx/mqx/source/bsp" -I"D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/rtos/mqx/mqx/source/include" -I"D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/rtos/mqx/lib/frdmk64f.kds/debug/config" -std=c99 -MMD -MP -MF"Sources/main_task.d" -MT"Sources/main_task.o" -c -o "Sources/main_task.o" "../Sources/main_task.c"

In file included from ../Sources/main_task.c:59:0:

../Sources/config.h:238:2: warning: initialization makes integer from pointer without a cast [enabled by default]

  {NULL, NULL, NULL, NULL, NULL}

  ^

../Sources/config.h:238:2: warning: (near initialization for 'config_filter[19].name[0]') [enabled by default]

../Sources/config.h:238:2: warning: initialization makes integer from pointer without a cast [enabled by default]

../Sources/config.h:238:2: warning: (near initialization for 'config_filter[19].name[1]') [enabled by default]

../Sources/config.h:238:2: warning: initialization makes integer from pointer without a cast [enabled by default]

../Sources/config.h:238:2: warning: (near initialization for 'config_filter[19].name[2]') [enabled by default]

../Sources/config.h:238:2: warning: initialization makes integer from pointer without a cast [enabled by default]

../Sources/config.h:238:2: warning: (near initialization for 'config_filter[19].name[3]') [enabled by default]

../Sources/config.h:238:2: warning: initialization makes integer from pointer without a cast [enabled by default]

../Sources/config.h:238:2: warning: (near initialization for 'config_filter[19].name[4]') [enabled by default]

../Sources/main_task.c: In function 'main_task':

../Sources/main_task.c:665:3: warning: implicit declaration of function 'install_sd' [-Wimplicit-function-declaration]

   file_error = install_sd();

   ^

../Sources/main_task.c:666:3: warning: implicit declaration of function 'monitor_sd' [-Wimplicit-function-declaration]

   file_error = monitor_sd();

   ^

'Finished building: ../Sources/main_task.c'

' '

'Building target: ELMU_KDS_K64.elf'

'Invoking: Cross ARM C++ Linker'

arm-none-eabi-g++ -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -O0 -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections  -g3 -T "MK64FN1M0xxx12_flash.ld" -Xlinker --gc-sections -L"D:/Development/13214-ELMU/trunk/ETCCode/ELMU_KDS_K64/ELMU_KDS_K64/Project_Settings/Linker_Files" -L"D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/lib/ksdk_mqx_lib/kds/K64F12/Debug" -L"D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/rtos/mqx/lib/frdmk64f.kds/debug/mqx" -L"D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/rtos/mqx/lib/frdmk64f.kds/debug/mqx_stdlib" -Wl,-Map,"ELMU_KDS_K64.map" -nanolibc -o "ELMU_KDS_K64.elf"  ./Sources/Utilities/fsl_debug_console.o  ./Sources/Board/gpio_pins.o ./Sources/Board/hardware_init.o ./Sources/Board/pin_mux.o  ./Sources/BSP_files/init_bsp.o ./Sources/BSP_files/mqx_main.o  ./Sources/config.o ./Sources/main_task.o  ./Project_Settings/Startup_Code/startup.o ./Project_Settings/Startup_Code/startup_MK64F12.o ./Project_Settings/Startup_Code/system_MK64F12.o  D:/Development/13214-ELMU/trunk/Freescale/KSDK_1.1.0/lib/ksdk_mqx_lib/kds/K64F12/Debug/libksdk_platform_mqx.a D:/Development/13214-ELMU/trunk/Freescale/KSDK_1.1.0/filesystem/mfs/lib/frdmk64f.kds/debug/mfs/lib_mfs.a D:/Development/13214-ELMU/trunk/Freescale/KSDK_1.1.0/tcpip/rtcs/lib/frdmk64f.kds/debug/rtcs/lib_rtcs.a D:/Development/13214-ELMU/trunk/Freescale/KSDK_1.1.0/rtos/mqx/lib/frdmk64f.kds/debug/mqx/lib_mqx.a D:/Development/13214-ELMU/trunk/Freescale/KSDK_1.1.0/rtos/mqx/lib/frdmk64f.kds/debug/mqx_stdlib/lib_mqx_stdlib.a -lksdk_platform_mqx -l_mqx -l_mqx_stdlib

D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/rtos/mqx/lib/frdmk64f.kds/debug/mqx\lib_mqx.a(comp.o): In function `_exit':

D:/Development/13214-ELMU/trunk/Freescale/KSDK_1.1.0/rtos/mqx/mqx/source/psp/cortex_m/compiler/gcc_arm/comp.c:64: multiple definition of `__dso_handle'

d:/freescale/kds_2.0.0/toolchain/bin/../lib/gcc/arm-none-eabi/4.8.0/m4/fp/v4-sp-d16/crtbegin.o:(.data.__dso_handle+0x0): first defined here

D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/rtos/mqx/lib/frdmk64f.kds/debug/mqx\lib_mqx.a(comp.o): In function `toolchain_startup':

D:/Development/13214-ELMU/trunk/Freescale/KSDK_1.1.0/rtos/mqx/mqx/source/psp/cortex_m/compiler/gcc_arm/comp.c:74: multiple definition of `_init'

d:/freescale/kds_2.0.0/toolchain/bin/../lib/gcc/arm-none-eabi/4.8.0/m4/fp/v4-sp-d16/crti.o:(.init+0x0): first defined here

D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/rtos/mqx/lib/frdmk64f.kds/debug/mqx\lib_mqx.a(comp.o): In function `_fini':

D:/Development/13214-ELMU/trunk/Freescale/KSDK_1.1.0/rtos/mqx/mqx/source/psp/cortex_m/compiler/gcc_arm/comp.c:84: multiple definition of `_fini'

d:/freescale/kds_2.0.0/toolchain/bin/../lib/gcc/arm-none-eabi/4.8.0/m4/fp/v4-sp-d16/crti.o:(.fini+0x0): first defined here

collect2.exe: error: ld returned 1 exit status

make: *** [ELMU_KDS_K64.elf] Error 1

19:02:50 Build Finished (took 2s.242ms)

But the important part seems to be in the linker section in the borrom area starting at line 46. The linker call is broken up here for better readability:

arm-none-eabi-g++ -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -O0 -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections  -g3 -T "MK64FN1M0xxx12_flash.ld" -Xlinker --gc-sections -L

"D:/Development/13214-ELMU/trunk/ETCCode/ELMU_KDS_K64/ELMU_KDS_K64/Project_Settings/Linker_Files" -L

"D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/lib/ksdk_mqx_lib/kds/K64F12/Debug" -L

"D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/rtos/mqx/lib/frdmk64f.kds/debug/mqx" -L

"D:\Development\13214-ELMU\trunk\Freescale\KSDK_1.1.0/rtos/mqx/lib/frdmk64f.kds/debug/mqx_stdlib"

-Wl,-Map,"ELMU_KDS_K64.map" -nanolibc -o "ELMU_KDS_K64.elf" 

./Sources/Utilities/fsl_debug_console.o 

./Sources/Board/gpio_pins.o

./Sources/Board/hardware_init.o

./Sources/Board/pin_mux.o 

./Sources/BSP_files/init_bsp.o

./Sources/BSP_files/mqx_main.o 

./Sources/config.o

./Sources/main_task.o 

./Project_Settings/Startup_Code/startup.o

./Project_Settings/Startup_Code/startup_MK64F12.o

./Project_Settings/Startup_Code/system_MK64F12.o 

D:/Development/13214-ELMU/trunk/Freescale/KSDK_1.1.0/lib/ksdk_mqx_lib/kds/K64F12/Debug/libksdk_platform_mqx.a

D:/Development/13214-ELMU/trunk/Freescale/KSDK_1.1.0/filesystem/mfs/lib/frdmk64f.kds/debug/mfs/lib_mfs.a

D:/Development/13214-ELMU/trunk/Freescale/KSDK_1.1.0/tcpip/rtcs/lib/frdmk64f.kds/debug/rtcs/lib_rtcs.a

D:/Development/13214-ELMU/trunk/Freescale/KSDK_1.1.0/rtos/mqx/lib/frdmk64f.kds/debug/mqx/lib_mqx.a

D:/Development/13214-ELMU/trunk/Freescale/KSDK_1.1.0/rtos/mqx/lib/frdmk64f.kds/debug/mqx_stdlib/lib_mqx_stdlib.a

-lksdk_platform_mqx -l_mqx -l_mqx_stdlib

Any idea why this might be?

Thanks,

Sean

0 Kudos
2 Replies

2,537 Views
ironsean
Contributor V

Answer found here: Re: Re: arm-none-eabi conflicting with mqx: multiple definitions of stdio.h and others causing compi...

I'm going to mark this as assumed answered so I don't need to tag my own posts as answers.

0 Kudos

2,537 Views
ironsean
Contributor V

Manually removing the offending path from the library includes didn't help either:

"${PROJECT_KSDK_PATH}/rtos/mqx/mqx/source/psp/cortex_m/compiler/gcc_arm"

However, that includes at compile time, and the error appears to throw during the linking phase.

0 Kudos