Hi everyone,
I am currently trying ti build Slicer on Ubuntu 18.
The superbuild fails on compiling libarchive :
In function ‘pack_native’:
/home/edern/Projects/Slicer-build/LibArchive/libarchive/archive_pack_dev.c:111:13: error: In the GNU C Library, "makedev" is defined
by <sys/sysmacros.h>. For historical compatibility, it is
currently defined by <sys/types.h> as well, but we plan to
remove this soon. To use "makedev", include <sys/sysmacros.h>
directly. If you did not intend to use a system-defined macro
"makedev", you should undefine it after including <sys/types.h>. [-Werror]
dev = apd_makedev(numbers[0], numbers[1]);
I have the same error with “major” and “minor”. I am using gcc 7.3.
Any pointer on why that could happen ? Maybe it has nothing to to with Slicer’s configuration …
brhoom
(ibr_ex@yahoo.com)
June 18, 2018, 4:23pm
2
Hi and welcome to Slicer,
I just built Slicer 8.4.1 in Ubuntu 18.04. Here are the steps:
First install required tools and Qt:
sudo apt -y update && sudo apt -y upgrade && sudo apt install unzip wget subversion git-core git-svn make gcc g++ libx11-dev libxt-dev libgl1-mesa-dev libglu1-mesa-dev libfontconfig-dev libxrender-dev libncurses5-dev curl libssl-dev cmake
sudo apt -y install qt4-dev-tools libqt4-dev libqtcore4 libqtgui4 libqtwebkit-dev
Get the sorce
svn co http://svn.slicer.org/Slicer4/branches/Slicer-4-8 Destination_source_folder -r 26813
Configure and build Slicer
cmake -DCMAKE_BUILD_TYPE=Release Destination_build_folder && make
I only had a problem building DCMTK so I had to changed the Slicer_Source/CmakeLists.txt File at line 18 and add:
set (CMAKE_CXX_STANDARD 11)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
Good luck!
ihnorton
(Isaiah Norton)
June 18, 2018, 5:06pm
3
I believe the following simple patch will fix this, but I don’t have a way to test right now:
diff --git a/libarchive/archive_entry.c b/libarchive/archive_entry.c
index 30fb4566..50f3a04f 100644
--- a/libarchive/archive_entry.c
+++ b/libarchive/archive_entry.c
@@ -30,9 +30,6 @@ __FBSDID("$FreeBSD: head/lib/libarchive/archive_entry.c 201096 2009-12-28 02:41:
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
#if MAJOR_IN_MKDEV
#include <sys/mkdev.h>
#define HAVE_MAJOR
@@ -40,6 +37,9 @@ __FBSDID("$FreeBSD: head/lib/libarchive/archive_entry.c 201096 2009-12-28 02:41:
#include <sys/sysmacros.h>
#define HAVE_MAJOR
#endif
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
#ifdef HAVE_ERRNO_H
#include <errno.h>
#endif
@@ -204,7 +204,7 @@ archive_entry_clone(struct archive_entry *entry)
/* Copy encryption status */
entry2->encryption = entry->encryption;
-
+
/* Copy ACL data over. */
archive_acl_copy(&entry2->acl, &entry->acl);
diff --git a/libarchive/archive_pack_dev.c b/libarchive/archive_pack_dev.c
index 238cb85a..90ed5117 100644
--- a/libarchive/archive_pack_dev.c
+++ b/libarchive/archive_pack_dev.c
@@ -51,9 +51,6 @@ __RCSID("$NetBSD$");
#ifdef HAVE_STRING_H
#include <string.h>
#endif
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
#if MAJOR_IN_MKDEV
#include <sys/mkdev.h>
#define HAVE_MAJOR
@@ -61,6 +58,9 @@ __RCSID("$NetBSD$");
#include <sys/sysmacros.h>
#define HAVE_MAJOR
#endif
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
1 Like
I am following nearly these steps except the first time I was following this recommendation :https://www.slicer.org/wiki/Documentation/Labs/Qt5-and-VTK8
on top of the “default” ones : https://www.slicer.org/wiki/Documentation/Nightly/Developers/Build_Instructions
Also I was building with ninja and for Debug. I started over again, this time with make. I will tell you how it goes.
Thanks !
Yep I am confirming still the same error. I will try the fix of @ihnorton
Update : Got the same problem building ITK alone. Fixed it by switching from gcc 7.3 to 6.4.
tavaughan
(Thomas Vaughan)
July 9, 2018, 8:13pm
6
I’m getting the above problem. I tried both @ihnorton ’s fix above and switching from gcc 7.3 to gcc 6.4, but neither of these worked for me. The command I’m running is:
cd S4D
cmake \
-G "Unix Makefiles" \
-DCMAKE_C_COMPILER=gcc-6 \
-DQt5_DIR=/media/vaughan/workspace/lnx/devel/Support/qt-everywhere-build-5.10.0/lib/cmake/Qt5 \
-DCMAKE_BUILD_TYPE:STRING=Debug \
-DCMAKE_PREFIX_PATH:PATH=/media/vaughan/workspace/lnx/devel/Support/qt-everywhere-build-5.10.0/bin/ \
-DSlicer_USE_PYTHONQT_WITH_TCL:BOOL=OFF \
-DSlicer_USE_SimpleITK:BOOL=OFF \
-DSlicer_USE_QtTesting:BOOL=OFF \
-DSlicer_VTK_VERSION_MAJOR:STRING=9 \
-DSlicer_VTK_RENDERING_BACKEND:STRING=OpenGL2 \
-DSlicer_BUILD_DataStore:BOOL=OFF \
../S4
make -j7
I’m on Ubuntu 18.04 and I’m trying to build the master branch
tavaughan
(Thomas Vaughan)
July 9, 2018, 8:42pm
7
Well I got it to compile past that point by following the instruction in the error message, but I’m not convinced this is the right way to deal with the issue.
diff --git a/libarchive/archive_entry.c b/libarchive/archive_entry.c
index 30fb4566..9e74a331 100644
--- a/libarchive/archive_entry.c
+++ b/libarchive/archive_entry.c
@@ -32,6 +32,9 @@ __FBSDID("$FreeBSD: head/lib/libarchive/archive_entry.c 201096 2009-12-28 02:41:
#endif
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
+#undef makedev
+#undef major
+#undef minor
#endif
#if MAJOR_IN_MKDEV
#include <sys/mkdev.h>
diff --git a/libarchive/archive_pack_dev.c b/libarchive/archive_pack_dev.c
index 098881b6..55937f70 100644
--- a/libarchive/archive_pack_dev.c
+++ b/libarchive/archive_pack_dev.c
@@ -53,6 +53,9 @@ __RCSID("$NetBSD$");
#endif
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
+#undef makedev
+#undef major
+#undef minor
#endif
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
I am running into the same problem. @tavaughan ’s solution does seem to work for me, but are there any updates on a “proper” fix?
jcfr
(Jean Christophe Fillion Robin (Kitware))
October 1, 2018, 3:13pm
9
@phcerdan Since you are building using a recent gcc, would you have any suggestions ?
phcerdan
(Pablo Hernandez-Cerdan)
October 1, 2018, 3:38pm
10
There is an open issue in libarchive about this: https://github.com/libarchive/libarchive/issues/974
The fix would be to add the header in libarchive/archive_pack_dev.c
.
#include <sys/sysmacros.h>
I am not hitting the warning with gcc 8 in archlinux though.
pieper
(Steve Pieper (Isomics, Inc.))
August 22, 2019, 8:43pm
11
Building Slicer on ubuntu 18.04 and hit the same error. Updating to v3.4.0 from the upstream libarchive fixes the problem there (the issue mentioned by @phcerdan has been fixed ).
@jcfr do you want to rebase any slicer-specific patches on top of the latest libarchive release? Or we could cherrypick this fix into our fork, which might be safer in the short run.