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

Mbed framework multiple definition on FRDM-KL46Z #641

Closed
raymore opened this issue Apr 30, 2016 · 13 comments
Closed

Mbed framework multiple definition on FRDM-KL46Z #641

raymore opened this issue Apr 30, 2016 · 13 comments
Assignees
Milestone

Comments

@raymore
Copy link

raymore commented Apr 30, 2016

Configuration

Operating system:
Debian 8

PlatformIO Version (platformio --version):
Platformio IDE 1.2.0, CLI 2.9.0

Description of problem

At a certain point in the development of my project all sources build, but the linkage fails with multiple definitions of : `__gnu_cxx::__verbose_terminate_handler()'.
The culprits are : frdm_kl46z/libFrameworkMbed.a(retarget.o) and arm-none-eabi/lib/armv6-m/libstdc++_s.a(vterminate.o):vterminate.cc

This seems to happen when the project gets to a certain size or number of files, as I have built and run this project for debugging for many iterations until this happened. Rolling back the recent changes to the code does not undo the outcome.

Steps to Reproduce

Actual Results

.pioenvs/frdm_kl46z/libFrameworkMbed.a(retarget.o): In function __gnu_cxx::__verbose_terminate_handler()': retarget.cpp:(.text._ZN9__gnu_cxx27__verbose_terminate_handlerEv+0x0): multiple definition of__gnu_cxx::__verbose_terminate_handler()'
/home/ray/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/4.8.4/../../../../arm-none-eabi/lib/armv6-m/libstdc++_s.a(vtermina
te.o):vterminate.cc:(.text._ZN9__gnu_cxx27__verbose_terminate_handlerEv+0x0): first defined here

Expected Results

If problems with PlatformIO Build System:

The content of platformio.ini:

[env:frdm_kl46z]
platform = freescalekinetis
framework = mbed
board = frdm_kl46z
build_flags = -std=c++11

Source file to reproduce issue:

Insert here...

Additional info

@valeros
Copy link
Member

valeros commented May 3, 2016

Hi @raymore !
Could you provide an example to reproduce this issue, please?

@raymore
Copy link
Author

raymore commented May 3, 2016

Hi,

Nice to hear from you. As mention in the report it wasn't until I had
been developing for some time that the issue surfaced. I now have a
project of over 150K of source files. I'll see if I can cut the code
down to a managable size to upload that still demonstrates the issue.

It seems very similar to the STM32 issue, i.e. reports the same message.
Is it your policy to only fix issues for the reported platform or do you
consider a likelyhood of an issue similar to mine on a FRDM-KL46Z being
affected by duplicates as well (if it involves the same libraries)?

I'll work in a smaller example and let you know.

On 03/05/16 16:11, Valerii Koval wrote:

Hi @raymore https://github.com/raymore !
Could you provide an example to reproduce this issue, please?


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#641 (comment)

@raymore
Copy link
Author

raymore commented May 3, 2016

Hi,

I have savagely cut most of the code that does not impact the issue and
have discovered that the culprit is a pure virtual function in
StateMachine.h. Removing the function and it compiles OK. Restoring it
and the issue returns.

I am at a loss to provide an insight into why I get this linkage failure:
.pioenvs/frdm_kl46z/libFrameworkMbed.a(retarget.o): In function __gnu_cxx::__verbose_terminate_handler()': retarget.cpp:(.text._ZN9__gnu_cxx27__verbose_terminate_handlerEv+0x0): multiple definition of__gnu_cxx::__verbose_terminate_handler()'
/home/ray/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/4.8.4/../../../../arm-none-eabi/lib/armv6-m/libstdc++_s.a(vtermina
te.o):vterminate.cc:(.text._ZN9__gnu_cxx27__verbose_terminate_handlerEv+0x0): first defined here
collect2: error: ld returned 1 exit status
scons: *** [.pioenvs/frdm_kl46z/firmware.elf] Error 1

Please find the code attached.

Regards

On 03/05/16 16:11, Valerii Koval wrote:

Hi @raymore https://github.com/raymore !
Could you provide an example to reproduce this issue, please?


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#641 (comment)

@valeros
Copy link
Member

valeros commented May 4, 2016

Hi @raymore !
Sorry, but I can't find any attached file. Could you share your project as zip file somewhere?

@raymore
Copy link
Author

raymore commented May 4, 2016

Hi,
I'll try again as I do not have share presence on the web.

I can see that I have attached the zip file correctly, so let me know if
you still have difficulty accessing it.

Regards

On 04/05/16 15:34, Valerii Koval wrote:

Hi @raymore https://github.com/raymore !
Sorry, but I can't find any attached file. Could you share your
project as zip file somewhere?


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#641 (comment)

@valeros
Copy link
Member

valeros commented May 4, 2016

Please send me your project directly to [email protected]
Thanks!

@valeros
Copy link
Member

valeros commented May 6, 2016

Please install PlatformIO from the special branch:
pip install https://github.com/platformio/platformio/archive/feature/mbed-build-error-issue-641.zip
Does it work well with your project?
Thanks!

@raymore
Copy link
Author

raymore commented May 7, 2016

Hi,
I have upgraded as per your email. I ran platformio in atom and the
result still raised the issue, so I suspect that the platformio/atom
build is using some of the old system. I then ran 'pio run' on my
original project (non cut down) and it built OK.

I may have to re-install atom.

As a developer, I am curious about the solution. Can you give some
details regarding the fix?

Regards

On 06/05/16 23:36, Valerii Koval wrote:

Please install PlatformIO from the special branch:
|pip install
https://github.com/platformio/platformio/archive/feature/mbed-build-error-issue-641.zip|
Does it work well with your project?
Thanks!


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#641 (comment)

@dmytrokyrychuk
Copy link

@raymore
Did you run pip install https://github.com/platformio/platformio/archive/feature/mbed-build-error-issue-641.zip from inside of the IDE terminal?

@raymore
Copy link
Author

raymore commented May 7, 2016

Hi,
I have installed the suggested zip file from the command line and the
project compiles and links as it should. I have just installed from the
terminal inside atom but the same error still exists.

The command line: pio run, still works.

Regards

On 07/05/16 19:40, Dmytro Kyrychuk wrote:

@raymore https://github.com/raymore
Did you run |pip install
https://github.com/platformio/platformio/archive/feature/mbed-build-error-issue-641.zip|
from inside of the IDE terminal?


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#641 (comment)

@ivankravets
Copy link
Member

@raymore give me please an output of pio --version command. Please run it in PlatformIO IDE Terminal.

@raymore
Copy link
Author

raymore commented May 8, 2016

Hi,
The pio --version (in the atom IDE terminal) is: PlatformIO, version
2.9.2.dev0

I have just executed: pio run (in the atom IDE terminal) and the build
now completes, so the install in the terminal required a reboot.

But if I execute the build from the IDE panel button it fails!!!

I have attached the output of the build.

Regards

On 08/05/16 01:48, Ivan Kravets wrote:

@raymore https://github.com/raymore give me please an output of |pio
--version| command. Please run it in PlatformIO IDE Terminal.


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#641 (comment)

[Sun May 8 08:41:59 2016] Processing frdm_kl46z (platform: freescalekinetis, board: frdm_kl46z, framework: mbed, build_flags: -std=c++11)

arm-none-eabi-g++ -o .pioenvs/frdm_kl46z/src/main.o -c -std=gnu++98 -fno-rtti -std=c++11 -fdata-sections -ffunction-sections -Wno-unused-parameter -mcp
u=cortex-m0plus -fno-exceptions -Wextra -fno-delete-null-pointer-checks -fmessage-length=0 -mthumb -Wno-missing-field-initializers -c -fno-builtin -O2
-fomit-frame-pointer -Wall -MMD -DTARGET_FF_ARDUINO -DTOOLCHAIN_GCC_ARM -DTARGET_KLXX -DTARGET_CORTEX_M -DTARGET_LIKE_MBED -DTARGET_M0P -DTARGET_Freesc
ale -DTOOLCHAIN_GCC -D__MBED__=1 -D__CORTEX_M0PLUS -DMBED_BUILD_TIMESTAMP=1459422030.97 -DTARGET_KL46Z -DTARGET_LIKE_CORTEX_M0 -DARM_MATH_CM0PLUS -DPLA
TFORMIO=020900 -I.pioenvs/frdm_kl46z/FrameworkMbedInc248832578 -I.pioenvs/frdm_kl46z/FrameworkMbedInc-213564679 -I.pioenvs/frdm_kl46z/FrameworkMbedInc-
250686161 -I.pioenvs/frdm_kl46z/FrameworkMbedInc-584841671 -I.pioenvs/frdm_kl46z/FrameworkMbedInc-542615144 -I.pioenvs/frdm_kl46z/FrameworkMbedInc-1840
941679 -I.pioenvs/frdm_kl46z/FrameworkMbedInc709138787 -I.pioenvs/frdm_kl46z/FrameworkMbedInc1550639565 -I.pioenvs/frdm_kl46z/Util -I.pioenvs/frdm_kl46
941679 -I.pioenvs/frdm_kl46z/FrameworkMbedInc709138787 -I.pioenvs/frdm_kl46z/FrameworkMbedInc1550639565 -I.pioenvs/frdm_kl46z/Util -I.pioenvs/frdm_kl46
z/CommsManager src/main.cpp
arm-none-eabi-ar rcs .pioenvs/frdm_kl46z/libFrameworkMbed.a /home/ray/.platformio/packages/framework-mbed/variant/KL46Z/mbed/TARGET_KL46Z/TOOLCHAIN_GCC
ARM/cmsis_nvic.o /home/ray/.platformio/packages/framework-mbed/variant/KL46Z/mbed/TARGET_KL46Z/TOOLCHAIN_GCC_ARM/mbed_overrides.o /home/ray/.platformi
o/packages/framework-mbed/variant/KL46Z/mbed/TARGET_KL46Z/TOOLCHAIN_GCC_ARM/retarget.o /home/ray/.platformio/packages/framework-mbed/variant/KL46Z/mbed
/TARGET_KL46Z/TOOLCHAIN_GCC_ARM/startup_MKL46Z4.o /home/ray/.platformio/packages/framework-mbed/variant/KL46Z/mbed/TARGET_KL46Z/TOOLCHAIN_GCC_ARM/board
.o /home/ray/.platformio/packages/framework-mbed/variant/KL46Z/mbed/TARGET_KL46Z/TOOLCHAIN_GCC_ARM/system_MKL46Z4.o
arm-none-eabi-ranlib .pioenvs/frdm_kl46z/libFrameworkMbed.a
arm-none-eabi-g++ -o .pioenvs/frdm_kl46z/Util/Util.o -c -std=gnu++98 -fno-rtti -std=c++11 -fdata-sections -ffunction-sections -Wno-unused-parameter -mc
pu=cortex-m0plus -fno-exceptions -Wextra -fno-delete-null-pointer-checks -fmessage-length=0 -mthumb -Wno-missing-field-initializers -c -fno-builtin -O2
-fomit-frame-pointer -Wall -MMD -DTARGET_FF_ARDUINO -DTOOLCHAIN_GCC_ARM -DTARGET_KLXX -DTARGET_CORTEX_M -DTARGET_LIKE_MBED -DTARGET_M0P -DTARGET_Frees
cale -DTOOLCHAIN_GCC -D__MBED
_=1 -D__CORTEX_M0PLUS -DMBED_BUILD_TIMESTAMP=1459422030.97 -DTARGET_KL46Z -DTARGET_LIKE_CORTEX_M0 -DARM_MATH_CM0PLUS -I.p
ioenvs/frdm_kl46z/FrameworkMbedInc248832578 -I.pioenvs/frdm_kl46z/FrameworkMbedInc-213564679 -I.pioenvs/frdm_kl46z/FrameworkMbedInc-250686161 -I.pioenv
s/frdm_kl46z/FrameworkMbedInc-584841671 -I.pioenvs/frdm_kl46z/FrameworkMbedInc-542615144 -I.pioenvs/frdm_kl46z/FrameworkMbedInc-1840941679 -I.pioenvs/f
rdm_kl46z/FrameworkMbedInc709138787 -I.pioenvs/frdm_kl46z/FrameworkMbedInc1550639565 -I.pioenvs/frdm_kl46z/Util -I.pioenvs/frdm_kl46z/CommsManager .pio
envs/frdm_kl46z/Util/Util.cpp
arm-none-eabi-g++ -o .pioenvs/frdm_kl46z/CommsManager/CommsManager.o -c -std=gnu++98 -fno-rtti -std=c++11 -fdata-sections -ffunction-sections -Wno-unus
ed-parameter -mcpu=cortex-m0plus -fno-exceptions -Wextra -fno-delete-null-pointer-checks -fmessage-length=0 -mthumb -Wno-missing-field-initializers -c
-fno-builtin -O2 -fomit-frame-pointer -Wall -MMD -DTARGET_FF_ARDUINO -DTOOLCHAIN_GCC_ARM -DTARGET_KLXX -DTARGET_CORTEX_M -DTARGET_LIKE_MBED -DTARGET_M0
P -DTARGET_Freescale -DTOOLCHAIN_GCC -D__MBED__=1 -D__CORTEX_M0PLUS -DMBED_BUILD_TIMESTAMP=1459422030.97 -DTARGET_KL46Z -DTARGET_LIKE_CORTEX_M0 -DARM_M
ATH_CM0PLUS -I.pioenvs/frdm_kl46z/FrameworkMbedInc248832578 -I.pioenvs/frdm_kl46z/FrameworkMbedInc-213564679 -I.pioenvs/frdm_kl46z/FrameworkMbedInc-250
686161 -I.pioenvs/frdm_kl46z/FrameworkMbedInc-584841671 -I.pioenvs/frdm_kl46z/FrameworkMbedInc-542615144 -I.pioenvs/frdm_kl46z/FrameworkMbedInc-1840941
679 -I.pioenvs/frdm_kl46z/FrameworkMbedInc709138787 -I.pioenvs/frdm_kl46z/FrameworkMbedInc1550639565 -I.pioenvs/frdm_kl46z/Util -I.pioenvs/frdm_kl46z/C
ommsManager .pioenvs/frdm_kl46z/CommsManager/CommsManager.cpp
arm-none-eabi-ar rcs .pioenvs/frdm_kl46z/libUtil.a .pioenvs/frdm_kl46z/Util/Util.o
arm-none-eabi-g++ -o .pioenvs/frdm_kl46z/CommsManager/StateMachine.o -c -std=gnu++98 -fno-rtti -std=c++11 -fdata-sections -ffunction-sections -Wno-unus
ed-parameter -mcpu=cortex-m0plus -fno-exceptions -Wextra -fno-delete-null-pointer-checks -fmessage-length=0 -mthumb -Wno-missing-field-initializers -c
-fno-builtin -O2 -fomit-frame-pointer -Wall -MMD -DTARGET_FF_ARDUINO -DTOOLCHAIN_GCC_ARM -DTARGET_KLXX -DTARGET_CORTEX_M -DTARGET_LIKE_MBED -DTARGET_M0
P -DTARGET_Freescale -DTOOLCHAIN_GCC -D__MBED__=1 -D__CORTEX_M0PLUS -DMBED_BUILD_TIMESTAMP=1459422030.97 -DTARGET_KL46Z -DTARGET_LIKE_CORTEX_M0 -DARM_M
ATH_CM0PLUS -I.pioenvs/frdm_kl46z/FrameworkMbedInc248832578 -I.pioenvs/frdm_kl46z/FrameworkMbedInc-213564679 -I.pioenvs/frdm_kl46z/FrameworkMbedInc-250
686161 -I.pioenvs/frdm_kl46z/FrameworkMbedInc-584841671 -I.pioenvs/frdm_kl46z/FrameworkMbedInc-542615144 -I.pioenvs/frdm_kl46z/FrameworkMbedInc-1840941
679 -I.pioenvs/frdm_kl46z/FrameworkMbedInc709138787 -I.pioenvs/frdm_kl46z/FrameworkMbedInc1550639565 -I.pioenvs/frdm_kl46z/Util -I.pioenvs/frdm_kl46z/C
ommsManager .pioenvs/frdm_kl46z/CommsManager/StateMachine.cpp
arm-none-eabi-ranlib .pioenvs/frdm_kl46z/libUtil.a
arm-none-eabi-ar rcs .pioenvs/frdm_kl46z/libCommsManager.a .pioenvs/frdm_kl46z/CommsManager/CommsManager.o .pioenvs/frdm_kl46z/CommsManager/StateMachin
e.o
arm-none-eabi-ranlib .pioenvs/frdm_kl46z/libCommsManager.a
arm-none-eabi-g++ -o .pioenvs/frdm_kl46z/firmware.elf -Wl,--gc-sections -Wl,--wrap,main -mcpu=cortex-m0plus -mthumb --specs=nano.specs -Wl,-T"/home/ray
/.platformio/packages/framework-mbed/variant/KL46Z/mbed/TARGET_KL46Z/TOOLCHAIN_GCC_ARM/MKL46Z4.ld" .pioenvs/frdm_kl46z/src/main.o -L/home/ray/.platform
io/packages/ldscripts -L/home/ray/.platformio/packages/framework-mbed/variant/KL46Z/mbed/TARGET_KL46Z/TOOLCHAIN_GCC_ARM -L.pioenvs/frdm_kl46z -Wl,--sta
rt-group -lstdc++ -lsupc++ -lnosys -lmbed -lc -lgcc .pioenvs/frdm_kl46z/libFrameworkMbed.a -lc -lgcc -lm .pioenvs/frdm_kl46z/libUtil.a .pioenvs/frdm_kl
46z/libCommsManager.a -Wl,--end-group
.pioenvs/frdm_kl46z/libFrameworkMbed.a(retarget.o): In function __gnu_cxx::__verbose_terminate_handler()': retarget.cpp:(.text._ZN9__gnu_cxx27__verbose_terminate_handlerEv+0x0): multiple definition of__gnu_cxx::__verbose_terminate_handler()'
/home/ray/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/4.8.4/../../../../arm-none-eabi/lib/armv6-m/libstdc++_s.a(vtermina
te.o):vterminate.cc:(.text._ZN9__gnu_cxx27__verbose_terminate_handlerEv+0x0): first defined here
collect2: error: ld returned 1 exit status
scons: *** [.pioenvs/frdm_kl46z/firmware.elf] Error 1
========================= [ ERROR ] Took 0.46 seconds =========================

@valeros valeros modified the milestone: 2.9.2 Jun 2, 2016
@valeros
Copy link
Member

valeros commented Jun 2, 2016

Hi @raymore !
Please re-test your project with the latest PlatformIO from the develop branch.
Thanks!

ivankravets added a commit that referenced this issue Jun 2, 2016
* develop:
  Version bump to 2.9.2 (issues #641, #645, #648, #652, #664, #665, #666, #671, #674)
  Fix issue with ARM mbed framework when abstract class breaks compile for LPC1768 // Resolve #666
  Fix issue with ARM mbed framework and multiple definition errors   on FRDM-KL46Z board // Resolve #641
  List embedded boards in docs
  Fix multiple definition in mbed framework when using abstract class // Issue #641, #666
  Add "stlink" as the default uploader for STM32 Discovery boards // Resolve #665
  Implement grep serial ports for Windows
  Remove unused imports
  Minor improvements
  Fix PyLint's "misplaced-comparison-constant"
  Use $PROGNAME instead static name when looking for the firmware
  Update title of the article
  Add new articles
  Link Community Forums FAQ with Docs FAQ
  Grep for "/dev/cu.*" on OS X
  Skip grep search for serial ports on Windows machines
  Improve firmware uploading to Arduino Leonardo based boards
  Add MinGW to the PATH

# Conflicts:
#	docs/index.rst
#	docs/platforms/creating_board.rst
#	docs/projectconf.rst
#	docs/userguide/platforms/cmd_install.rst
#	platformio/__init__.py
#	platformio/builder/scripts/atmelavr.py
#	platformio/builder/scripts/atmelsam.py
#	platformio/builder/scripts/frameworks/mbed.py
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