Skip to content

boost-1.61.0 failure to bootstrap with xcode-12 due to implicit function declarations #664

@rlei-weta

Description

@rlei-weta

Environment:

  • macOs Catalina 10.15.7
  • Apple clang version 12.0.0

Repro steps:

  1. Download and extract boost-1.61.0 (https://sourceforge.net/projects/boost/files/boost/1.61.0/boost_1_61_0.tar.bz2/download)
  2. Execute ./bootstrap.sh

Error output:

Building Boost.Build engine with toolset darwin... 
Failed to build Boost.Build build engine
Consult 'bootstrap.log' for more details

bootstrap.log:

###
### Using 'darwin' toolset.
###
rm -rf bootstrap
mkdir bootstrap
cc -o bootstrap/jam0 command.c compile.c constants.c debug.c execcmd.c frames.c function.c glob.c hash.c hdrmacro.c headers.c jam.c jambase.c jamgram.c lists.c make.c make1.c object.c option.c output.c parse.c pathsys.c regexp.c rules.c scan.c search.c subst.c timestamp.c variable.c modules.c strings.c filesys.c builtins.c class.c cwd.c native.c md5.c w32_getreg.c modules/set.c modules/path.c modules/regex.c modules/property-set.c modules/sequence.c modules/order.c execunix.c fileunix.c pathunix.c
execcmd.c:120:5: error: implicit declaration of function 'out_printf' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    out_printf( "...interrupted\n" );
    ^
1 error generated.
make.c:132:13: error: implicit declaration of function 'out_printf' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
            out_printf( "...found %d target%s...\n", counts->targets,
            ^
make.c:184:17: error: implicit declaration of function 'out_printf' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
                out_printf( "fate change  %s from %s to %s (as dependant of %s)\n",
                ^
make.c:215:17: error: implicit declaration of function 'out_printf' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
                out_printf( "fate change  %s from %s to %s (by rebuild)\n",
                ^
make.c:300:9: error: implicit declaration of function 'out_printf' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        out_printf( "make\t--\t%s%s\n", spaces( depth ), object_str( t->name ) );
        ^
make.c:300:41: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int]
        out_printf( "make\t--\t%s%s\n", spaces( depth ), object_str( t->name ) );
                                        ^~~~~~~~~~~~~~~
make.c:85:44: note: expanded from macro 'spaces'
#define spaces(x) ( "                    " + ( x > 20 ? 0 : 20-x ) )
                    ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
make.c:300:41: note: use array indexing to silence this warning
make.c:85:44: note: expanded from macro 'spaces'
#define spaces(x) ( "                    " + ( x > 20 ? 0 : 20-x ) )
                                           ^
make.c:307:41: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int]
        out_printf( "make\t--\t%s%s\n", spaces( depth ), object_str( t->name ) );
                                        ^~~~~~~~~~~~~~~
make.c:85:44: note: expanded from macro 'spaces'
#define spaces(x) ( "                    " + ( x > 20 ? 0 : 20-x ) )
                    ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
make.c:307:41: note: use array indexing to silence this warning
make.c:85:44: note: expanded from macro 'spaces'
#define spaces(x) ( "                    " + ( x > 20 ? 0 : 20-x ) )
                                           ^
make.c:380:49: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int]
            out_printf( "bind\t--\t%s%s: %s\n", spaces( depth ),
                                                ^~~~~~~~~~~~~~~
make.c:85:44: note: expanded from macro 'spaces'
#define spaces(x) ( "                    " + ( x > 20 ? 0 : 20-x ) )
                    ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
make.c:380:49: note: use array indexing to silence this warning
make.c:85:44: note: expanded from macro 'spaces'
#define spaces(x) ( "                    " + ( x > 20 ? 0 : 20-x ) )
                                           ^
make.c:388:49: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int]
            out_printf( "time\t--\t%s%s: %s\n", spaces( depth ),
                                                ^~~~~~~~~~~~~~~
make.c:85:44: note: expanded from macro 'spaces'
#define spaces(x) ( "                    " + ( x > 20 ? 0 : 20-x ) )
                    ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
make.c:388:49: note: use array indexing to silence this warning
make.c:85:44: note: expanded from macro 'spaces'
#define spaces(x) ( "                    " + ( x > 20 ? 0 : 20-x ) )
                                           ^
make.c:393:49: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int]
            out_printf( "time\t--\t%s%s: %s\n", spaces( depth ),
                                                ^~~~~~~~~~~~~~~
make.c:85:44: note: expanded from macro 'spaces'
#define spaces(x) ( "                    " + ( x > 20 ? 0 : 20-x ) )
                    ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
make.c:393:49: note: use array indexing to silence this warning
make.c:85:44: note: expanded from macro 'spaces'
#define spaces(x) ( "                    " + ( x > 20 ? 0 : 20-x ) )
                                           ^
make.c:735:13: error: implicit declaration of function 'out_flush' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
            out_flush();
            ^
make.c:758:13: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int]
            spaces( depth ), object_str( t->name ) );
            ^~~~~~~~~~~~~~~
make.c:85:44: note: expanded from macro 'spaces'
#define spaces(x) ( "                    " + ( x > 20 ? 0 : 20-x ) )
                    ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
make.c:758:13: note: use array indexing to silence this warning
make.c:85:44: note: expanded from macro 'spaces'
#define spaces(x) ( "                    " + ( x > 20 ? 0 : 20-x ) )
                                           ^
6 warnings and 5 errors generated.
filesys.c:360:10: error: implicit declaration of function 'filelist_empty' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    if ( filelist_empty( archive->members ) )
         ^
filesys.c:496:10: error: implicit declaration of function 'filelist_empty' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    if ( filelist_empty( list ) )
         ^
filesys.c:534:10: error: implicit declaration of function 'filelist_empty' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    if ( filelist_empty( list ) )
         ^
filesys.c:570:10: error: implicit declaration of function 'filelist_empty' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    if ( filelist_empty( list ) ) return list;
         ^
filesys.c:593:11: error: implicit declaration of function 'filelist_empty' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    if ( !filelist_empty( list ) ) result = list->size;
          ^
filesys.c:602:10: error: implicit declaration of function 'filelist_empty' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    if ( filelist_empty( list ) ) return;
         ^
6 errors generated.
modules/path.c:16:12: error: implicit declaration of function 'file_query' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    return file_query( list_front( lol_get( frame->args, 0 ) ) ) ?
           ^
1 error generated.
fileunix.c:233:10: error: implicit declaration of function 'filelist_empty' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    if ( filelist_empty( archive->members ) )
         ^
fileunix.c:235:14: error: implicit declaration of function 'file_collect_archive_content_' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        if ( file_collect_archive_content_( archive ) < 0 )
             ^
fileunix.c:235:14: note: did you mean 'file_collect_dir_content_'?
fileunix.c:110:5: note: 'file_collect_dir_content_' declared here
int file_collect_dir_content_( file_info_t * const d )
    ^
fileunix.c:294:12: error: implicit declaration of function 'filelist_empty' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    if ( ! filelist_empty( archive->members ) ) filelist_free( archive->members );
           ^
3 errors generated.

Looks like it is caused by clang bundled with xcode-12 now reporting an error for implicit function declarations:
https://developer.apple.com/documentation/xcode-release-notes/xcode-12-release-notes

Clang now reports an error when you use a function without an explicit declaration when building C or Objective-C code for macOS (-Werror=implicit-function-declaration flag is on). This additional error detection unifies Clang’s behavior for iOS/tvOS and macOS 64-bit targets for this diagnostic. (49917738)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions