[MacPorts] #62498: meson: other ports can't build universal

MacPorts noreply at macports.org
Sat Mar 20 04:40:01 UTC 2021


#62498: meson: other ports can't build universal
------------------------+----------------------
 Reporter:  ryandesign  |      Owner:  git@…
     Type:  defect      |     Status:  assigned
 Priority:  Normal      |  Milestone:
Component:  ports       |    Version:  2.6.99
 Keywords:              |       Port:  meson
------------------------+----------------------
 babl @0.1.82_0 can't build with the universal variant on macOS High
 Sierra:

 {{{
 :info:build ../babl-0.1.82/babl/babl-extension.c:201:3: error: use of
 undeclared identifier 'HLIB'
 :info:build   HLIB  dl_handle = NULL;
 :info:build   ^
 :info:build ../babl-0.1.82/babl/babl-extension.c:206:3: error: use of
 undeclared identifier 'dl_handle'
 :info:build   dl_handle = dlopen (path, RTLD_NOW);
 :info:build   ^
 :info:build ../babl-0.1.82/babl/babl-extension.c:206:15: error: implicit
 declaration of function 'dlopen' is invalid in C99 [-Werror,-Wimplicit-
 function-declaration]
 :info:build   dl_handle = dlopen (path, RTLD_NOW);
 :info:build               ^
 :info:build ../babl-0.1.82/babl/babl-extension.c:207:8: error: use of
 undeclared identifier 'dl_handle'
 :info:build   if (!dl_handle)
 :info:build        ^
 :info:build ../babl-0.1.82/babl/babl-extension.c:209:43: error: implicit
 declaration of function 'dlerror' is invalid in C99 [-Werror,-Wimplicit-
 function-declaration]
 :info:build       babl_log ("dlopen() failed:\n\t%s", dlerror ());
 :info:build                                           ^
 :info:build ../babl-0.1.82/babl/babl-extension.c:212:34: error: implicit
 declaration of function 'dlsym' is invalid in C99 [-Werror,-Wimplicit-
 function-declaration]
 :info:build   init = (BablExtensionInitFunc) dlsym (dl_handle, "init");
 :info:build                                  ^
 :info:build ../babl-0.1.82/babl/babl-extension.c:212:41: error: use of
 undeclared identifier 'dl_handle'
 :info:build   init = (BablExtensionInitFunc) dlsym (dl_handle, "init");
 :info:build                                         ^
 :info:build ../babl-0.1.82/babl/babl-extension.c:216:7: error: implicit
 declaration of function 'dlclose' is invalid in C99 [-Werror,-Wimplicit-
 function-declaration]
 :info:build       dlclose (dl_handle);
 :info:build       ^
 :info:build ../babl-0.1.82/babl/babl-extension.c:216:16: error: use of
 undeclared identifier 'dl_handle'
 :info:build       dlclose (dl_handle);
 :info:build                ^
 :info:build ../babl-0.1.82/babl/babl-extension.c:220:47: error: use of
 undeclared identifier 'dl_handle'
 :info:build   destroy = (BablExtensionDestroyFunc) dlsym (dl_handle,
 "destroy");
 :info:build                                               ^
 :info:build ../babl-0.1.82/babl/babl-extension.c:222:28: error: use of
 undeclared identifier 'dl_handle'
 :info:build                            dl_handle,
 :info:build                            ^
 :info:build ../babl-0.1.82/babl/babl-extension.c:229:16: error: use of
 undeclared identifier 'dl_handle'
 :info:build       dlclose (dl_handle);
 :info:build                ^
 :info:build 12 errors generated.
 }}}

 I believe the reason why these things cannot be found is that the right
 header has not been included because meson incorrectly determined that the
 header did not exist:

 {{{
 :info:configure Has header "stdatomic.h" : NO
 :info:configure Has header "dlfcn.h" : NO
 }}}

 The reason why meson didn't detect these headers is that it incorrectly
 used `-arch` flags when doing so: from meson-log.txt:

 {{{
 Running compile:
 Working directory:  /opt/local/var/macports/build
 /_Users_rschmidt_macports_macports-ports-ryandesign-
 fork_graphics_babl/babl/work/build/meson-private/tmpoi5rwtan
 Command line:  ccache /usr/bin/clang -I/opt/local/include
 /opt/local/var/macports/build/_Users_rschmidt_macports_macports-ports-
 ryandesign-fork_graphics_babl/babl/work/build/meson-
 private/tmpoi5rwtan/testfile.c -pipe -E -P -Os -Werror=implicit-function-
 declaration -arch x86_64 -arch i386 -P -O0

 Code:

         #ifdef __has_include
          #if !__has_include("dlfcn.h")
           #error "Header 'dlfcn.h' could not be found"
          #endif
         #else
          #include <dlfcn.h>
         #endif
 Compiler stdout:

 Compiler stderr:
  clang: error: cannot use 'cpp-output' output with multiple -arch options

 Has header "dlfcn.h" : NO
 }}}

 I believe it is a defect in meson that it is using `-arch` flags for these
 tests. autoconf does not have this defect.

 When not building universal, the configure output is:

 {{{
 Has header "stdatomic.h" : YES
 Has header "dlfcn.h" : YES
 }}}

 and the build succeeds.

 P.S: @SoapZA please log in to MacPorts Trac so that your GitHub handle is
 available for auto-completion in the assignment and Cc fields.

-- 
Ticket URL: <https://trac.macports.org/ticket/62498>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list