DICOM @ OFFIS

Discussion Forum for OFFIS DICOM Tools - For registration, send email with desired user name to the OFFIS DICOM team
It is currently Fri, 2018-04-27, 09:43

All times are UTC + 1 hour




Post new topic Reply to topic  [ 9 posts ] 
Author Message
PostPosted: Tue, 2016-11-08, 19:48 
Offline

Joined: Tue, 2016-11-08, 13:18
Posts: 18
Setting CMake variable DCMTK_USE_CXX11_STL is triggering FTBFS compiling recent commits on Arch Linux.

Problem is affecting 7872b1c and snapshot 3.6.1_20161102 but didn't affect e. g. 2b6c548 or snapshot 3.6.1_20160630 when these were the most recent versions of branch master and snapshot respectively.
I do not know whether this option is still meant to work in the first place or was deprecated in the meantime. If so the CMake output should be modified as it states
Quote:
Info: Your compiler supports C++11. You may enable C++11 features via "DCMTK_USE_CXX11_STL" to create a C++11 build of DCMTK."
when the variable is not set on a system providing the necessary prerequisites.

Output of make when failing reads
Code:
/usr/local/peter/Tests/DCMTK/Projekt/dcmtk/ofstd/include/dcmtk/ofstd/ofvriant.h:63:5: error: body of constexpr function 'static constexpr std::size_t OFvariant_traits<Index, Alternative0, Alternatives ...>::alignment() [with long unsigned int Index = 2ul; Alternative0 = bool; Alternatives = {}; std::size_t = long unsigned int]' not a return-statement
                }
                ^
/usr/local/peter/Tests/DCMTK/Projekt/dcmtk/ofstd/include/dcmtk/ofstd/ofvriant.h: In instantiation of 'struct OFvariant_traits<Index, Alternative0, Alternatives ...>::alignment() [with long unsigned int Index = 1ul; Alternative0 = float; Alternatives = {bool}; std::size_t = long unsigned int]::test':
/usr/local/peter/Tests/DCMTK/Projekt/dcmtk/ofstd/include/dcmtk/ofstd/ofvriant.h:61:108:   required from 'static constexpr std::size_t OFvariant_traits<Index, Alternative0, Alternatives ...>::alignment() [with long unsigned int Index = 1ul; Alternative0 = float; Alternatives = {bool}; std::size_t = long unsigned int]'
/usr/local/peter/Tests/DCMTK/Projekt/dcmtk/ofstd/include/dcmtk/ofstd/ofvriant.h:61:83:   required from 'struct OFvariant_traits<Index, Alternative0, Alternatives ...>::alignment() [with long unsigned int Index = 0ul; Alternative0 = int; Alternatives = {float, bool}; std::size_t = long unsigned int]::test'
/usr/local/peter/Tests/DCMTK/Projekt/dcmtk/ofstd/include/dcmtk/ofstd/ofvriant.h:61:108:   required from 'static constexpr std::size_t OFvariant_traits<Index, Alternative0, Alternatives ...>::alignment() [with long unsigned int Index = 0ul; Alternative0 = int; Alternatives = {float, bool}; std::size_t = long unsigned int]'
/usr/local/peter/Tests/DCMTK/Projekt/dcmtk/ofstd/include/dcmtk/ofstd/ofvriant.h:316:30:   required from 'class OFvariant<int, float, bool>'
/usr/local/peter/Tests/DCMTK/Projekt/dcmtk/ofstd/tests/tvariant.cc:60:33:   required from here
/usr/local/peter/Tests/DCMTK/Projekt/dcmtk/ofstd/include/dcmtk/ofstd/ofvriant.h:61:105: error: requested alignment is not an integer constant
         struct test { alignas(OFvariant_traits<Index+1,Alternatives...>::alignment()) first_alternative a; };
                                                                                                        ^
/usr/local/peter/Tests/DCMTK/Projekt/dcmtk/ofstd/include/dcmtk/ofstd/ofvriant.h: In instantiation of 'static constexpr std::size_t OFvariant_traits<Index, Alternative0, Alternatives ...>::alignment() [with long unsigned int Index = 1ul; Alternative0 = float; Alternatives = {bool}; std::size_t = long unsigned int]':
/usr/local/peter/Tests/DCMTK/Projekt/dcmtk/ofstd/include/dcmtk/ofstd/ofvriant.h:61:83:   required from 'struct OFvariant_traits<Index, Alternative0, Alternatives ...>::alignment() [with long unsigned int Index = 0ul; Alternative0 = int; Alternatives = {float, bool}; std::size_t = long unsigned int]::test'
/usr/local/peter/Tests/DCMTK/Projekt/dcmtk/ofstd/include/dcmtk/ofstd/ofvriant.h:61:108:   required from 'static constexpr std::size_t OFvariant_traits<Index, Alternative0, Alternatives ...>::alignment() [with long unsigned int Index = 0ul; Alternative0 = int; Alternatives = {float, bool}; std::size_t = long unsigned int]'
/usr/local/peter/Tests/DCMTK/Projekt/dcmtk/ofstd/include/dcmtk/ofstd/ofvriant.h:316:30:   required from 'class OFvariant<int, float, bool>'
/usr/local/peter/Tests/DCMTK/Projekt/dcmtk/ofstd/tests/tvariant.cc:60:33:   required from here
/usr/local/peter/Tests/DCMTK/Projekt/dcmtk/ofstd/include/dcmtk/ofstd/ofvriant.h:63:5: error: body of constexpr function 'static constexpr std::size_t OFvariant_traits<Index, Alternative0, Alternatives ...>::alignment() [with long unsigned int Index = 1ul; Alternative0 = float; Alternatives = {bool}; std::size_t = long unsigned int]' not a return-statement
                }
                ^
/usr/local/peter/Tests/DCMTK/Projekt/dcmtk/ofstd/include/dcmtk/ofstd/ofvriant.h: In instantiation of 'struct OFvariant_traits<Index, Alternative0, Alternatives ...>::alignment() [with long unsigned int Index = 0ul; Alternative0 = int; Alternatives = {float, bool}; std::size_t = long unsigned int]::test':
/usr/local/peter/Tests/DCMTK/Projekt/dcmtk/ofstd/include/dcmtk/ofstd/ofvriant.h:61:108:   required from 'static constexpr std::size_t OFvariant_traits<Index, Alternative0, Alternatives ...>::alignment() [with long unsigned int Index = 0ul; Alternative0 = int; Alternatives = {float, bool}; std::size_t = long unsigned int]'
/usr/local/peter/Tests/DCMTK/Projekt/dcmtk/ofstd/include/dcmtk/ofstd/ofvriant.h:316:30:   required from 'class OFvariant<int, float, bool>'
/usr/local/peter/Tests/DCMTK/Projekt/dcmtk/ofstd/tests/tvariant.cc:60:33:   required from here
/usr/local/peter/Tests/DCMTK/Projekt/dcmtk/ofstd/include/dcmtk/ofstd/ofvriant.h:61:105: error: requested alignment is not an integer constant
         struct test { alignas(OFvariant_traits<Index+1,Alternatives...>::alignment()) first_alternative a; };
                                                                                                    ^
/usr/local/peter/Tests/DCMTK/Projekt/dcmtk/ofstd/include/dcmtk/ofstd/ofvriant.h: In instantiation of 'static constexpr std::size_t OFvariant_traits<Index, Alternative0, Alternatives ...>::alignment() [with long unsigned int Index = 0ul; Alternative0 = int; Alternatives = {float, bool}; std::size_t = long unsigned int]':
/usr/local/peter/Tests/DCMTK/Projekt/dcmtk/ofstd/include/dcmtk/ofstd/ofvriant.h:316:30:   required from 'class OFvariant<int, float, bool>'
/usr/local/peter/Tests/DCMTK/Projekt/dcmtk/ofstd/tests/tvariant.cc:60:33:   required from here
/usr/local/peter/Tests/DCMTK/Projekt/dcmtk/ofstd/include/dcmtk/ofstd/ofvriant.h:63:5: error: body of constexpr function 'static constexpr std::size_t OFvariant_traits<Index, Alternative0, Alternatives ...>::alignment() [with long unsigned int Index = 0ul; Alternative0 = int; Alternatives = {float, bool}; std::size_t = long unsigned int]' not a return-statement
                   }
                   ^
In file included from /usr/local/peter/Tests/DCMTK/Projekt/dcmtk/ofstd/tests/tvariant.cc:5:0:
/usr/local/peter/Tests/DCMTK/Projekt/dcmtk/ofstd/include/dcmtk/ofstd/ofvriant.h: In instantiation of 'class OFvariant<int, float, bool>':
/usr/local/peter/Tests/DCMTK/Projekt/dcmtk/ofstd/tests/tvariant.cc:60:33:   required from here
/usr/local/peter/Tests/DCMTK/Projekt/dcmtk/ofstd/include/dcmtk/ofstd/ofvriant.h:316:71: error: requested alignment is not an integer constant
     alignas(traits::alignment()) std::uint8_t m_Content[traits::size()];
                                                                      ^
make[2]: *** [ofstd/tests/CMakeFiles/ofstd_tests.dir/build.make:567: ofstd/tests/CMakeFiles/ofstd_tests.dir/tvariant.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:369: ofstd/tests/CMakeFiles/ofstd_tests.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 25%] Building CXX object oflog/libsrc/CMakeFiles/oflog.dir/cygwin32.cc.o
[ 25%] Building CXX object oflog/libsrc/CMakeFiles/oflog.dir/striconv.cc.o
[ 25%] Building CXX object oflog/libsrc/CMakeFiles/oflog.dir/strcloc.cc.o
[ 25%] Building CXX object oflog/libsrc/CMakeFiles/oflog.dir/strccloc.cc.o
[ 25%] Building CXX object oflog/libsrc/CMakeFiles/oflog.dir/unixsock.cc.o
[ 25%] Linking CXX static library ../../lib/liboflog.a
[ 25%] Built target oflog
make: *** [Makefile:139: all] Error 2


Top
 Profile  
 
PostPosted: Wed, 2016-11-09, 11:37 
Offline
DCMTK Developer

Joined: Fri, 2004-11-05, 13:47
Posts: 1667
Location: Oldenburg, Germany
Hi,

C++11 support was meant to work, so this is clearly a bug that we also found (too late). It will be resolved in the future.

Thank you for the report,
Michael


Top
 Profile  
 
PostPosted: Thu, 2016-11-10, 11:10 
Offline
OFFIS DICOM Team
OFFIS DICOM Team

Joined: Mon, 2014-03-03, 09:51
Posts: 231
Location: Oldenburg, Germany
As Michael stated, this seems to be a bug. These guys seem to have found the same one using clang, which gave some better error messages. To my understanding it is simply the case that I cannot define a struct inside a constexpr function prior to C++14 and the rest are probably consequential errors. I simply didn't know that and my compiler forgave me during all tests (which is strange since I'm also on Arch Linux, but who knows).

EDIT: it seems I didn't remember it correctly and only tested it with GCC-4.9.2 on our debian server. My Arch Linux gave me exaclty the same errors than yours. I have just pushed a fix for those problems to our internal testing branch, it will be provided tomorrow if it passes our nightly builds.


Top
 Profile  
 
PostPosted: Fri, 2016-11-11, 10:29 
Offline
OFFIS DICOM Team
OFFIS DICOM Team

Joined: Mon, 2014-03-03, 09:51
Posts: 231
Location: Oldenburg, Germany
The fix is live, see commit #b7b5503b8e


Top
 Profile  
 
PostPosted: Fri, 2016-11-11, 13:12 
Offline

Joined: Tue, 2016-11-08, 13:18
Posts: 18
Confirming the problem can no longer be seen as of b7b5503.

The fix does introduce some new warnings like
Code:
/usr/local/peter/Tests/DCMTK/ArchLinux/dcmtk-git/src/dcmtk/ofstd/tests/tlimits.cc:61:63: warning: integer overflow in expression [-Woverflow]
         OFCHECK( OFstatic_cast( T, OFnumeric_limits<T>::max() + 1 ) == OFnumeric_limits<T>::min() );
/usr/local/peter/Tests/DCMTK/ArchLinux/dcmtk-git/src/dcmtk/ofstd/include/dcmtk/ofstd/oftest.h:483:15: note: in definition of macro 'OFCHECK'
         if (!(condition)) \
               ^~~~~~~~~

/usr/local/peter/Tests/DCMTK/ArchLinux/dcmtk-git/src/dcmtk/ofstd/tests/tlimits.cc:61:18: note: in expansion of macro 'OFstatic_cast'
         OFCHECK( OFstatic_cast( T, OFnumeric_limits<T>::max() + 1 ) == OFnumeric_limits<T>::min() );
                  ^~~~~~~~~~~~~
seen compiling b7b5503 or dd23149 on Arch Linux.


Top
 Profile  
 
PostPosted: Fri, 2016-11-11, 13:17 
Offline
OFFIS DICOM Team
OFFIS DICOM Team

Joined: Mon, 2014-03-03, 09:51
Posts: 231
Location: Oldenburg, Germany
Thanks for confirming!

The warnings aren't new and also they can't be removed (potentially disabled at the scope via #pragma) since that is what is being tested there - how the compilier behaves regarding integer overflow and if it fits what is expected by the numeric limits.


Top
 Profile  
 
PostPosted: Fri, 2016-11-18, 16:31 
Offline
OFFIS DICOM Team
OFFIS DICOM Team

Joined: Mon, 2014-03-03, 09:51
Posts: 231
Location: Oldenburg, Germany
I was able to suppress the warnings, see commit #8a79ba83b


Top
 Profile  
 
PostPosted: Tue, 2016-11-22, 01:13 
Offline

Joined: Tue, 2016-11-08, 13:18
Posts: 18
Confirming the said warnings are gone both in 8a79ba8 and 0bf28e1.

FWIW in both commits warnings like the following can be seen
Code:
[ 21%] Building CXX object ofstd/tests/CMakeFiles/ofstd_tests.dir/tstring.cc.o
/usr/local/peter/Tests/DCMTK/Projekt/dcmtk/oflog/libsrc/hierlock.cc: In destructor ‘dcmtk::log4cplus::HierarchyLocker::~HierarchyLocker()’:
/usr/local/peter/Tests/DCMTK/Projekt/dcmtk/oflog/libsrc/hierlock.cc:75:9: warning: throw will always call terminate() [-Wterminate]
         throw;
         ^~~~~
/usr/local/peter/Tests/DCMTK/Projekt/dcmtk/oflog/libsrc/hierlock.cc:75:9: note: in C++11 destructors default to noexcept
[ 21%] Building CXX object oflog/libsrc/CMakeFiles/oflog.dir/layout.cc.o
[...]
[ 68%] Building CXX object dcmrt/libsrc/CMakeFiles/dcmrt.dir/drtrpcs.cc.o
/usr/local/peter/Tests/DCMTK/Projekt/dcmtk/dcmwlm/libsrc/wlfsim.cc: In member function ‘void WlmFileSystemInteractionManager::DetermineWorklistFiles(OFVector<OFString>&)’:
/usr/local/peter/Tests/DCMTK/Projekt/dcmtk/dcmwlm/libsrc/wlfsim.cc:485:27: warning: ‘int readdir_r(DIR*, dirent*, dirent**)’ is deprecated [-Wdeprecated-declarations]
     for( int readResult = readdir_r( dirp, (struct dirent *)entryBuffer, &dp ) ; readResult == 0 && dp ; readResult = readdir_r( dirp, (struct dirent *)entryBuffer, &dp ) )
                           ^~~~~~~~~
In file included from /usr/include/features.h:368:0,
                 from /usr/include/c++/6.2.1/x86_64-pc-linux-gnu/bits/os_defines.h:39,
                 from /usr/include/c++/6.2.1/x86_64-pc-linux-gnu/bits/c++config.h:495,
                 from /usr/include/c++/6.2.1/climits:41,
                 from /usr/local/peter/Tests/DCMTK/Projekt/dcmtk/ofstd/include/dcmtk/ofstd/ofstdinc.h:197,
                 from /usr/local/peter/Tests/DCMTK/Projekt/dcmtk/dcmwlm/libsrc/wlfsim.cc:27:
/usr/include/dirent.h:189:12: note: declared here
 extern int __REDIRECT (readdir_r,
            ^
/usr/local/peter/Tests/DCMTK/Projekt/dcmtk/dcmwlm/libsrc/wlfsim.cc:485:78: warning: ‘int readdir_r(DIR*, dirent*, dirent**)’ is deprecated [-Wdeprecated-declarations]
     for( int readResult = readdir_r( dirp, (struct dirent *)entryBuffer, &dp ) ; readResult == 0 && dp ; readResult = readdir_r( dirp, (struct dirent *)entryBuffer, &dp ) )
                                                                              ^
In file included from /usr/include/features.h:368:0,
                 from /usr/include/c++/6.2.1/x86_64-pc-linux-gnu/bits/os_defines.h:39,
                 from /usr/include/c++/6.2.1/x86_64-pc-linux-gnu/bits/c++config.h:495,
                 from /usr/include/c++/6.2.1/climits:41,
                 from /usr/local/peter/Tests/DCMTK/Projekt/dcmtk/ofstd/include/dcmtk/ofstd/ofstdinc.h:197,
                 from /usr/local/peter/Tests/DCMTK/Projekt/dcmtk/dcmwlm/libsrc/wlfsim.cc:27:
/usr/include/dirent.h:189:12: note: declared here
 extern int __REDIRECT (readdir_r,
            ^
/usr/local/peter/Tests/DCMTK/Projekt/dcmtk/dcmwlm/libsrc/wlfsim.cc:485:119: warning: ‘int readdir_r(DIR*, dirent*, dirent**)’ is deprecated [-Wdeprecated-declarations]
     for( int readResult = readdir_r( dirp, (struct dirent *)entryBuffer, &dp ) ; readResult == 0 && dp ; readResult = readdir_r( dirp, (struct dirent *)entryBuffer, &dp ) )
                                                                                                                       ^~~~~~~~~
In file included from /usr/include/features.h:368:0,
                 from /usr/include/c++/6.2.1/x86_64-pc-linux-gnu/bits/os_defines.h:39,
                 from /usr/include/c++/6.2.1/x86_64-pc-linux-gnu/bits/c++config.h:495,
                 from /usr/include/c++/6.2.1/climits:41,
                 from /usr/local/peter/Tests/DCMTK/Projekt/dcmtk/ofstd/include/dcmtk/ofstd/ofstdinc.h:197,
                 from /usr/local/peter/Tests/DCMTK/Projekt/dcmtk/dcmwlm/libsrc/wlfsim.cc:27:
/usr/include/dirent.h:189:12: note: declared here
 extern int __REDIRECT (readdir_r,
            ^
/usr/local/peter/Tests/DCMTK/Projekt/dcmtk/dcmwlm/libsrc/wlfsim.cc:485:170: warning: ‘int readdir_r(DIR*, dirent*, dirent**)’ is deprecated [-Wdeprecated-declarations]
     for( int readResult = readdir_r( dirp, (struct dirent *)entryBuffer, &dp ) ; readResult == 0 && dp ; readResult = readdir_r( dirp, (struct dirent *)entryBuffer, &dp ) )
                                                                                                                                                                          ^
In file included from /usr/include/features.h:368:0,
                 from /usr/include/c++/6.2.1/x86_64-pc-linux-gnu/bits/os_defines.h:39,
                 from /usr/include/c++/6.2.1/x86_64-pc-linux-gnu/bits/c++config.h:495,
                 from /usr/include/c++/6.2.1/climits:41,
                 from /usr/local/peter/Tests/DCMTK/Projekt/dcmtk/ofstd/include/dcmtk/ofstd/ofstdinc.h:197,
                 from /usr/local/peter/Tests/DCMTK/Projekt/dcmtk/dcmwlm/libsrc/wlfsim.cc:27:
/usr/include/dirent.h:189:12: note: declared here
 extern int __REDIRECT (readdir_r,
            ^
[ 68%] Building CXX object dcmrt/libsrc/CMakeFiles/dcmrt.dir/drtrpis.cc.o
I figure these don't indicate any real problem right now but may be worth having a look at as they may turn into some in the future.


Top
 Profile  
 
PostPosted: Tue, 2016-11-22, 09:32 
Offline
OFFIS DICOM Team
OFFIS DICOM Team

Joined: Mon, 2014-03-03, 09:51
Posts: 231
Location: Oldenburg, Germany
As far as I know readdir_r is the reentrant alternative of readdir, which shall be used if it is available. We have a configure test for it, but it is not used in the code that leads to the warning. Reading here it seems that readdir_r was deprecated since readdir has become reentrant and readdir_r is therefore no longer needed. This will most likely not lead to problems if the configure test was used, since, even if readdir_r is removed in the future, our configure test will just fail and readdir will be used instead. So I think we should just get rid of the duplicated code and use OFStandard::searchDirectoryRecursively() instead, which already honors the configuration test's result. Perhaps the configure test should also be made to fail if readdir_r is deprecated, something like running it with
Code:
-Werror=deprecated-declarations
.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: Google [Bot] and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group