question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

macOS compilation broken

See original GitHub issue

🐛 Bug

With Xcode versions 13.1 and 13.4 and using clang following the installation instructions fails to build dgl.

To Reproduce

mkdir build
cd build
cmake -DUSE_OPENMP=off -DCMAKE_C_FLAGS='-DXBYAK_DONT_USE_MAP_JIT' -DCMAKE_CXX_FLAGS='-DXBYAK_DONT_USE_MAP_JIT' -DUSE_AVX=OFF -DUSE_LIBXSMM=OFF ..
make -j4

generates the following error:

Consolidate compiler generated dependencies of target dgl
[ 55%] Building CXX object CMakeFiles/dgl.dir/src/runtime/shared_mem.cc.o
[ 56%] Building CXX object CMakeFiles/dgl.dir/src/runtime/semaphore_wrapper.cc.o
[ 57%] Building CXX object CMakeFiles/dgl.dir/src/runtime/tensordispatch.cc.o
[ 57%] Building CXX object CMakeFiles/dgl.dir/src/runtime/system_lib_module.cc.o
/Users/apalha/work/libs/dgl/src/runtime/semaphore_wrapper.cc:45:3: warning: 'sem_init' is deprecated [-Wdeprecated-declarations]
  sem_init(&sem_, 0, 0);
  ^
/Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/usr/include/sys/semaphore.h:55:42: note: 'sem_init' has been explicitly marked deprecated here
int sem_init(sem_t *, int, unsigned int) __deprecated;
                                         ^
/Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/usr/include/sys/cdefs.h:204:40: note: expanded from macro '__deprecated'
#define __deprecated    __attribute__((__deprecated__))
                                       ^
/Users/apalha/work/libs/dgl/src/runtime/semaphore_wrapper.cc:73:17: error: use of undeclared identifier 'sem_timedwait'
  while ((ret = sem_timedwait(&sem_, &ts) != 0) && errno == EINTR) {
                ^
1 warning and 1 error generated.
make[2]: *** [CMakeFiles/dgl.dir/src/runtime/semaphore_wrapper.cc.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/dgl.dir/all] Error 2
make: *** [all] Error 2

After inspection, commit cac3720b48dfe15fb3721d00624c2d18fec15680 introduced the changes that cause the compilation to fail. Tag 0.8.2 still works.

The reason for failing seems to be related to the use of sem_timedwait, which is no longer supported in macOS. See this thread for a discussion and possible solutions.

Expected behavior

Should build without errors.

Environment

  • DGL Version (e.g., 1.0): latest commit, but any commit after cac3720b48dfe15fb3721d00624c2d18fec15680 should also fail
  • Backend Library & Version (e.g., PyTorch 0.4.1, MXNet/Gluon 1.3): PyTorch
  • OS (e.g., Linux): macOS 12.2.1
  • How you installed DGL (conda, pip, source): source
  • Build command you used (if compiling from source): followd installation instructions
  • Python version: 3.8.13
  • CUDA/cuDNN version (if applicable): not applicable
  • GPU models and configuration (e.g. V100): not applicable
  • Any other relevant information: as mentioned above, tried this with Xcode version 13.1 and 13.4 and both give the same error, reverting to commit tagged 0.8.2 solved the issue.

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
RecLusIve-Fcommented, Jun 28, 2022

@apalha @RecLusIve-F please have a try with latest mater branch…

There are no more errors now, thank you very much.

1reaction
Rhett-Yingcommented, Jun 15, 2022

thanks for reporting this. I will work on it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

xcode - C++ compilation broken on OS X 10.9 - Stack Overflow
I just upgraded my Mac to Mavericks, and find that none of my C++ code will compile anymore. Everything fails with the following...
Read more >
libc++ list.h broken error Xcode 13.3 macOS Monterey 12.3.1
I'm using Xcode 13.3 (13E113) on macOS Monterey 12.3.1. The compilation with the Xcode command-line tool fails with these errors:
Read more >
Mac OS X Compilation broken - wine-devel@winehq.org
Hi! I am getting trouble on Mac OS X with a modification to WineBuild. Here is the patch I am refering to: http://cvs.winehq.com/patch.py?id=9949...
Read more >
7944 (compilation broken on macOS 10.12) - FFmpeg Wiki
Commit 98478c0 breaks compilation on macOS 10.12 as it uses kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange which was introduced in macOS 12.13.
Read more >
Is auto compilation of the standard library on Linux broken?
The first time this is done on macOS the compiler will use the .swiftinterface files and compile the standard library, outputting the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found