Skip to content

Instantly share code, notes, and snippets.

@petdance
Created September 29, 2016 00:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save petdance/cfa346c6614c56ca923886da8b7b71c2 to your computer and use it in GitHub Desktop.
Save petdance/cfa346c6614c56ca923886da8b7b71c2 to your computer and use it in GitHub Desktop.
(blead) clifford:~/perlfromperlorg $ make malloc.o
clang -c -DPERL_CORE -D_REENTRANT -D_GNU_SOURCE -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_S
OURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -std=c89 -O3 -Wall -Werror=declaration-after-statement -Wextra -Wc++-compat -Wwrite-strings
malloc.c
malloc.c:257:4: error: "MYMALLOC is not defined"
# error "MYMALLOC is not defined"
^
malloc.c:985:13: warning: implicit declaration of function 'malloced_size' [-Wimplicit-function-declaration]
*size = malloced_size(pv) + M_OVERHEAD;
^
@jkeenan
Copy link

jkeenan commented Sep 29, 2016

Andy, when I configure with
sh ./Configure -des -Dusedevel -Dcc=clang
and then call:
make malloc.o
I get failures like yours:

$ make malloc.o
clang -c -DPERL_CORE -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -std=c89 -O2 -Wall -Werror=declaration-after-statement -Wextra -Wc++-compat -Wwrite-strings malloc.c
malloc.c:257:4: error: "MYMALLOC is not defined"
#  error "MYMALLOC is not defined"
   ^
malloc.c:985:13: warning: implicit declaration of function 'malloced_size' [-Wimplicit-function-declaration]
    *size = malloced_size(pv) + M_OVERHEAD;
            ^
malloc.c:1546:7: warning: ignoring return value of function declared with warn_unused_result attribute
      [-Wunused-result]
                    fatalcroak("panic: Off-page sbrk\n");
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
malloc.c:277:31: note: expanded from macro 'fatalcroak'
#    define fatalcroak(mess)    (write(2, (mess), strlen(mess)), exit(2))
                                 ^~~~~ ~~~~~~~~~~~~~~~~~~~~~~~
malloc.c:1585:6: warning: ignoring return value of function declared with warn_unused_result attribute
      [-Wunused-result]
            fatalcroak("Misalignment of sbrk()\n");
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
malloc.c:277:31: note: expanded from macro 'fatalcroak'
#    define fatalcroak(mess)    (write(2, (mess), strlen(mess)), exit(2))
                                 ^~~~~ ~~~~~~~~~~~~~~~~~~~~~~~
malloc.c:2139:5: error: use of undeclared identifier 'PERL_ARGS_ASSERT_MALLOCED_SIZE'
    PERL_ARGS_ASSERT_MALLOCED_SIZE;
    ^
malloc.c:2155:30: error: expected ')'
Perl_malloc_good_size(size_t wanted)
                             ^
./perl.h:4672:43: note: expanded from macro 'Perl_malloc_good_size'
#       define Perl_malloc_good_size(how_much)  (how_much)
                                                 ^
malloc.c:2155:1: note: to match this '('
Perl_malloc_good_size(size_t wanted)
^
./perl.h:4672:42: note: expanded from macro 'Perl_malloc_good_size'
#       define Perl_malloc_good_size(how_much)  (how_much)
                                                ^
malloc.c:2155:23: error: redefinition of 'size_t' as different kind of symbol
Perl_malloc_good_size(size_t wanted)
                      ^
./perl.h:4672:43: note: expanded from macro 'Perl_malloc_good_size'
#       define Perl_malloc_good_size(how_much)  (how_much)
                                                 ^
/usr/lib/llvm-3.6/bin/../lib/clang/3.6.2/include/stddef.h:62:23: note: previous definition is here
typedef __SIZE_TYPE__ size_t;
                      ^
malloc.c:2155:37: error: expected ';' after top level declarator
Perl_malloc_good_size(size_t wanted)
                                    ^
                                    ;
3 warnings and 5 errors generated.
makefile:269: recipe for target 'malloc.o' failed
make: *** [malloc.o] Error 1

And this is independent of which C compiler I use. Omitting -Dcc=clang -- thereby defaulting to gcc -- gives the same failures.

However, when I simply call make, I get a successful build. (blead on Ubuntu Linux 16.04 LTS)

I should note that I have never previously called make malloc.o, so I don't have any idea how it should normally behave.

How are you configuring?

Thank you very much.
Jim Keenan

@jkeenan
Copy link

jkeenan commented Sep 29, 2016

Using perlbrew, I tried make malloc.o on 5.10.0, 5.14.4 and 5.20.3. Same (or very similar) errors.

My hunch is that make malloc.o is not a valid make target and never has been.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment