Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[meson] fix build_machine configuration #17845

Merged
merged 1 commit into from
May 26, 2021

Conversation

abique
Copy link
Contributor

@abique abique commented May 11, 2021

This pull request fixes the build_machine arguments passed to meson.

It partially addresses #17676

@abique
Copy link
Contributor Author

abique commented May 11, 2021

I suggest @NancyLi1013 and @Neumann-A as reviewers as they already have some context about the issue.

@JackBoosY JackBoosY self-assigned this May 12, 2021
@JackBoosY JackBoosY added the category:tool-update The issue is with build tool or build script, which requires update or should be executed correctly label May 12, 2021
@JackBoosY
Copy link
Contributor

Ping @Neumann-A for review this PR.

@abique
Copy link
Contributor Author

abique commented May 12, 2021

I spotted an issue, wait for the next patch.

@abique abique force-pushed the meson-build-machine-fixes branch from 8c93e22 to 93e4235 Compare May 12, 2021 15:46
@abique
Copy link
Contributor Author

abique commented May 12, 2021

I got my changes in.
Basically if we can't figure out the host processor, better to "say nothing" than throw a dice.

Good for review I suppose.

@abique abique force-pushed the meson-build-machine-fixes branch from 93e4235 to 41f514a Compare May 12, 2021 15:55
@JackBoosY
Copy link
Contributor

Ping @Neumann-A for review this PR again.

@Neumann-A
Copy link
Contributor

nothing to review as long as CI for Linux and osx are red

@abique abique force-pushed the meson-build-machine-fixes branch from 41f514a to 235d190 Compare May 13, 2021 15:25
@abique
Copy link
Contributor Author

abique commented May 13, 2021

This failure seems unrelated:

-- Downloading https://ftp.gnome.org/pub/GNOME/sources/gtkmm/4.0/gtkmm-4.0.1.tar.xz -> gtkmm-4.0.1.tar.xz...
-- Downloading https://ftp.gnome.org/pub/GNOME/sources/gtkmm/4.0/gtkmm-4.0.1.tar.xz... Failed. Status: 28;"Timeout was reached"
CMake Error at scripts/cmake/vcpkg_download_distfile.cmake:184 (message):
      
      Failed to download file.
      If you use a proxy, please set the HTTPS_PROXY and HTTP_PROXY environment
      variables to "https://user:password@your-proxy-ip-address:port/".
      
      If error with status 4 (Issue #15434),
      try setting "http://user:password@your-proxy-ip-address:port/".
      
      Otherwise, please submit an issue at https://github.com/Microsoft/vcpkg/issues

Call Stack (most recent call first):
  ports/gtkmm/portfile.cmake:3 (vcpkg_download_distfile)
  scripts/ports.cmake:142 (include)

@abique abique force-pushed the meson-build-machine-fixes branch from 235d190 to a9a9536 Compare May 13, 2021 23:56
@JackBoosY
Copy link
Contributor

fribidi:x64-osx:

../src/3bb089f553-744296bd76.clean/gen.tab/meson.build:32:0: ERROR: No build machine compiler for "gen.tab/gen-unicode-version.c"

glib:x64-osx:

../src/glib-2-b84205c786.clean/meson.build:2036:4: ERROR: Automatic wrap-based subproject downloading is disabled

@abique
Copy link
Contributor Author

abique commented May 14, 2021

The osx build issue should be addressed with the last change.

@abique abique force-pushed the meson-build-machine-fixes branch from 0658336 to d1aa23a Compare May 14, 2021 22:04
@JackBoosY
Copy link
Contributor

Please get failure log here.

@abique
Copy link
Contributor Author

abique commented May 15, 2021

@JackBoosY do you know how I can get the logs for dav1d?

@abique
Copy link
Contributor Author

abique commented May 15, 2021

It seems that dav1d did build but maybe for the wrong architecture?

/Library/Developer/CommandLineTools/usr/bin/c++ -fPIC -g -arch x86_64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk -bundle -Wl,-headerpad_max_install_names -pthread /Users/vagrant/Data/installed/x64-osx/debug/lib/pkgconfig/../../lib/libintl.a -Wl,-framework,CoreFoundation -Wl,-framework,Carbon -Wl,-framework,Foundation -Wl,-framework,AppKit -o gdk-pixbuf/libpixbufloader-heif.so gdk-pixbuf/CMakeFiles/pixbufloader-heif.dir/pixbufloader-heif.c.o  libheif/libheif.a  /Users/vagrant/Data/installed/x64-osx/debug/lib/libgdk_pixbuf-2.0.a  /Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk/usr/lib/libm.tbd  /Users/vagrant/Data/installed/x64-osx/debug/lib/libpng16d.a  /Users/vagrant/Data/installed/x64-osx/debug/lib/libz.a  /Users/vagrant/Data/installed/x64-osx/debug/lib/libtiffd.a  /Users/vagrant/Data/installed/x64-osx/debug/lib/liblzmad.a  /Users/vagrant/Data/installed/x64-osx/debug/lib/libjpeg.a  /Users/vagrant/Data/installed/x64-osx/debug/lib/libgio-2.0.a  /Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk/usr/lib/libresolv.tbd  /Users/vagrant/Data/installed/x64-osx/debug/lib/libgobject-2.0.a  /Users/vagrant/Data/installed/x64-osx/debug/lib/libffi.a  /Users/vagrant/Data/installed/x64-osx/debug/lib/libgmodule-2.0.a  /Users/vagrant/Data/installed/x64-osx/debug/lib/libglib-2.0.a  /Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk/usr/lib/libiconv.tbd  /Users/vagrant/Data/installed/x64-osx/debug/lib/libpcre.a  /Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk/usr/lib/libm.tbd  /Users/vagrant/Data/installed/x64-osx/debug/lib/libpng16d.a  /Users/vagrant/Data/installed/x64-osx/debug/lib/libz.a  /Users/vagrant/Data/installed/x64-osx/debug/lib/libtiffd.a  /Users/vagrant/Data/installed/x64-osx/debug/lib/liblzmad.a  /Users/vagrant/Data/installed/x64-osx/debug/lib/libjpeg.a  /Users/vagrant/Data/installed/x64-osx/debug/lib/libgio-2.0.a  /Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk/usr/lib/libresolv.tbd  /Users/vagrant/Data/installed/x64-osx/debug/lib/libgobject-2.0.a  /Users/vagrant/Data/installed/x64-osx/debug/lib/libffi.a  /Users/vagrant/Data/installed/x64-osx/debug/lib/libgmodule-2.0.a  /Users/vagrant/Data/installed/x64-osx/debug/lib/libglib-2.0.a  /Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk/usr/lib/libiconv.tbd  /Users/vagrant/Data/installed/x64-osx/debug/lib/libpcre.a  /Users/vagrant/Data/installed/x64-osx/debug/lib/liblibde265.a  /Users/vagrant/Data/installed/x64-osx/debug/lib/libx265.a  /Users/vagrant/Data/installed/x64-osx/debug/lib/libdav1d.a && :
Undefined symbols for architecture x86_64:
  "_dav1d_avg_avx2", referenced from:
      _dav1d_mc_dsp_init_x86_8bpc in libdav1d.a(x86_mc_init_tmpl.c.o)
  "_dav1d_avg_avx512icl", referenced from:
      _dav1d_mc_dsp_init_x86_8bpc in libdav1d.a(x86_mc_init_tmpl.c.o)
  "_dav1d_avg_ssse3", referenced from:
      _dav1d_mc_dsp_init_x86_8bpc in libdav1d.a(x86_mc_init_tmpl.c.o)
  "_dav1d_blend_avx2", referenced from:
      _dav1d_mc_dsp_init_x86_8bpc in libdav1d.a(x86_mc_init_tmpl.c.o)
  "_dav1d_blend_h_avx2", referenced from:
      _dav1d_mc_dsp_init_x86_8bpc in libdav1d.a(x86_mc_init_tmpl.c.o)
  "_dav1d_blend_h_ssse3", referenced from:
      _dav1d_mc_dsp_init_x86_8bpc in libdav1d.a(x86_mc_init_tmpl.c.o)
  "_dav1d_blend_ssse3", referenced from:
      _dav1d_mc_dsp_init_x86_8bpc in libdav1d.a(x86_mc_init_tmpl.c.o)
  "_dav1d_blend_v_avx2", referenced from:
      _dav1d_mc_dsp_init_x86_8bpc in libdav1d.a(x86_mc_init_tmpl.c.o)
  "_dav1d_blend_v_ssse3", referenced from:
      _dav1d_mc_dsp_init_x86_8bpc in libdav1d.a(x86_mc_init_tmpl.c.o)
  "_dav1d_cdef_dir_16bpc_avx2", referenced from:
      _dav1d_cdef_dsp_init_x86_16bpc in libdav1d.a(x86_cdef_init_tmpl.c.o)

Do you have post install checks to make sure that the binary architecture is the desired one?

@abique
Copy link
Contributor Author

abique commented May 15, 2021

I don't have access to a recent x64 macos machine, so I can't test it further on OSX.
The strange thing is that my patch fixes the build_machine, but in this case I suspect that dav1d is built for the wrong host_machine that is why libheif does not find the symbols for x86.

@JackBoosY
Copy link
Contributor

JackBoosY commented May 21, 2021

@abique Here is the full log.

vcpkg@vcpkg % nm packages/dav1d_x64-osx/lib/libdav1d.a| grep _dav1d_avg_avx2
0000000000006bf0 T _dav1d_avg_avx2
0000000000006ce1 t _dav1d_avg_avx2.ret
0000000000006eaa t _dav1d_avg_avx2.w128
0000000000006e87 t _dav1d_avg_avx2.w128_loop
0000000000006d60 t _dav1d_avg_avx2.w16
0000000000006d34 t _dav1d_avg_avx2.w16_loop
0000000000006ddb t _dav1d_avg_avx2.w32
0000000000006daf t _dav1d_avg_avx2.w32_loop
0000000000006c33 t _dav1d_avg_avx2.w4
0000000000006e47 t _dav1d_avg_avx2.w64
0000000000006e1c t _dav1d_avg_avx2.w64_loop
0000000000006d11 t _dav1d_avg_avx2.w8
0000000000006ce5 t _dav1d_avg_avx2.w8_loop
                 U _dav1d_avg_avx2
vcpkg@vcpkg % find buildtrees/dav1d/x64-osx-dbg -name "*.a"
buildtrees/dav1d/x64-osx-dbg/src/libdav1d.a

dav1d does use these symbols, and it only depends on the build tools.
In dav1d\src\0.8.1-22dbfa23ef.clean\src\x86\mc_init_tmpl.c:

decl_avg_fn(dav1d_avg_avx2);

decl_avg_fn defined here:
dav1d\src\0.8.1-22dbfa23ef.clean\src\mc.h:

#define decl_avg_fn(name) \
void (name)(pixel *dst, ptrdiff_t dst_stride, \
            const int16_t *tmp1, const int16_t *tmp2, int w, int h \
            HIGHBD_DECL_SUFFIX)
typedef decl_avg_fn(*avg_fn);

In meson log:

 34 C compiler for the build machine: /Library/Developer/CommandLineTools/usr/bin/cc (clang 12.0.5 "Apple clang version 12.0.5 (clang-1205.0.22.9)")
 35 C linker for the build machine: /Library/Developer/CommandLineTools/usr/bin/cc ld64 650.9
 36 Build machine cpu family: x86_64
 37 Build machine cpu: x86_64
 38 Host machine cpu family: x86_64
 39 Host machine cpu: x86_64
 40 Target machine cpu family: x86_64
 41 Target machine cpu: x86_64
 42 Running compile:

@JackBoosY JackBoosY added the info:reviewed Pull Request changes follow basic guidelines label May 21, 2021
@abique
Copy link
Contributor Author

abique commented May 21, 2021

Thank you very much @JackBoosY

Copy link
Contributor

@ras0219-msft ras0219-msft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM, thanks for the PR!

@ras0219-msft ras0219-msft merged commit 37a5a94 into microsoft:master May 26, 2021
@abique abique deleted the meson-build-machine-fixes branch May 27, 2021 14:56
@kafeg
Copy link
Contributor

kafeg commented May 28, 2021

Also it affects to the harfbuzz on Mac M1. One more possible change is, something like:

set(UNAMECOMMAND "uname -m")

        if ("${TARGET_TRIPLET}" MATCHES "arm64-osx" )
            set(UNAMECOMMAND "/usr/bin/arch -arm64 uname -m")
        endif()

        execute_process(
            COMMAND ${UNAMECOMMAND}
            OUTPUT_VARIABLE MACHINE
            COMMAND_ERROR_IS_FATAL ANY)

It will run the uname -m on real hardware CPU type.

@abique
Copy link
Contributor Author

abique commented May 28, 2021

That can be, I'm sorry I'm super busy at the moment, maybe you can try to make a pull request with your fix?

@kafeg
Copy link
Contributor

kafeg commented May 28, 2021

Trying to solve harfbuzz, if that fix will help, then will try to do PR.

UPD: Unfortunatelly my change doesn't affect to harfbuzz, the meson files looks good like blablabla-nativ-... without cross-build settings. And it works the same with and without my change

But the lib still builds for the x86_64, I don't understand why.

@JackBoosY
Copy link
Contributor

For Apple M1 macbook, the default triplet should be arm64-osx.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:tool-update The issue is with build tool or build script, which requires update or should be executed correctly info:reviewed Pull Request changes follow basic guidelines
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants