Closed Kawanaao closed 1 month ago
You might be using an old mimalloc version, I can see it from the v1.7.3 tag.
No, this is not so, even the master file does not define malloc_good_size, just like I do in /usr/include, the problem is that in my system with Musl there is no definition of these two functions, but I link the entire system with mimalloc, and mimalloc added T symbols of these two functions to the gdbm library, but the system does not provide any way to import it, since there is no definition in the header files, I defined it myself and forced it to be imported into perl, after which everything compiled
I do not get it, malloc_good_size is for macos isn't it ?
I do not get it, malloc_good_size is for macos isn't it ?
Yes, this is it, but musl in malloc.h does not have these two functions, but during static linking with mimalloc these two symbols appear in so, malloc_size is defined, but malloc_good_size is not
Fair enough I can reproduce it with master on my alpine instance.
malloc_good_size
is overridden in src/override.c
-- I think you just mean that malloc_good_size
is not defined in het include/mimalloc_override.h
right? I'll add a definition there as well :-)
@daanx when I compile perl5, same goes with malloc_good_size
av.c: In function 'Perl_av_extend_guts':
perl.h:5332:47: warning: implicit declaration of function 'malloc_size' [-Wimplicit-function-declaration]
5332 | # define Perl_safesysmalloc_size(where) malloc_size(where)
| ^~~~~~~~~~~
av.c:137:22: note: in expansion of macro 'Perl_safesysmalloc_size'
137 | newmax = Perl_safesysmalloc_size((void*)*allocp) /
| ^~~~~~~~~~~~~~~~~~~~~~~
cc -c -DPERL_CORE -D_GNU_SOURCE -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -std=c99 -O2 -Wall -Werror=pointer-arith -Werror=vla -Wextra -Wno-long-long -Wno-declaration-after-statement -Wc++-compat -Wwrite-strings -Wno-use-after-free run.c
cc -c -DPERL_CORE -D_GNU_SOURCE -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -std=c99 -O2 -Wall -Werror=pointer-arith -Werror=vla -Wextra -Wno-long-long -Wno-declaration-after-statement -Wc++-compat -Wwrite-strings -Wno-use-after-free pp_hot.c
cc -c -DPERL_CORE -D_GNU_SOURCE -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -std=c99 -O2 -Wall -Werror=pointer-arith -Werror=vla -Wextra -Wno-long-long -Wno-declaration-after-statement -Wc++-compat -Wwrite-strings -Wno-use-after-free sv.c
In file included from perl.h:4530,
from sv.c:32:
sv.c: In function 'Perl_sv_usepvn_flags':
perl.h:5332:47: warning: implicit declaration of function 'malloc_size' [-Wimplicit-function-declaration]
5332 | # define Perl_safesysmalloc_size(where) malloc_size(where)
| ^~~~~~~~~~~
sv.h:1541:50: note: in definition of macro 'SvLEN_set'
1541 | (((XPV*) SvANY(sv))->xpv_len = (val)); } STMT_END
| ^~~
sv.c:5215:19: note: in expansion of macro 'Perl_safesysmalloc_size'
5215 | SvLEN_set(sv, Perl_safesysmalloc_size(ptr));
@devnexen this is on Alpine with musl right? As I understand, musl does not define malloc_size
or malloc_good_size
in a header file. So, we need to include the mimalloc_override.h
somehow to give a definition. In a way this is a Perl5 config bug? Or maybe I mistunderstand the problem?
yes alpine linux. is mimalloc-override.h designed to be a public header ? if yes then it might solve the issue.
Yes, mimalloc-override.h
(and mimalloc-new-delete.h
and mimalloc.h
) is designed as a public header. It is meant for overriding statically by macros if one controls all sources. Including it for Perl5 would define malloc_good_size
as mi_malloc_good_size
and thus provide a definition. (but not sure how perl5 would include this header and if that would make sense -- if linking with mimalloc we may just as well directly define Perl_safesysmalloc_size
as mi_malloc_size
etc.)
What seems to work for me. I went through patiently all the questions of the Configure script and it does ask if we want to use nm to check symbols. default is yes. if I say no then it builds.
Ah I get it now. Since mimalloc defines malloc_good_size
as an override in src/alloc-override.c
the nm
method will find it and configure assuming that malloc_good_size
is defined -- but then it is never defined in any header file (since mimalloc only defines it as an override), which leads to the compile errors.
so, at least malloc_good_size
is now in mimalloc-override.h
, but otherwise it is a config issue for Perl, not much we can do.
Ah I get it now. Since mimalloc defines
malloc_good_size
as an override insrc/alloc-override.c
thenm
method will find it and configure assuming thatmalloc_good_size
is defined -- but then it is never defined in any header file (since mimalloc only defines it as an override), which leads to the compile errors.so, at least
malloc_good_size
is now inmimalloc-override.h
, but otherwise it is a config issue for Perl, not much we can do.
Thank you! This change makes it possible to specify the -includemimalloc-override.h flag to the compiler and everything will work as expected, at least while this problem exists
Hello! Today I encountered a problem compiling perl5, which requires malloc_size and malloc_goodsize, since it detects them in another library, the first one was found in mimalloc-override.h, but the second one is missing, although clang points to a similar function, with the mi prefix, can we enable this flag in header file too?