# CMake fails to build on Solaris 11.4 (x86)

**URL:** https://discourse.cmake.org/t/cmake-fails-to-build-on-solaris-11-4-x86/553
**Category:** Development
**Tags:** os:solaris
**Created:** [January 30, 2020, 11:56am UTC](https://discourse.cmake.org/t/cmake-fails-to-build-on-solaris-11-4-x86/553 "2020-01-30T11:56:29Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![dcleland](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/d/c37758/32.png) [@dcleland](https://discourse.cmake.org/u/dcleland)
#### Post date: [January 30, 2020, 11:56am UTC](https://discourse.cmake.org/t/cmake-fails-to-build-on-solaris-11-4-x86/553/1 "2020-01-30T11:56:30Z")

</div>

Hi,

Just started using cmake in the last couple of weeks on Windows and Linux, and now moving to Solaris 11.4 (x86). I have built and installed cmake a couple of times under Linux, but it fails to compile under Solaris. It gives a link error.

Undefined first referenced  
symbol in file  
makedev …/Utilities/cmlibarchive/libarchive/libcmlibarchive.a(archive\_pack\_dev.c.o)

Had a look at the source and I think I see what the problem is.

There is a section with a comment that starts ‘This is blatantly stolen from libarchive/archive\_entry.c’. And the code that follows is identical to the other file. However the includes at the top of the file, that setup various defines used by the code, are different.

I believe that

#ifdef HAVE\_SYS\_SYSMACROS\_H  
#include \<sys/sysmacros.h\>  
#endif

needs to become

#if MAJOR\_IN\_MKDEV  
#include \<sys/mkdev.h\>  
#define HAVE\_MAJOR  
#elif MAJOR\_IN\_SYSMACROS  
#include \<sys/sysmacros.h\>  
#define HAVE\_MAJOR  
#endif

So it matches the other file.

After making this change locally cmake builds successfully and works with my CMakeLists.txt files.

---

<div class="post-metadata">

### Author: ![brad.king](https://discourse.cmake.org/user_avatar/discourse.cmake.org/brad.king/32/11_2.png) [@brad.king](https://discourse.cmake.org/u/brad.king)
#### Post date: [January 30, 2020, 1:48pm UTC](https://discourse.cmake.org/t/cmake-fails-to-build-on-solaris-11-4-x86/553/2 "2020-01-30T13:48:49Z")

</div>

Thanks. We have nightly testing on Solaris 11.3 x86. Is this change something new needed for 11.4?

Please see [CONTRIBUTING.rst](https://gitlab.kitware.com/cmake/cmake/blob/master/CONTRIBUTING.rst) and submit a merge request with the proposed fix. Thanks!

---

<div class="post-metadata">

### Author: ![dcleland](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/d/c37758/32.png) [@dcleland](https://discourse.cmake.org/u/dcleland)
#### Post date: [January 30, 2020, 2:14pm UTC](https://discourse.cmake.org/t/cmake-fails-to-build-on-solaris-11-4-x86/553/3 "2020-01-30T14:14:46Z")

</div>

I cannot say if this is something new for Solaris 11.4 as I not really a Solaris user.

I was given the task of porting something to Solaris 11 (x86) three weeks ago, and the easiest way to get started was to download a pre-built VirtualBox image of Solaris 11.4 (x86) from Oracle.

Looks like I need to learn gitlab now if I want this fixed.

---

<div class="post-metadata">

### Author: ![brad.king](https://discourse.cmake.org/user_avatar/discourse.cmake.org/brad.king/32/11_2.png) [@brad.king](https://discourse.cmake.org/u/brad.king)
#### Post date: [January 30, 2020, 2:29pm UTC](https://discourse.cmake.org/t/cmake-fails-to-build-on-solaris-11-4-x86/553/4 "2020-01-30T14:29:25Z")

</div>

I’ve opened [CMake MR 4302](https://gitlab.kitware.com/cmake/cmake/merge_requests/4302) with the proposed fix.

---

<div class="post-metadata">

### Author: ![dcleland](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/d/c37758/32.png) [@dcleland](https://discourse.cmake.org/u/dcleland)
#### Post date: [January 30, 2020, 2:32pm UTC](https://discourse.cmake.org/t/cmake-fails-to-build-on-solaris-11-4-x86/553/5 "2020-01-30T14:32:25Z")

</div>

Thanks, I am trying to setup a gitlab account in case I find anything else.

---

<div class="post-metadata">

### Author: ![Dian\_Chai](https://discourse.cmake.org/user_avatar/discourse.cmake.org/dian_chai/32/2817_2.png) [@Dian\_Chai](https://discourse.cmake.org/u/Dian_Chai)
#### Post date: [October 9, 2022, 11:20am UTC](https://discourse.cmake.org/t/cmake-fails-to-build-on-solaris-11-4-x86/553/6 "2022-10-09T11:20:44Z")

</div>

Thank you very much for posting your solution here, you saved my day.
