Using the native port on OS X with clang I get this error when using pthread:
/Users/noir/Desktop/RIOT/sys/posix/pthread/pthread.c:22:10: fatal error: 'malloc.h' file not found
#include <malloc.h>
^
1 error generated.
There is one in the tree at ./sys/oneway-malloc/include/malloc.h
The "real" posix malloc is defined in #include <stdlib.h>
@josephnoir is this fixed now? Can we close this issue?
No, this is not fixed.
Did you test @gebart's proposal? Are you willing to fix it :-)?
Is there a reason to use malloc.h over stdlib.h. It's my understanding that stdlib.h is more portable so it should be fine to change all #include <malloc.h> to #include <stdlib.h> or will this cause issues somewhere?
Unconditionally including stdlib.h leads to conflicts with native on Linux:
/home/lo/RIOT/sys/posix/pthread/include/pthread_threading_attr.h:34:3: error: conflicting types for ‘pthread_attr_t’
@LudwigOrtmann is that an error in either implementation or are we just not compatible with Linux?
I was able to use an if define to get around the malloc.h issue in OSX but I still couldn't compile because of #2360
@jhollister care to open a PR with your fix?
I don't have much experience with compatibility stuff like this. Is it correct to do something like:
#if defined(__MACH__)
#include <stdlib.h>
#else
#include <malloc.h>
and should I do this for every occurrence of #include <malloc.h>?
You could also try to mess around with conditionally adding a local malloc.h for OSX (probably by extending the include path).
Most helpful comment
I don't have much experience with compatibility stuff like this. Is it correct to do something like:
and should I do this for every occurrence of
#include <malloc.h>?