CMake fails to build on Solaris 11.4 (x86)

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.

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

Please see CONTRIBUTING.rst and submit a merge request with the proposed fix. Thanks!

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.

I’ve opened CMake MR 4302 with the proposed fix.

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

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