Page 1 of 2
Can't link up C++ file
Posted:
Tue Mar 24, 2015 4:27 pm
by kaps90
Hi everyone,
I am an MEng final year student using the Parallella board for the my final year project. I have used the example code in C to setup the board for what I need problem being that my project revolves around incorporating a C++ PhD project onto the board so as to take advantage of the parallellism provided.
To keep things simple I only wanted to include a small .cpp file which doesn't do much, just a class holding a few variable declerations here and there with some initialising and clearing functions. The host side compiles and links up fine but when it comes to the e-gcc linker I get the error "In function 'GECell::~GECell()' ..... undefined reference to 'operator delete(void*)'". I pinned it down to the inclusion of a vector variable. Everything compiles just fine and runs if the vector variables are not included. Would anyone know why? Don't forget that the files that I am incorporating were part of a PhD project and so in terms of mistakes there shouldn't be any and besides that, as I said, the file I included doesn't do anything really and after stripping it down it really doesn't do anything literally! Functions definitions are just returns! I simply create an object of the class and do nothing with it.
Thanks in advance for any help.
Kevin
Re: Can't link up C++ file
Posted:
Tue Mar 24, 2015 6:34 pm
by piotr5
old program you say? maybe use the new Array datatype from c++11 instead of Vector?
other than that, you haven't described how the delete error is related to Vector and GECell!
can you provide some online-version of that PhD work you're making use of?
epiphany has no memory-management capable of working accross cores, it seems.
(i.e. you can't obtain memory on one core and delete same space on another.)
in general that isn't much of an issue in c++, you just aren't allowed to resize vectors from another core...
Re: Can't link up C++ file
Posted:
Tue Mar 24, 2015 8:02 pm
by cmcconnell
Is there any support for the STL? I didn't think there was; there is certainly no mention of it in the documentation.
Re: Can't link up C++ file
Posted:
Wed Mar 25, 2015 5:52 am
by cmcconnell
Re: Can't link up C++ file
Posted:
Wed Mar 25, 2015 10:50 am
by kaps90
Hi Guys,
Colin it was the e-gcc to e-g++!!! I've was stuck on this problem for quite a while I can't believe it was that. Colin I completely agree with you. The epiphany SDK reference doesn't make any clear indication of this. It simply speaks of only e-gcc and says it compiles both C and C++. As for the linker it describes it via e-ld and so once again I just never knew there was a e-g++. Likewise, it would have been nice to have some C++ examples and not only C.
Thanks Colin, you saved me a lot of trouble. I'm just hoping I don't run into the memory space issue you found :/ . And I hope the answer to your question of C++ being a viable option for the epiphany is yes. It just simplifies my project by not having worry of changing too much. Thanks again
.
Kevin
Re: Can't link up C++ file
Posted:
Wed Mar 25, 2015 1:44 pm
by cmcconnell
Re: Can't link up C++ file
Posted:
Mon Mar 30, 2015 9:34 pm
by cmcconnell
Re: Can't link up C++ file
Posted:
Mon Mar 30, 2015 9:58 pm
by aolofsson
It is possble to program in c++ but you have to severely limit the subset of c++ that you use.
As far as I recall, the OpenCL/COPRTRH SDK from BrownDeer does source to source translation (openCL-->c++) and uses the e-g++ compiler.
For most people, it is probably not worth the trouble....
Andreas
Re: Can't link up C++ file
Posted:
Tue Mar 31, 2015 4:53 pm
by cmcconnell
Re: Can't link up C++ file
Posted:
Wed Jan 27, 2016 3:29 pm
by bobblestiltskin
I wanted to use booleans and shared memory, and so try to use e-g++ instead of e-gcc on some of the epiphany examples and see...
bob@debian-parallella:~/src/dl/epiphany-examples/apps/shm_test$ e-gcc -T /opt/adapteva/esdk/bsps/current/fast.ldf src/e_shm_test.c -o bin/e_shm_test.elf -le-lib
bob@debian-parallella:~/src/dl/epiphany-examples/apps/shm_test$ rm bin/e_shm_test.elf
bob@debian-parallella:~/src/dl/epiphany-examples/apps/shm_test$ e-g++ -T /opt/adapteva/esdk/bsps/current/fast.ldf src/e_shm_test.c -o bin/e_shm_test.elf -le-lib
/opt/adapteva/esdk.2014.11/tools/e-gnu.armv7l/bin/../lib/gcc/epiphany-elf/4.8.2/../../../../epiphany-elf/bin/ld: bin/e_shm_test.elf section `.text' will not fit in region `INTERNAL_RAM'
/opt/adapteva/esdk.2014.11/tools/e-gnu.armv7l/bin/../lib/gcc/epiphany-elf/4.8.2/../../../../epiphany-elf/bin/ld: region `INTERNAL_RAM' overflowed by 19120 bytes
/tmp/ccyTAuUg.o: In function `main':
e_shm_test.c:(.text+0xf4): undefined reference to `trace_init()'
e_shm_test.c:(.text+0xf8): undefined reference to `trace_init()'
e_shm_test.c:(.text+0x10e): undefined reference to `trace_start()'
e_shm_test.c:(.text+0x112): undefined reference to `trace_start()'
e_shm_test.c:(.text+0x12e): undefined reference to `trace_write(unsigned int, unsigned int, unsigned int, unsigned int)'
e_shm_test.c:(.text+0x132): undefined reference to `trace_write(unsigned int, unsigned int, unsigned int, unsigned int)'
e_shm_test.c:(.text+0x142): undefined reference to `e_get_coreid()'
.....
e-gcc compiles fine, but I see that e-g++ fails. Is there anything in this specific example that I should be doing?
Bob