Menu

#262 Fails to compile with clang: use_safe_malloc_instead

consensus
closed-fixed
None
5
2015-02-03
2013-11-08
No

Compiling with clang gives the following error:

In file included from AS_BOG_ChunkGraph.C:24:
In file included from /private/tmp/celera-assembler-IlFU/wgs-8.0/src/AS_BOG/AS_BOG_Datatypes.H:36:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/iostream:40:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/istream:156:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/ostream:938:33: error: use of undeclared identifier 'use_safe_malloc_instead'
                __wb = (_CharT*)malloc(__len*sizeof(_CharT));
                                ^
/private/tmp/celera-assembler-IlFU/wgs-8.0/src/AS_UTL/AS_UTL_alloc.H:55:23: note: expanded from macro 'malloc'
#define malloc(X)     use_safe_malloc_instead(X)
                      ^

Discussion

  • Brian Walenz

    Brian Walenz - 2014-04-11

    I can't say clang compilation works yet, at least from the command line, but this problem is resolved. Remove the include of iostream, cmath and limits from AS_BOG/AS_BOG_Datatypes.H. The change is committed to subversion. (Odd that c++ ostream uses malloc, no?)

    For the record, clang compilation fails to find header omp.h.

     
  • Brian Walenz

    Brian Walenz - 2015-02-02

    The build will now auto-detect if clang is the compiler, and disable thread support.

    Until Apple fixes clang, I strongly suggest using gcc48 from MacPorts. You might need to 'port select gcc mp-gcc48' to enable it.

     
  • Brian Walenz

    Brian Walenz - 2015-02-02
    • status: open --> closed-fixed
     
  • Shaun Jackman

    Shaun Jackman - 2015-02-03

    Thanks! I'm using GCC 4.9 from Homebrew to compile now.

     

Log in to post a comment.