rpidmx512: undefined reference to `memcpy'?
Hey Arjan,
No stress, i’m messing around, but I am getting the weirdest thing… Well I don’t understand anyway.
I know it’s 3rd party, but I am trying some code from the project microui which is a tiny, (C but reports C++ compilable) like 1K lines of code, it’s a very basic window and widget framework. It’s very lightweight, only needs memcpy, memset, strtod & qsort. and i’ve read through all the code and can’t see any calls that raise suspicion.
I’ve had to implement strtod and qsort with some codes I found, and read them carefully and they seem all good too.
I have worked hard, and have gotten down to just this error from so many, where it can’t find memcpy when linking 😃 I’ve tried including string.h, and many other things, all day.
[/home/hip/dev/new/rpidmx512/lib-arm]
$DEFINES [-DORANGE_PI_ONE -DNDEBUG -D_TIME_STAMP_YEAR_=2020 -D_TIME_STAMP_MONTH_=8 -D_TIME_STAMP_DAY_=13]
$MAKE_FLAGS [-DCONSOLE_FB]
$BUILD_DIRS [build_h3/src build_h3/src/h3]
$TARGET [lib_h3/libarm.a ]
arm-none-eabi-ar: creating lib_h3/libarm.a
arm-none-eabi-ld: build_h3/lib/microui.o: in function `mu_init(mu_Context*)':
microui.cpp:(.text+0x144): undefined reference to `memcpy'
arm-none-eabi-ld: build_h3/lib/microui.o: in function `push_layout(mu_Context*, mu_Rect, mu_Vec2)':
microui.cpp:(.text+0x1848): undefined reference to `memcpy'
make: *** [../h3-firmware-template/Rules.mk:221: build_h3/main.elf] Error 1
and in the map file, there are only references to h3_memcpy.
I change every call to ui_memcpy() and implement that in the microui.cpp file, and it still dies here looking for memcpy?
I have a branch in my fork here https://github.com/hippyau/rpidmx512/tree/experimental-ui
Any ideas?
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 18 (18 by maintainers)
All good, thanks so much for your help @vanvught and @rewolff !!
Well… it is missing
in https://github.com/rxi/microui/blob/master/src/microui.h
See also https://github.com/rxi/microui/issues/13#issuecomment-636469115
Hi Hippy,
memcpyis defined instring.hmicroui.c does include <string.h>
So I am not sure why do you get this error.
The
h3_memcpyshould be used in low-level routines only -> lib-h3As it is all ANSI-C , then leave the extension of the files just with
*.cAnd make sure that you have
around the C prototypes.
Please be aware of the global settings:
COPS+=-nostartfiles -ffreestanding -nostdinc -nostdlibGreetings, Arjan
Some memcpy calls are generated by the compiler.
Maybe more. Best course of action would be to provide a memcpy. If you’re not calling it you can hope it doesn’t get called too often, so an implementation would only be a few lines if you don’t care about performance.