Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 923647 - net-libs/libdom-0.4.2 - bindings/xml/libxml_xmlparser.c:146:20: error: call to undeclared library function 'malloc' with type 'void *(unsigned long)'
Summary: net-libs/libdom-0.4.2 - bindings/xml/libxml_xmlparser.c:146:20: error: call t...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Michael Orlitzky
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: musl-porting libxml2-2.12
  Show dependency tree
 
Reported: 2024-02-02 22:05 UTC by ernsteiswuerfel
Modified: 2024-02-03 21:51 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log (libdom-0.4.2:20240202-220114.log,8.26 KB, text/plain)
2024-02-02 22:05 UTC, ernsteiswuerfel
Details
emerge --info (file_923647.txt,7.36 KB, text/plain)
2024-02-02 22:06 UTC, ernsteiswuerfel
Details
0001-bindings-xml-libxml_xmlparser.c-add-stdlib.h-include.patch (0001-bindings-xml-libxml_xmlparser.c-add-stdlib.h-include.patch,905 bytes, patch)
2024-02-03 13:12 UTC, Michael Orlitzky
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description ernsteiswuerfel archtester 2024-02-02 22:05:50 UTC
Created attachment 884073 [details]
build.log

[...]
clang -MMD -MP -std=c99 -D_BSD_SOURCE -D_DEFAULT_SOURCE -I/var/tmp/portage/net-libs/libdom-0.4.2/work/libdom-0.4.2/include/ -I/var/tmp/portage/net-libs/libdom-0.4.2/work/libdom-0.4.2/src -I/var/tmp/portage/net-libs/libdom-0.4.2/work/libdom-0.4.2/binding  -Os -march=bdver2 -pipe -D_ALIGNED="__attribute__((aligned))" -DSTMTEXPR=1 -DNDEBUG     -I/usr/include/libxml2  -D_POSIX_C_SOURCE -fPIC -DPIC -o build-x86_64-gentoo-linux-musl-x86_64-gentoo-linux-musl-release-lib-shared/src_core_element.o -c src/core/element.c
bindings/xml/libxml_xmlparser.c:146:20: error: call to undeclared
      library function 'malloc' with type 'void *(unsigned long)'; ISO C99 and later do not
      support implicit function declarations [-Wimplicit-function-declaration]
  146 |                 return len > 0 ? malloc(len) : NULL;
      |                                  ^
bindings/xml/libxml_xmlparser.c:146:20: note: include the header
      <stdlib.h> or explicitly provide a declaration for 'malloc'
bindings/xml/libxml_xmlparser.c:149:3: error: call to undeclared library
      function 'free' with type 'void (void *)'; ISO C99 and later do not support implicit
      function declarations [-Wimplicit-function-declaration]
  149 |                 free(ptr);
      |                 ^
bindings/xml/libxml_xmlparser.c:149:3: note: include the header
      <stdlib.h> or explicitly provide a declaration for 'free'
bindings/xml/libxml_xmlparser.c:153:9: error: call to undeclared library
      function 'realloc' with type 'void *(void *, unsigned long)'; ISO C99 and later do not
      support implicit function declarations [-Wimplicit-function-declaration]
  153 |         return realloc(ptr, len);
      |                ^
bindings/xml/libxml_xmlparser.c:153:9: note: include the header
      <stdlib.h> or explicitly provide a declaration for 'realloc'
bindings/xml/libxml_xmlparser.c:326:9: warning: assigning to
      'xmlErrorPtr' (aka 'struct _xmlError *') from 'const xmlError *' (aka
      'const struct _xmlError *') discards qualifiers
      [-Wincompatible-pointer-types-discards-qualifiers]
  326 |         xmlerr = xmlCtxtGetLastError(parser->xml_ctx);
      |                ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bindings/xml/libxml_xmlparser.c:358:9: warning: assigning to
      'xmlErrorPtr' (aka 'struct _xmlError *') from 'const xmlError *' (aka
      'const struct _xmlError *') discards qualifiers
      [-Wincompatible-pointer-types-discards-qualifiers]
  358 |         xmlerr = xmlCtxtGetLastError(parser->xml_ctx);
      |                ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bindings/xml/libxml_xmlparser.c:442:9: warning: assigning to
      'xmlErrorPtr' (aka 'struct _xmlError *') from 'const xmlError *' (aka
      'const struct _xmlError *') discards qualifiers
      [-Wincompatible-pointer-types-discards-qualifiers]
  442 |         xmlerr = xmlCtxtGetLastError(parser->xml_ctx);
      |                ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bindings/xml/libxml_xmlparser.c:519:9: warning: assigning to
      'xmlErrorPtr' (aka 'struct _xmlError *') from 'const xmlError *' (aka
      'const struct _xmlError *') discards qualifiers
      [-Wincompatible-pointer-types-discards-qualifiers]
  519 |         xmlerr = xmlCtxtGetLastError(parser->xml_ctx);
      |                ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4 warnings and 3 errors generated.
make: *** [/usr/share/netsurf-buildsystem/makefiles/Makefile.top:595: build-x86_64-gentoo-linux-musl-x86_64-gentoo-linux-musl-release-lib-shared/bindings_xml_libxml_xmlparser.o] Error 1
make: *** Waiting for unfinished jobs....
 * ERROR: net-libs/libdom-0.4.2::gentoo failed (compile phase):
 *   emake failed
Comment 1 ernsteiswuerfel archtester 2024-02-02 22:06:28 UTC
Created attachment 884074 [details]
emerge --info
Comment 2 Michael Orlitzky gentoo-dev 2024-02-03 13:12:02 UTC
Created attachment 884127 [details, diff]
0001-bindings-xml-libxml_xmlparser.c-add-stdlib.h-include.patch

I think it's a musl thing. Here's a patch to add the include. Is that enough to fix the build for you?
Comment 3 ernsteiswuerfel archtester 2024-02-03 15:40:53 UTC
Ah yes, indeed! It's a musl thing after all.

And your patch fixes the build. Thanks!
Comment 4 Larry the Git Cow gentoo-dev 2024-02-03 17:00:12 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e4bedabe7945ed0b58b3ed67294a246d27698d7c

commit e4bedabe7945ed0b58b3ed67294a246d27698d7c
Author:     Michael Orlitzky <mjo@gentoo.org>
AuthorDate: 2024-02-03 16:57:34 +0000
Commit:     Michael Orlitzky <mjo@gentoo.org>
CommitDate: 2024-02-03 16:57:34 +0000

    net-libs/libdom: fix the build with musl
    
    Closes: https://bugs.gentoo.org/923647
    Signed-off-by: Michael Orlitzky <mjo@gentoo.org>

 net-libs/libdom/files/libdom-0.4.2-musl.patch | 29 +++++++++++++++++++++++++++
 net-libs/libdom/libdom-0.4.2.ebuild           |  2 ++
 2 files changed, 31 insertions(+)