Bug 225501 - graphics/darktable: release 2.4.1 fails to build on FreeBSD 10.3
Summary: graphics/darktable: release 2.4.1 fails to build on FreeBSD 10.3
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Jean-Sébastien Pédron
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-01-28 12:28 UTC by Jean-Sébastien Pédron
Modified: 2018-01-28 12:37 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jean-Sébastien Pédron freebsd_committer freebsd_triage 2018-01-28 12:28:47 UTC
On FreeBSD 10.3, darktable 2.4.1 fails to configure with the following error:

    -- Looking for ZLIB
    CMake Error at src/external/rawspeed/cmake/Modules/CheckZLIB.cmake:44
(message):
      Found unexpected prototype for zError() in <zlib.h>
    Call Stack (most recent call first):
      src/external/rawspeed/cmake/src-dependencies.cmake:117 (include)
      src/external/rawspeed/src/CMakeLists.txt:3 (include)

The error from CMakeError.log file is below:

    Determining if the prototype zError exists for HAVE_ZLIB_ZERROR_PROTOTYPE failed with the following output:
    Change Dir: /usr/ports/graphics/darktable/work/.build/CMakeFiles/CMakeTmp

    Run Build Command:"/usr/local/bin/ninja" "cmTC_eeaba"
    [1/2] Building C object CMakeFiles/cmTC_eeaba.dir/CheckPrototypeDefinition.c.o
    FAILED: CMakeFiles/cmTC_eeaba.dir/CheckPrototypeDefinition.c.o
    /usr/local/bin/clang50   -O2 -pipe  -fstack-protector -fno-strict-aliasing -Wall -fno-strict-aliasing -Wformat -Wformat-security -Wshadow -Wtype-limits -Wvla -Wthread-safety -Wno-error=varargs -Wno-error=address-of-packed-member -Wframe-larger-than=32768 -Wlarger-than=524288 -w  -fPIE -o CMakeFiles/cmTC_eeaba.dir/CheckPrototypeDefinition.c.o   -c CheckPrototypeDefinition.c
    CheckPrototypeDefinition.c:15:10: error: use of undeclared identifier 'NULL'
      return NULL;
             ^
    1 error generated.
    ninja: build stopped: subcommand failed.


    #include <zlib.h>


    static void cmakeRequireSymbol(int dummy, ...) {
      (void) dummy;
    }

    static void checkSymbol(void) {
    #ifndef zError
      cmakeRequireSymbol(0, &zError);
    #endif
    }

    const char* zError(int zErrorCode) {
      return NULL;
    }

    #ifdef __CLASSIC_C__
    int main() {
      int ac;
      char*av[];
    #else
    int main(int ac, char *av[]) {
    #endif
      checkSymbol();
      if (ac > 1000) {
        return *av[0];
      }
      return 0;
    }

This was reported directly to me by cpm@.
Comment 1 Jean-Sébastien Pédron freebsd_committer freebsd_triage 2018-01-28 12:29:29 UTC
Changing the CMake test source code to include `stddef.h` fixes the build failure.
Comment 2 commit-hook freebsd_committer freebsd_triage 2018-01-28 12:35:24 UTC
A commit references this bug:

Author: dumbbell
Date: Sun Jan 28 12:34:39 UTC 2018
New revision: 460168
URL: https://svnweb.freebsd.org/changeset/ports/460168

Log:
  graphics/darktable: Include `stddef.h` when testing zError() symbol

  The `CheckZlib.cmake` module uses `NULL` in the test source code to
  check for the `zError()` symbol. This fails to build on FreeBSD 10.3
  with the following error:

      CheckPrototypeDefinition.c:15:10: error: use of undeclared identifier 'NULL'
        return NULL;
               ^

  I don't know the root cause for this failure, but including `stddef.h`
  in this test source code fixes the problem.

  PR:		225501
  Reported by:	cpm@

Changes:
  head/graphics/darktable/files/patch-src_external_rawspeed_cmake_Modules_CheckZLIB.cmake