View Issue Details

IDProjectCategoryView StatusLast Update
0004616Slicer4Core: Building (CMake, Superbuild)public2018-10-22 18:35
ReportertorquilAssigned Tojcfr 
PrioritynormalSeverityminorReproducibilityalways
Status confirmedResolutionopen 
PlatformLinuxOSDebianOS VersionSid
Product Version 
Target VersionSlicer 4.11.0Fixed in Version 
Summary0004616: Build error with GCC 8.2.0 within libarchive
Description

Hi!

I saw 0004558, and this seems very similar, but apparently not exactly the same since that one was supposedly fixed.

While attempting a Debug build of Slicer Git Master using GCC 8.2.0, I'm getting a build error within the compilation of libarchive:

[  1%] Building C object libarchive/CMakeFiles/archive_static.dir/archive_pack_dev.c.o
cd /home/torquil/src/upstream/slicer/Slicer-Superbuild-Debug/LibArchive-build/libarchive && /usr/bin/cc -DHAVE_CONFIG_H -DLIBARCHIVE_STATIC -I/home/torquil/src/upstream/slicer/Slicer-Superbuild-Debug/LibArchive/libarchive -I/home/torquil/src/upstream/slicer/Slicer-Superbuild-Debug/LibArchive-build -I/home/torquil/src/upstream/slicer/Slicer-Superbuild-Debug/zlib-install/include  -Wall -Wformat -Wformat-security -g -Werror -Wextra -Wunused -Wshadow -Wmissing-prototypes -Wcast-qual   -o CMakeFiles/archive_static.dir/archive_pack_dev.c.o   -c /home/torquil/src/upstream/slicer/Slicer-Superbuild-Debug/LibArchive/libarchive/archive_pack_dev.c
/home/torquil/src/upstream/slicer/Slicer-Superbuild-Debug/LibArchive/libarchive/archive_pack_dev.c: In function ‘pack_native’:
/home/torquil/src/upstream/slicer/Slicer-Superbuild-Debug/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]);
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                                                                                                                                                                                                                                                                                                                              
/home/torquil/src/upstream/slicer/Slicer-Superbuild-Debug/LibArchive/libarchive/archive_pack_dev.c:112:13: error: In the GNU C Library, "major" 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 "major", include <sys/sysmacros.h>
 directly. If you did not intend to use a system-defined macro
 "major", you should undefine it after including <sys/types.h>. [-Werror]
   if ((unsigned long)major(dev) != numbers[0])
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                                                                                                                                                                                                                                                                                                                      
/home/torquil/src/upstream/slicer/Slicer-Superbuild-Debug/LibArchive/libarchive/archive_pack_dev.c:114:13: error: In the GNU C Library, "minor" 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 "minor", include <sys/sysmacros.h>
 directly. If you did not intend to use a system-defined macro
 "minor", you should undefine it after including <sys/types.h>. [-Werror]
   else if ((unsigned long)minor(dev) != numbers[1])
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                                                                                                                                                                                                                                                                                                                 
cc1: all warnings being treated as errors
make[5]: *** [libarchive/CMakeFiles/archive_static.dir/build.make:271: libarchive/CMakeFiles/archive_static.dir/archive_pack_dev.c.o] Error 1
make[5]: Leaving directory '/home/torquil/src/upstream/slicer/Slicer-Superbuild-Debug/LibArchive-build'
make[4]: *** [CMakeFiles/Makefile2:95: libarchive/CMakeFiles/archive_static.dir/all] Error 2
make[4]: Leaving directory '/home/torquil/src/upstream/slicer/Slicer-Superbuild-Debug/LibArchive-build'
make[3]: *** [Makefile:130: all] Error 2
make[3]: Leaving directory '/home/torquil/src/upstream/slicer/Slicer-Superbuild-Debug/LibArchive-build'
make[2]: *** [CMakeFiles/LibArchive.dir/build.make:116: LibArchive-prefix/src/LibArchive-stamp/LibArchive-build] Error 2
make[2]: Leaving directory '/home/torquil/src/upstream/slicer/Slicer-Superbuild-Debug'
make[1]: *** [CMakeFiles/Makefile2:1805: CMakeFiles/LibArchive.dir/all] Error 2
make[1]: Leaving directory '/home/torquil/src/upstream/slicer/Slicer-Superbuild-Debug'
make: *** [Makefile:98: all] Error 2

I will try the workaround mentioned in 0004558 for now.

Steps To Reproduce

cmake -DCMAKE_VERBOSE_MAKEFILE:BOOL=1 -DCMAKE_BUILD_TYPE:STRING=$BUILDTYPE -DSlicer_USE_SYSTEM_QT:BOOL=1 -DSlicer_USE_SYSTEM_QT:BOOL=1 -DQt5_DIR:PATH=/usr/include/x86_64-linux-gnu/qt5 ../Slicer

make VERBOSE=1 -j1

Then wait for a long time.

Additional Information

My Slicer source has been changed to use Python 2.7.15 instead of 2.7.13 due to another bug, but I don't think that is causing this.

$ gcc --version
gcc (Debian 8.2.0-7) 8.2.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ g++ --version
g++ (Debian 8.2.0-7) 8.2.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ cmake --version
cmake version 3.12.1

CMake suite maintained and supported by Kitware (kitware.com/cmake).

TagsNo tags attached.

Relationships

related to 0004558 resolvedjcfr ExternalDependency libarchive generates error in Debug mode with gcc8.1 

Activities

pieper

pieper

2018-10-22 18:34

administrator   ~0016171

I ran into this same issue after upgrading a linux machine (to ubuntu 18.04) and rebuilding with gcc 7.30.

A hacky workaround is to replace sys/types.h with sys/sysmacros.h as indicated by the error message (patch below).

The real issue seems not to have been resolved although it is closed on the libarchve repository (the trail is difficult to read, but here's the issue: https://github.com/libarchive/libarchive/issues/236).

Patch to get past the error:

pieper@u:~/slicer4/latest/Slicer5-superbuild$ (cd LibArchive; git diff)
diff --git a/libarchive/archive_pack_dev.c b/libarchive/archive_pack_dev.c
index 098881b6..056df0d0 100644
--- a/libarchive/archive_pack_dev.c
+++ b/libarchive/archive_pack_dev.c
@@ -52,7 +52,8 @@ __RCSID("$NetBSD$");
#include <string.h>
#endif
#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
+//#include <sys/types.h>
+#include <sys/sysmacros.h>
#endif
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>

Issue History

Date Modified Username Field Change
2018-09-20 05:01 torquil New Issue
2018-09-20 05:01 torquil Status new => assigned
2018-09-20 05:01 torquil Assigned To => jcfr
2018-10-16 06:49 jcfr Description Updated View Revisions
2018-10-16 06:50 jcfr Target Version => Slicer 4.11.0
2018-10-22 18:34 pieper Status assigned => confirmed
2018-10-22 18:34 pieper Note Added: 0016171
2018-10-22 18:35 pieper Relationship added related to 0004558