Page MenuHomePhabricator | MITK

Build errors in MITK Utilities
Open, HighPublic

Description

When building MITK project with clang using ninja, errors are thrown such as:

Utilities/IpPic/ipPicDelT.c:52:25: error: initializing 'char *' with an expression of type 'const char [61]' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
  static char *what = { "@(#)mitkIpPicDelTag\t\tDKFZ (Dept. MBI)\t"__DATE__"\t$Revision$" };
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This occurs on both` Apple LLVM version 8.0.0` and Apple LLVM 9.0.0 on OSX10.11 and 10.13. Building the same source using xcodebuild works fine.

The full build log can be found here (macOS 10.13 Apple LLVM8):
http://sidt-hpc3/job/MC_ninja/build_type=Debug,matrixBuildNinja=macOS_13_Beta_XC8/40/console

Event Timeline

reicht created this task.Aug 25 2017, 8:56 AM

fixing approach, from

#ifndef lint
  static char *what = { "@(#)mitkIpPicDelTag\t\tDKFZ (Dept. MBI)\t"__DATE__"\t$Revision$" };
#endif

to

#ifndef lint
   static char *what = { "@(#)mitkIpPicDelTag\t\tDKFZ (Dept. MBI)\t"__DATE__"\t$Revision$" };
#endif

This then results in an error, that this variable is not used anymore. Therefore I would delete this code segment?

In File RegGrow.c this error is thrown:

Utilities/IpFunc/RegGrow.c:577: error: comparison of integers of different signs: 'mitkIpInt4_t' (aka 'int') and 'mitkIpUInt4_t' (aka 'unsigned int') [-Werror,-Wsign-compare]
  mitkIpPicFORALL_6 ( REGGROW, pic_old, pic_new, acpt, acpt_len,
  ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This can be fixed if the according variables are set to unsigned int, in this example variable k.

from

#define REGGROW( type, pic_old, pic_new, acpt, acpt_len,                       \
                 border, border_len, std_win )                                 \
{                                                                              \
  mitkIpUInt4_t   i, j;             /* loop variables   */ \
  mitkIpInt4_t    k;                /* loop variable    */ \

to

#define REGGROW( type, pic_old, pic_new, acpt, acpt_len,                       \
                 border, border_len, std_win )                                 \
{                                                                              \
  mitkIpUInt4_t   i, j, k;             /* loop variables  */ \

Variable k is used in this for-loop where no loop into negative numbers should occur, therefore it can be assumed that defining k as` unsigned int` should be fine?

for ( k = pic_old->dim-1; k >= 0; k-- )
reicht claimed this task.Aug 25 2017, 1:11 PM

@reicht I did already some work on these issues. It's all clang / modern gcc related, not Mac specific and affects much more than "Utilities" . Thanks for your report, but I think there are hundreds of issues so let's resolve the other tasks first (in one branch) and then look for remaining issues on Mac.

I just merged some stuff to master. @reicht Could you check if 6e414ed68770 already fixes this task?

Will do. I had lots of time in the train to fix the Utility functions. Will upload them to this branch and then we can check -additionally to your fixes- what would be useful to include into master.