Opened 2 months ago

Last modified 7 weeks ago

#12405 new defect

BUILD: Build failure on alpinelinux with fortify-headers

Reported by: kmmndr Owned by:
Priority: normal Component: Common
Version: Keywords:
Cc: Game:

Description

I'm trying to compile 2.2.0 release on alpinelinux.

It compiles without error with SDL1, but with SDL2 I'm having issues with common/forbidden.h

        C++      backends/platform/sdl/posix/posix-main.o
    In file included from ./common/scummsys.h:467,
                     from backends/platform/sdl/posix/posix-main.cpp:23:
    ./common/forbidden.h:57:89: error: expected initializer before 'SYMBOL'
       57 | #define FORBIDDEN_SYMBOL_REPLACEMENT FORBIDDEN_look_at_common_forbidden_h_for_more_info SYMBOL !%*
          |                                                                                         ^~~~~~
    ./common/forbidden.h:57:89: error: expected initializer before 'SYMBOL'
       57 | #define FORBIDDEN_SYMBOL_REPLACEMENT FORBIDDEN_look_at_common_forbidden_h_for_more_info SYMBOL !%*
          |                                                                                         ^~~~~~
    ./common/forbidden.h:57:89: error: expected initializer before 'SYMBOL'
       57 | #define FORBIDDEN_SYMBOL_REPLACEMENT FORBIDDEN_look_at_common_forbidden_h_for_more_info SYMBOL !%*
          |                                                                                         ^~~~~~
        C++      backends/platform/sdl/posix/posix.o
    In file included from /usr/include/fortify/stdio.h:25,
                     from ./common/scummsys.h:118,
                     from backends/platform/sdl/posix/posix-main.cpp:23:
    /usr/include/fortify/unistd.h:53:1: error: 'getcwd' was not declared in this scope; did you mean 'getwd'?
       53 | _FORTIFY_FN(getcwd) char *getcwd(char *__s, size_t __l)
          | ^~~~~~~~~~~
    In file included from /usr/include/directfb/direct/os/linux/glibc/types.h:45,
                     from /usr/include/directfb/direct/os/types.h:47,
                     from /usr/include/directfb/direct/types.h:36,
                     from /usr/include/directfb/direct/Types++.h:38,
                     from /usr/include/directfb/directfb++.h:35,
                     from /usr/include/directfb/directfb.h:32,
                     from /usr/include/SDL2/SDL_syswm.h:80,
                     from ./backends/platform/sdl/sdl-sys.h:150,
                     from ./backends/platform/sdl/sdl.h:26,
                     from ./backends/platform/sdl/posix/posix.h:26,
                     from backends/platform/sdl/posix/posix-main.cpp:27:
    /usr/include/fortify/unistd.h: In function 'char* getcwd(char*, size_t)':
    /usr/include/fortify/unistd.h:59:31: error: '__orig_getcwd' cannot be used as a function
       59 |  return __orig_getcwd(__s, __l);
          |                               ^

Am I missing something ? Any idea ?

Change History (5)

comment:1 by kmmndr, 2 months ago

It seems to be related to fortify-headers which is installed by default on alpinelinux

comment:2 by kmmndr, 2 months ago

Summary: BUILD: Build failure on alpinelinux edgeBUILD: Build failure on alpinelinux with fortify-headers

comment:4 by digitall, 7 weeks ago

PR 2939 has now been merged, but that issue is tricky to solve. ScummVM uses the forbidden header to replace certain system function symbols with broken ones to enforce "forbidding" their usage in code, especially in engines without a clear declaration to override this and thus mark code for refactoring.

However, the fortify header does something similar to override the symbols to replace them with more protected versions... I would suspect these are not going to interact well without a bit of work on the order of header inclusion here.

comment:5 by digitall, 7 weeks ago

ScummVM is not the only OSS application to do something similar... See:
https://github.com/git/git/blob/master/banned.h

Note: See TracTickets for help on using tickets.