Giter Club home page Giter Club logo

Comments (13)

daanx avatar daanx commented on July 22, 2024 1

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.

from mimalloc.

devnexen avatar devnexen commented on July 22, 2024

You might be using an old mimalloc version, I can see it from the v1.7.3 tag.

from mimalloc.

Kawanaao avatar Kawanaao commented on July 22, 2024

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

from mimalloc.

devnexen avatar devnexen commented on July 22, 2024

I do not get it, malloc_good_size is for macos isn't it ?

from mimalloc.

Kawanaao avatar Kawanaao commented on July 22, 2024

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

from mimalloc.

devnexen avatar devnexen commented on July 22, 2024

Fair enough I can reproduce it with master on my alpine instance.

from mimalloc.

daanx avatar daanx commented on July 22, 2024

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 :-)

from mimalloc.

devnexen avatar devnexen commented on July 22, 2024

@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));

from mimalloc.

daanx avatar daanx commented on July 22, 2024

@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?

from mimalloc.

devnexen avatar devnexen commented on July 22, 2024

yes alpine linux. is mimalloc-override.h designed to be a public header ? if yes then it might solve the issue.

from mimalloc.

daanx avatar daanx commented on July 22, 2024

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.)

from mimalloc.

devnexen avatar devnexen commented on July 22, 2024

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.

from mimalloc.

Kawanaao avatar Kawanaao commented on July 22, 2024

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.

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

from mimalloc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.