Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

macOS: Builtin issues #41

Open
IngwiePhoenix opened this issue Feb 23, 2019 · 1 comment
Open

macOS: Builtin issues #41

IngwiePhoenix opened this issue Feb 23, 2019 · 1 comment

Comments

@IngwiePhoenix
Copy link

Hello! :)

I just wanted to try this project out and made me a clone and attempted a build with mkdir out && make all BUILDDIR=./out. This is what essentially happened:

cc -g -c -Icpp -o out/getopt.o cpp/getopt.c
cpp/getopt.c:21:3: warning: add explicit braces to avoid dangling else [-Wdangling-else]
                else if (strcmp(argv[optind], "--") == 0) {
                ^
1 warning generated.
cc -g -c -Icpp -o out/unix.o cpp/unix.c
cpp/unix.c:96:1: error: expected parameter declarator
memmove(void *dp, const void *sp, size_t n)
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/secure/_string.h:69:47: note: expanded from macro 'memmove'
                __builtin___memmove_chk (dest, __VA_ARGS__, __darwin_obsz0 (dest))
                                                            ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/secure/_common.h:38:63: note: expanded from macro '__darwin_obsz0'
#define __darwin_obsz0(object) __builtin_object_size (object, 0)
                                                              ^
cpp/unix.c:96:1: error: expected ')'
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/secure/_string.h:69:47: note: expanded from macro 'memmove'
                __builtin___memmove_chk (dest, __VA_ARGS__, __darwin_obsz0 (dest))
                                                            ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/secure/_common.h:38:63: note: expanded from macro '__darwin_obsz0'
#define __darwin_obsz0(object) __builtin_object_size (object, 0)
                                                              ^
cpp/unix.c:96:1: note: to match this '('
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/secure/_string.h:69:47: note: expanded from macro 'memmove'
                __builtin___memmove_chk (dest, __VA_ARGS__, __darwin_obsz0 (dest))
                                                            ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/secure/_common.h:38:54: note: expanded from macro '__darwin_obsz0'
#define __darwin_obsz0(object) __builtin_object_size (object, 0)
                                                     ^
cpp/unix.c:96:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
memmove(void *dp, const void *sp, size_t n)
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/secure/_string.h:69:47: note: expanded from macro 'memmove'
                __builtin___memmove_chk (dest, __VA_ARGS__, __darwin_obsz0 (dest))
                                                            ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/secure/_common.h:38:32: note: expanded from macro '__darwin_obsz0'
#define __darwin_obsz0(object) __builtin_object_size (object, 0)
                               ^
cpp/unix.c:96:1: error: conflicting types for '__builtin___memmove_chk'
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/secure/_string.h:69:3: note: expanded from macro 'memmove'
                __builtin___memmove_chk (dest, __VA_ARGS__, __darwin_obsz0 (dest))
                ^
cpp/unix.c:96:1: note: '__builtin___memmove_chk' is a builtin with type 'void *(void *, const void *, unsigned long, unsigned long)'
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/secure/_string.h:69:3: note: expanded from macro 'memmove'
                __builtin___memmove_chk (dest, __VA_ARGS__, __darwin_obsz0 (dest))
                ^
cpp/unix.c:96:1: error: definition of builtin function '__builtin___memmove_chk'
memmove(void *dp, const void *sp, size_t n)
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/secure/_string.h:69:3: note: expanded from macro 'memmove'
                __builtin___memmove_chk (dest, __VA_ARGS__, __darwin_obsz0 (dest))
                ^
1 warning and 4 errors generated.
make: *** [out/unix.o] Error 1

macOS uses a specialized version of LLVM Clang:

$ cc --version
Apple LLVM version 10.0.0 (clang-1000.11.45.5)
Target: x86_64-apple-darwin18.2.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Kind regards,

Ingwie.

@kulp
Copy link

kulp commented Feb 24, 2019

I had LCC working on macOS -- I think you need something like this commit : kulp@7de571b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants