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

malloc poison on some compilers - cross compiling #1013

Closed
olivierschonken opened this issue Sep 7, 2017 · 1 comment
Closed

malloc poison on some compilers - cross compiling #1013

olivierschonken opened this issue Sep 7, 2017 · 1 comment

Comments

@olivierschonken
Copy link

olivierschonken commented Sep 7, 2017

Cross-compiling with buildroot, we are experiencing some pragma poisoning issues related to malloc as shown below. Most of the issues are found compiling against uclibc. malloc is poisoned in the #include "opj_includes.h" at the top of the thread file, in the uclibc threads header file, sched.h is also included, which has #defines referencing malloc. This causes the attempt to use poisoned malloc and free messages. If I move the "opj_includes.h" include to below the include <pthread.h> at line 287 and into the #ifdef MUTEX_win32 at line 37 compilation succeeds, but I'm not sure this is the best sollution.

In file included from /home/olivier/Buildroot-android-check/output/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/sched.h:34:0,
from /home/olivier/Buildroot/output/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/pthread.h:24,
from /home/olivier/Buildroot/output/build/openjpeg-2.2.0/src/lib/openjp2/thread.c:288:
/home/olivier/Buildroot/output/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/bits/sched.h:210:46: error: attempt to use poisoned "malloc"
 # define __sched_cpualloc(cnt) ((cpu_set_t *)malloc(__CPU_ALLOC_SIZE(cnt)))
                                              ^
/home/olivier/Buildroot/output/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/bits/sched.h:211:33: error: attempt to use poisoned "free"
 # define __sched_cpufree(__set) free(__set)
                                 ^
src/lib/openjp2/CMakeFiles/openjp2_static.dir/build.make:62: recipe for target 'src/lib/openjp2/CMakeFiles/openjp2_static.dir/thread.c.o' failed
make[3]: *** [src/lib/openjp2/CMakeFiles/openjp2_static.dir/thread.c.o] Error 1
make[3]: *** Waiting for unfinished jobs....
In file included from /home/olivier/Buildroot/output/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/sched.h:34:0,
                 from /home/olivier/Buildroot/output/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/pthread.h:24,
                 from /home/olivier/Buildroot/output/build/openjpeg-2.2.0/src/lib/openjp2/thread.c:288:
/home/olivier/Buildroot/output/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/bits/sched.h:210:46: error: attempt to use poisoned "malloc"
 # define __sched_cpualloc(cnt) ((cpu_set_t *)malloc(__CPU_ALLOC_SIZE(cnt)))
                                              ^
/home/olivier/Buildroot-android-check/output/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/bits/sched.h:211:33: error: attempt to use poisoned "free"
 # define __sched_cpufree(__set) free(__set)
@rouault
Copy link
Collaborator

rouault commented Sep 7, 2017

I went along with your proposal.

@rouault rouault closed this as completed Sep 7, 2017
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

2 participants