Menu

#474 FreeBSD compile fix 2

version-1.8.19
closed-fixed
None
5
2017-01-21
2016-11-08
No

<malloc.h> has been replaced by <stdlib.h> on Freebsd.</stdlib.h></malloc.h>

1 Attachments

Discussion

  • ilovezfs

    ilovezfs - 2016-12-03

    The patch above also fixes build failure on maOS.

    macOS does have malloc.h, but it's in a malloc subdirectory (so /usr/include/malloc/malloc.h), and it's possible to #include <malloc/malloc.h>.

    In fact, the patch above seems to be overkill because just deleting the #include <malloc.h> lets it build as well.

    The build failure is

    /bin/sh ../libtool --silent  --tag=CC   --mode=compile /usr/bin/clang -DHAVE_CONFIG_H -I. -I..  -I../include -I/usr/local/opt/openssl/include -F/usr/local/Frameworks  -Os -w -pipe -march=native -mmacosx-version-min=10.11 -Wall -Wextra -std=gnu99 -pedantic -Wformat -Wformat-nonliteral -c -o ipmi_cfgp.lo ipmi_cfgp.c
    ipmi_cfgp.c:33:10: fatal error: 'malloc.h' file not found
    #include <malloc.h>
             ^
    1 error generated.
    make[1]: *** [ipmi_cfgp.lo] Error 1
    make: *** [install-recursive] Error 1
    

    A full build log is here: https://gist.github.com/ilovezfs/4549a99661f303afd91a3544af39653c

     
  • Zdenek Styblik

    Zdenek Styblik - 2017-01-15

    Let me ask a different question. Which OS-es don't have malloc() in <stdlib.h>? I'd rather go with #include <stdlib.h> instead of the proposed patch.

    Thanks.

     
  • Leonid Nevecherya

    I don't know answer for this question. I work with FreeBSD only. You must read ilovezfs comment too.

     
    • Zdenek Styblik

      Zdenek Styblik - 2017-01-16

      Hello,

      I will ask for two things. Please, add ID: 474 - <description> to commit message. Second, indent #include inside #ifdef blocks with one white-space eg. #include <stdlib.h>. Other than that, I agree with the proposed patch.

      Thank you very much.

       
  • Zdenek Styblik

    Zdenek Styblik - 2017-01-21
    • status: open --> closed-fixed
    • assigned_to: Zdenek Styblik
    • Group: version-1.8.18 --> version-1.8.19
     
  • Zdenek Styblik

    Zdenek Styblik - 2017-01-21

    Just to let you know, I have modified indent a bit, but the patch is in. Thank you.

     

Log in to post a comment.

MongoDB Logo MongoDB