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

undefined reference to operator delete #33

Open
uXeBoy opened this issue Nov 25, 2019 · 6 comments
Open

undefined reference to operator delete #33

uXeBoy opened this issue Nov 25, 2019 · 6 comments

Comments

@uXeBoy
Copy link

uXeBoy commented Nov 25, 2019

Getting this error during compilation - seems to be related to missing libstdc++

...is there a possible solution??

@emard
Copy link
Member

emard commented Nov 26, 2019 via email

@gornjas
Copy link
Contributor

gornjas commented Nov 26, 2019

If you have problems with operator delete, you should also have problems with operator new. Both are implemented in hardware/fpga/f32c/cores/f32c/new.cpp.

A simple, minimal example which can reliably provoke the error could help us pinpoint the exact problem.

@uXeBoy
Copy link
Author

uXeBoy commented Nov 26, 2019

I think I see the problem now... 🤦

That new.cpp does not include C++14 style 'sized deallocation' functions:

https://en.cppreference.com/w/cpp/memory/new/operator_delete

@gornjas
Copy link
Contributor

gornjas commented Nov 26, 2019

Hmm as a person who uses or cares about C++ only when shotgun-forced, I can only comment that our new.cpp was blindly cloned many years ago from (I believe):
https://github.com/arduino/ArduinoCore-avr/blob/master/cores/arduino/new.cpp

Does your application compile with AVR arduino?

[edit]: oh, I see, we should just add delete variants which ignore the extra argument. Could you try replacing our new.cpp with the one from
https://github.com/stm32duino/Arduino_Core_STM32/blob/master/cores/arduino/new.cpp

and report whether this helps?

@uXeBoy
Copy link
Author

uXeBoy commented Nov 26, 2019

Did some research, and I ended up just adding -fno-sized-deallocation to the c++ compiler flags in platform.txt and that fixed it... maybe a better solution if the the added delete variants would just be dummies anyway?

@gornjas
Copy link
Contributor

gornjas commented Nov 26, 2019

I like your approach with patching compiler flags in platform.txt better, as there's no point in introducing more dummy functions which are equivalent to the existing ones, and just occupy space.

I'd leave it to Davor to check whether adding the proposed flag in platform.txt does any harm, as he's using fpgarduino much more frequently than I am, and if it doesn't break anything to proceed and commit the change.

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

No branches or pull requests

3 participants