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

building on arm64 #28

Closed
totaam opened this issue May 5, 2023 · 7 comments
Closed

building on arm64 #28

totaam opened this issue May 5, 2023 · 7 comments

Comments

@totaam
Copy link
Collaborator

totaam commented May 5, 2023

Following https://github.com/Xpra-org/xpra/blob/master/docs/Build/MacOS.md

Running the gtk-osx-setup.sh setup script, Python 3.10.10 complained that:

WARNING: The Python lzma extension was not compiled. Missing the lzma lib?

Perhaps this will cause problems later?

Then:

$ jhbuild 
Killed: 9
$ which jhbuild 
/Users/totaam/.new_local/bin//jhbuild
$ bash -x  /Users/totaam/.new_local/bin//jhbuild bootstrap-gtk-osx
...

Eh!

bootstrapping:

*** Configuring xz *** [1/15]
(..)
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... configure: error: in `/Users/totaam/.cache/jhbuild/build/xz-5.2.5':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details

Because we need to set arm64 in .jhbuildrc-custom.

zlib complained about not finding ninja, pip3.10 install ninja fixed that - but perhaps not the location we should be using..

Then this more obscure one on libxml2:

17 warnings generated.
  CCLD     libxml2mod.la
Undefined symbols for architecture arm64:
  "_PyBool_Type", referenced from:
      _libxml_xmlXPathObjectPtrConvert in types.o
  "_PyBytes_AsString", referenced from:
      _xmlPythonFileReadRaw in libxml.o
      _xmlPythonFileRead in libxml.o
      _PystringSet_Convert in libxml.o
  "_PyBytes_Size", referenced from:
      _xmlPythonFileReadRaw in libxml.o
      _xmlPythonFileRead in libxml.o
(..)
  "__Py_TrueStruct", referenced from:
      _libxml_xmlXPathObjectPtrConvert in types.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
@totaam
Copy link
Collaborator Author

totaam commented May 5, 2023

Fixes this one by adding -lpython3.10 to LDFLAGS, inspiration came from https://bugs.gentoo.org/758473

  • update to libjpeg-turbo 2.x #19
  • libxslt: skip tests, then the same fix as libxml2.
  • gtk-doc: $JHBUILD_PREFIX/bin/python3 -m ensurepip && $JHBUILD_PREFIX/bin/python3 -m pip install pygments.
  • glib:
[589/1179] Compiling Objective-C object gio/libgio-2.0.0.dylib.p/gosxcontenttype.m.o
FAILED: gio/libgio-2.0.0.dylib.p/gosxcontenttype.m.o 
/Library/Developer/CommandLineTools/usr/bin/gcc -Igio/libgio-2.0.0.dylib.p -Igio -I../../../../gtk/source/glib-2.72.0/gio -I. -I../../../../gtk/source/glib-2.72.0 -Iglib -I../../../../gtk/source/glib-2.72.0/glib -Igobject -I../../../../gtk/source/glib-2.72.0/gobject -Igmodule -I../../../../gtk/source/glib-2.72.0/gmodule -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/Users/totaam/gtk/inst/include -fcolor-diagnostics -Wall -Winvalid-pch -Wextra -Wpedantic -std=gnu99 -O2 -g -Wimplicit-fallthrough -Wmisleading-indentation -Wunused -Wno-unused-parameter -Wno-cast-function-type -Wno-pedantic -Wno-format-zero-length -Wno-variadic-macros -Werror=format=2 -Werror=init-self -Werror=missing-include-dirs -Werror=pointer-arith -Wstrict-prototypes -Wno-bad-function-cast -Werror=declaration-after-statement -Werror=implicit-function-declaration -Werror=missing-prototypes -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -mmacosx-version-min=12 -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk '-DG_LOG_DOMAIN="GLib-GIO"' -DGIO_COMPILATION '-DGIO_MODULE_DIR="/Users/totaam/gtk/inst/lib/gio/modules"' '-DLOCALSTATEDIR="/Users/totaam/gtk/inst/var"' -fvisibility=hidden -MD -MQ gio/libgio-2.0.0.dylib.p/gosxcontenttype.m.o -MF gio/libgio-2.0.0.dylib.p/gosxcontenttype.m.o.d -o gio/libgio-2.0.0.dylib.p/gosxcontenttype.m.o -c ../../../../gtk/source/glib-2.72.0/gio/gosxcontenttype.m
../../../../gtk/source/glib-2.72.0/gio/gosxcontenttype.m:63:11: error: mixing declarations and code is incompatible with standards before C99 [-Werror,-Wdeclaration-after-statement]
  CFIndex length = CFStringGetLength (str);
          ^

"Solved" by removing -Wdeclaration-after-statement from build.ninja.

  • gtk:
FAILED: demos/gtk-demo/gtkdemo_resources.h 

"Solved" by not building the demos.

@totaam
Copy link
Collaborator Author

totaam commented May 5, 2023

  • librsvg: needs cargo - probably installed wrong using the default location..
  • pyobjc: add -Wno-error=unreachable-code
  • python3-pyobjc-framework-cocoa: CFLAGS="-Wno-error=uninitialized" python3 setup.py build ..
  • opus: should use meson?
  • vpx: error: "--enable-runtime-cpu-detect selected, but no CPU detection method " "available for your platform

@totaam
Copy link
Collaborator Author

totaam commented May 6, 2023

The bash issue is a "security" feature, just use /bin/bash instead.

@totaam
Copy link
Collaborator Author

totaam commented Jul 25, 2023

cc0cab3 pulls updates from upstream and saves the need for a lot of the workarounds.
But we still have some new / unfixed ones:

  • pixman needed --disable-arm-a64-neon to avoid syntax errors in macro expansion
  • opus still does not build - needs switching to meson
  • vpx no CPU detection method:
~/gtk/source/libvpx-1.13.0/vpx_ports/arm_cpudetect.c:151:2: error: \
    "--enable-runtime-cpu-detect selected, but no CPU detection method " "available for your platform. \
    Reconfigure with --disable-runtime-cpu-detect."

@totaam
Copy link
Collaborator Author

totaam commented Aug 11, 2023

After merging all the changes from upstream in cc0cab3, arm64 builds seem to work OK.

@totaam totaam closed this as completed Aug 11, 2023
@totaam
Copy link
Collaborator Author

totaam commented Aug 15, 2023

For testing the arm64 builds on the build system, this may be useful: How to enable OS X screen sharing (VNC) through SSH?

@totaam
Copy link
Collaborator Author

totaam commented Aug 18, 2023

We no longer have to override arch=arm64: 99d2ed1

And the minimum MacOS version is now 12: 7dd2448

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant