xor2003 / masm2c

x86 assembler (MASM syntax) to C translator
Other
79 stars 16 forks source link

libdosbox compilation on macOS #12

Open Vutshi opened 4 months ago

Vutshi commented 4 months ago

There is no issues in libdosbox repository so I try to post my issue here. I try to compile libdosbox in macOS and get the following error messages:

../src/custom/segfault.cpp:115:14: error: use of undeclared identifier 'SIGPWR'
        case SIGPWR: WRITE_WORD("SIGPWR");break;
             ^
../src/custom/segfault.cpp:118:14: error: use of undeclared identifier 'SIGIO'
        case SIGIO: WRITE_WORD("SIGIO");break;
             ^
../src/custom/segfault.cpp:119:14: error: use of undeclared identifier 'SIGWINCH'
        case SIGWINCH: WRITE_WORD("SIGWINCH");break;
             ^
../src/custom/segfault.cpp:393:2: error: "Unknown architecture"
#error "Unknown architecture"
 ^
../src/custom/segfault.cpp:274:32: warning: unused parameter 'pc' [-Wunused-parameter]
void print_backtrace(uintptr_t pc)
                               ^
../src/custom/segfault.cpp:451:54: error: member reference type 'struct __darwin_mcontext64 *' is a pointer; did you mean to use '->'?
        pc =   ((uintptr_t)(void *) (uc)->uc_mcontext.gregs[REG_RIP]); // x86_64 specific
                                    ~~~~~~~~~~~~~~~~~^
                                                     ->
../src/custom/segfault.cpp:451:55: error: no member named 'gregs' in '__darwin_mcontext64'
        pc =   ((uintptr_t)(void *) (uc)->uc_mcontext.gregs[REG_RIP]); // x86_64 specific
                                    ~~~~~~~~~~~~~~~~~ ^
../src/custom/segfault.cpp:451:61: error: use of undeclared identifier 'rip'
        pc =   ((uintptr_t)(void *) (uc)->uc_mcontext.gregs[REG_RIP]); // x86_64 specific
                                                            ^
../src/custom/segfault.cpp:39:27: note: expanded from macro 'REG_RIP'
#define REG_RIP REG_INDEX(rip) /* seems to be 16 */
                          ^
../src/custom/segfault.cpp:582:10: error: no type named 'set_unexpected' in namespace 'std'
    std::set_unexpected( exception_handler ); // catch unexpected exception
    ~~~~~^
1 warning and 8 errors generated.

I am using macOS 13.6.7 (22G720) and clang 15

Best

xor2003 commented 4 months ago

I don't have macos with me. This file just help to dump good looking stack traces. You can mark with #ifdef all incompatible parts. Ready for PRs