# MacOS Catalina 10.15.5 compilation error

**URL:** <https://discourse.slicer.org/t/macos-catalina-10-15-5-compilation-error/12807>\
**Category:** Development\
**Created:** [July 31, 2020, 3:08pm UTC](https://discourse.slicer.org/t/macos-catalina-10-15-5-compilation-error/12807 "2020-07-31T15:08:36Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![che85](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/che85/32/636_2.png) [@che85](https://discourse.slicer.org/u/che85)\
**Post date:** [July 31, 2020, 3:08pm UTC](https://discourse.slicer.org/t/macos-catalina-10-15-5-compilation-error/12807/1 "2020-07-31T15:08:36Z")

</div>

Hi everyone,

I am experiencing compilation errors.

```auto
herzc@54ee75c68e2e ~/D/S4D> /Library/Developer/CommandLineTools/usr/bin/gcc --version
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple clang version 11.0.3 (clang-1103.0.32.62)
Target: x86_64-apple-darwin19.5.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

```

cmake version 3.18.1

Here some preview of the error messages:

```auto
/usr/local/include/stdlib.h:141:26: error: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Werror,-Wnullability-completeness]
void *bsearch(const void * __key, const void *__ base, size_t __nel,
                            ^
/usr/local/include/stdlib.h:141:26: note: insert '_Nullable' if the pointer may be null
void *bsearch(const void * __key, const void *__ base, size_t __nel,
                            ^
                              _Nullable 
/usr/local/include/stdlib.h:141:26: note: insert '_Nonnull' if the pointer should never be null
void *bsearch(const void * __key, const void *__ base, size_t __nel,
                            ^
                              _Nonnull 
/usr/local/include/stdlib.h:141:45: error: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Werror,-Wnullability-completeness]
void *bsearch(const void * __key, const void *__ base, size_t __nel,
                                               ^
/usr/local/include/stdlib.h:141:45: note: insert '_Nullable' if the pointer may be null
void *bsearch(const void * __key, const void *__ base, size_t __nel,
                                               ^
                                                 _Nullable 
/usr/local/include/stdlib.h:141:45: note: insert '_Nonnull' if the pointer should never be null
void *bsearch(const void * __key, const void *__ base, size_t __nel,
                                               ^
                                                 _Nonnull 
fatal error: too many errors emitted, stopping now [-ferror-limit=]

```

I uploaded a gist here [https://gist.github.com/che85/9cec7d8e0b2a4ada61ff553e51f3c567](https://gist.github.com/che85/9cec7d8e0b2a4ada61ff553e51f3c567)

Does anyone know how to fix these issues? I haven’t seen any recent changes which could have affected the build process and even tried older versions.

---

<div class="post-metadata">

**Author:** ![che85](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/che85/32/636_2.png) [@che85](https://discourse.slicer.org/u/che85)\
**Post date:** [July 31, 2020, 3:26pm UTC](https://discourse.slicer.org/t/macos-catalina-10-15-5-compilation-error/12807/2 "2020-07-31T15:26:40Z")

</div>

I already removed XCode and reinstalled CommandLineTools, but nothing changed.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [July 31, 2020, 3:40pm UTC](https://discourse.slicer.org/t/macos-catalina-10-15-5-compilation-error/12807/3 "2020-07-31T15:40:14Z")

</div>

There were some libarchive related fixes réce tly that might not have made it into Slicer yet. @pieper can you confirm? Is there a quick fix?

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [July 31, 2020, 3:56pm UTC](https://discourse.slicer.org/t/macos-catalina-10-15-5-compilation-error/12807/4 "2020-07-31T15:56:36Z")

</div>

I don’t get these errors on my mac build. How do you configure?

This is what I did:

```auto
cmake \
	-DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 \
	Qt5_VERSION:STRING=5.15 \
	Qt5_DIR:PATH=/usr/local/Cellar/qt/5.15.0/lib/cmake/Qt5 \
	/Users/pieper/slicer/latest/Slicer

```

---

<div class="post-metadata">

**Author:** ![che85](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/che85/32/636_2.png) [@che85](https://discourse.slicer.org/u/che85)\
**Post date:** [July 31, 2020, 4:05pm UTC](https://discourse.slicer.org/t/macos-catalina-10-15-5-compilation-error/12807/5 "2020-07-31T16:05:48Z")

</div>

> [@pieper](#):
>
> ```auto
> cmake \
> -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 \
> Qt5_VERSION:STRING=5.15 \
> Qt5_DIR:PATH=/usr/local/Cellar/qt/5.15.0/lib/cmake/Qt5 \
> 
> ```

Similar to yours:

```auto
cmake \
-DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 \
-DQt5_VERSION:STRING=5.15 \
-DQt5_DIR:PATH=/usr/local/Cellar/qt/5.15.0/lib/cmake/Qt5 \
~/sources/cpp/Slicer

```

---

<div class="post-metadata">

**Author:** ![che85](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/che85/32/636_2.png) [@che85](https://discourse.slicer.org/u/che85)\
**Post date:** [July 31, 2020, 4:15pm UTC](https://discourse.slicer.org/t/macos-catalina-10-15-5-compilation-error/12807/6 "2020-07-31T16:15:20Z")

</div>

@pieper What are you getting when entering `ls -la /usr/local/include/stdlib.h`

```auto
herzc@54ee75c68e2e ~/s/c/l/bld> ls -la /usr/local/include/stdlib.h
lrwxr-xr-x 1 root admin 72 Jul 23 23:53 /usr/local/include/stdlib.h -> /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdlib.h

```

---

<div class="post-metadata">

**Author:** ![che85](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/che85/32/636_2.png) [@che85](https://discourse.slicer.org/u/che85)\
**Post date:** [July 31, 2020, 4:21pm UTC](https://discourse.slicer.org/t/macos-catalina-10-15-5-compilation-error/12807/7 "2020-07-31T16:21:53Z")

</div>

@pieper Do you have the same clang version?

---

<div class="post-metadata">

**Author:** ![che85](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/che85/32/636_2.png) [@che85](https://discourse.slicer.org/u/che85)\
**Post date:** [July 31, 2020, 4:50pm UTC](https://discourse.slicer.org/t/macos-catalina-10-15-5-compilation-error/12807/8 "2020-07-31T16:50:22Z")

</div>

I think there were some headerfiles messsed up on my mac. I think it’s working now. I removed all headerfiles from `/usr/local/include` that were pointing to `/Library/Developer/CommandLineTools`

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [July 31, 2020, 6:44pm UTC](https://discourse.slicer.org/t/macos-catalina-10-15-5-compilation-error/12807/9 "2020-07-31T18:44:29Z")

</div>

Glad it worked 👍

In case anyone looks in the future, I’ve got a brand new mac (like a week old) with the latest OS and Xcode and the build went smoothly.

```auto
% ls -la /usr/local/include/stdlib.h     
ls: /usr/local/include/stdlib.h: No such file or directory

```
