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

Change macos macro to avoid conflict with system defined macro #669

wants to merge 1 commit into from


Copy link

@jborean93 jborean93 commented May 30, 2020

It seems like on recent builds of macOS (I think since 10.12) some of the system headers have defined the macos macro which conflicts with the -Dmacos macro we define when calling clang. This PR changes the macos macro used by omi to is_macos to avoid this conflict.

Before the PR running ./configure would fail with

*** Update build process to include omi.version from superproject! ***
checking whether pkg-config command is on the path... yes
created /Users/jborean/dev/omi/Unix/output
checking whether C compiler is on the path... yes
checking whether C compiler compiles... yes
checking whether C program executes... yes
checking for __FUNCTION__ macro or reserved word... yes
checking for __builtin_ctz... no
checking for __builtin_prefetch... yes
checking for sched_getcpu... no
checking for wcstoll... no
checking for wcsdup... no
checking for wcscasecmp, wcsncasecmp... no
checking for vswscanf... no
checking for va_copy... no
checking for backtrace... no
checking for __sync_synchronize... yes
checking for Atomic Intrinsic Functions... no
checking for sem_timedwait... no
checking for strerror_r... yes
checking for pthread_rwlock_t... no

That's because it's trying to compile and run the following code

cat > /tmp/pthread_rwlock_t_func.c <<EOF
#include <pthread.h>
int main()
    pthread_rwlock_t lock = PTHREAD_RWLOCK_INITIALIZER;
    return 0;

clang -g -O2 -Wall -I/usr/local/include -Dmacos -fvisibility=hidden -fstack-protector-all -DGSS_USE_IOV=1 -o /tmp/pthread_rwlock_t_func /tmp/pthread_rwlock_t_func.c

This fails with multiple errors of the following

In file included from /tmp/pthread_rwlock_t_func.c:1:
In file included from /Applications/
In file included from /Applications/
/Applications/ error: expected ','
                        __QOS_CLASS_AVAILABLE(macos(10.10), ios(8.0)) = 0x21,
/Applications/ note: expanded from macro

After this change I am able to compile and build OMI on my macOS host. I'm mostly doing this so I have a libmi.dylib that is linked to OpenSSL 1.1 and not 1.0 that comes with PowerShell. If you wish to change the macro to another name, happy to change it to whatever you suggest.

Copy link

JumpingYang001 commented Jul 15, 2020

thanks for PR! but omi has dropped powershell and mac support on 2018, and it is only used by SCOM and OMS/LAD now.

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

Successfully merging this pull request may close these issues.

None yet

2 participants