Ask Your Question
1

malloc.h error when building in a freenas jail

asked 2020-03-19 08:55:16 -0600

jonmoore gravatar image

updated 2020-03-19 09:52:02 -0600

supra56 gravatar image

Hello,

I'm hoping someone can guide me to getting opencv built on in a freenas jail

When I'm running make I'm getting to about 6% and then getting this error

/usr/include/malloc.h:3:2: error: "<malloc.h> has been replaced by <stdlib.h>"
#error "<malloc.h> has been replaced by <stdlib.h>"

to be honest I don't even know where to start with getting around this so any help would be great.

Thanks!

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2020-03-19 11:05:46 -0600

mvuori gravatar image

C++/C header malloc.h has been deprecated ages ago, and should not be used. In this case the compiler causes an error if one tries it. In place of malloc.h, stdlib.h should be used, as the error message tries to tell in its clumsy way. It seems that #include <malloc.h> is found in some OpenCV files even in the latest version: - 3rdparty\include\opencl\1.2\CL\cl.hpp (1 hit) - modules\core\src\alloc.cpp (1 hit)

In the cl.hpp it is included for WIN32 compilation, but in alloc.cpp it is used if HAVE_POSIX_MEMALIGN variable is false. I would just change malloc.h to stdlib.h in alloc.cpp and see what happens - there may be some side effects, but likely not. Of course, there may be a deeper cause for the problem, which may show as other problems in building or execution.

edit flag offensive delete link more

Comments

Ah cool, thanks!

that seems to have moved me on a bit, had to change it in iw_own.c and iw_core.c

I still can't make though, I'm only up to 12% so this feels like it could be a bad time :(

I'm now getting an error from parallel.cpp; use of undeclared identifier '_SC_NPROCESSORS_ONLN'

any ideas on that one?

Thanks for the help!

jonmoore gravatar imagejonmoore ( 2020-03-19 11:58:33 -0600 )edit

sorry... realised I should mark this as solved and open a new questions for the new issue...

jonmoore gravatar imagejonmoore ( 2020-03-19 14:13:13 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2020-03-19 08:55:16 -0600

Seen: 379 times

Last updated: Mar 19 '20