News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

How to build latest UASM on macOS?

Started by anta40, May 18, 2021, 04:14:09 PM

Previous topic - Next topic

anta40

I just pulled the latest UASM, and couldn't built in on macOS (Big Sur)

make -f ClangOSX64.mak
gcc -D __UNIX__ -c -IH -D __UNIX__ -DNDEBUG -O2 -ansi -funsigned-char -fwritable-strings -o GccUnixR/dbgcv.o dbgcv.c
In file included from dbgcv.c:13:
H/memalloc.h:49:10: warning: 'alloca' macro redefined [-Wmacro-redefined]
        #define alloca(x)  __builtin_alloca(x)
                ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/alloca.h:39:9: note: previous definition is here
#define alloca(size)    __alloca(size)
        ^
In file included from dbgcv.c:14:
In file included from H/parser.h:59:
H/instruct.h:1241:10: warning: '/*' within block comment [-Wcomment]
/* #if 0 /* v2.09: added, inactive ( not supported by ML64 v8,9,10 ) */
         ^
dbgcv.c:20:10: fatal error: 'direct.h' file not found
#include <direct.h>
         ^~~~~~~~~~


Of course, there's no direct.h for Linux/OSX/etc. I opened dbgcv.c and added some changes:

  • Replaced <direct.h> with <unistd.h>
  • Added #define _MAX_PATH 4096
  • Replaced _getcwd with getcwd

Also edited ClangOXX64.mak: removed -fwritable-strings from extra_c_flags.

Now the error count is reduced from > 20 to 4.

I have no idea the fix the first 2:
dbgcv.c:1572:16: error: use of undeclared identifier '_pgmptr'
                len = strlen(_pgmptr) + 1;
                             ^
dbgcv.c:1573:17: error: use of undeclared identifier '_pgmptr'
                s = strcpy(s, _pgmptr) + len;


_pgmptr looks Windows-specific. Not sure what the Linux/MacOS equivalent of it.

And the last 2 are casting errors:
dbgcv.c:1582:41: error: 'char *' and 'uint_8 *' (aka 'unsigned char *') are not pointers to compatible types
                EnvBlock->reclen = (unsigned short)(s - cv.ps - 2);
                                                    ~ ^ ~~~~~
dbgcv.c:1583:9: warning: assigning to 'uint_8 *' (aka 'unsigned char *') from 'char *' converts between pointers to integer types with different sign
      [-Wpointer-sign]
                cv.ps = s;
                      ^ ~
dbgcv.c:1587:28: error: 'char *' and 'uint_8 *' (aka 'unsigned char *') are not pointers to compatible types
                cv.section->length += (s - start);