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

Problems with Macs os m1 platform #60

Open
Marcin81 opened this issue Sep 11, 2022 · 1 comment
Open

Problems with Macs os m1 platform #60

Marcin81 opened this issue Sep 11, 2022 · 1 comment

Comments

@Marcin81
Copy link

  1. Should add spoved to dependencies into shards.yml
dependencies:
  qt5:
    github: Papierkorb/qt5.cr
    branch: master
  spoved:
    github: spoved/spoved.cr
  1. lib/bindgen/clang/find_clang.cr5.
    Variables have problems with llvm_version (command nod found) and also change should add llvm/bin into the PATH.
makefile_variables_content = <<-VARS
  CLANG_BINARY := #{clang}
  CLANG_INCLUDES := #{system_include_dirs.map { |x| "-I#{File.expand_path(x)}" }.join(' ')}
  CLANG_LIBS := #{get_lib_args(clang_libs + llvm_libs).join(' ')}

  LLVM_CONFIG_BINARY := #{llvm_config}
  # LLVM_VERSION_MAJOR := #{llvm_version.split(/\./).first}
  LLVM_VERSION_MAJOR := "14"
  # LLVM_VERSION := #{llvm_version}
  LLVM_VERSION := "14.0.6"
  LLVM_CXX_FLAGS := #{llvm_cxx_flags}
  LLVM_LD_FLAGS := #{llvm_ld_flags}
  LLVM_LIBS := #{get_lib_args(llvm_libs).join(" ")}
  VARS
write_if_changed(makefile_variables, makefile_variables_content)
  1. Compilation problem with: lib/bindgen/clang/src/record_match_handler.cpp and lib/bindgen/clang/src/record_match_handler.cpp.

linę 92:

// if (typeInfo.AlignIsRequired) bitSize += typeInfo.Align; // was that - but method does not exist
if (typeInfo.isAlignRequired()) bitSize += typeInfo.Align; // switch to compile
	klass.byteSize = bitSize / 8;
  1. Compilation problem with: lib/bindgen/clang/src/preprocessor_handler.cpp and lib/bindgen/clang/include/regex.hpp
    Does not find
#include <pcre.h>

but file exists:

export LDFLAGS="-L$HOMEBREW_PREFIX/opt/pcre/lib"
export CPPFLAGS="-I$HOMEBREW_PREFIX/opt/pcre/include"
  1. No configuration for Mac OS => lib/qt5/support/generate_bindings.cr
configurations = [
#      OS       LIBC   ARCH      Qt   Patch   Clang target triplet      Ptr  Endian
#  { "linux", "gnu", "x86_64", "5.5",  "0", "x86_64-unknown-linux-gnu", 8, "little" },
#  { "linux", "gnu", "x86_64", "5.6",  "0", "x86_64-unknown-linux-gnu", 8, "little" },
#  { "linux", "gnu", "x86_64", "5.7",  "0", "x86_64-unknown-linux-gnu", 8, "little" },
#  { "linux", "gnu", "x86_64", "5.8",  "0", "x86_64-unknown-linux-gnu", 8, "little" },
#  { "linux", "gnu", "x86_64", "5.9",  "0", "x86_64-unknown-linux-gnu", 8, "little" },
#  { "linux", "gnu", "x86_64", "5.10", "0", "x86_64-unknown-linux-gnu", 8, "little" },
#  { "linux", "gnu", "x86_64", "5.11", "2", "x86_64-unknown-linux-gnu", 8, "little" },
#  { "linux", "gnu", "x86_64", "5.12", "0", "x86_64-unknown-linux-gnu", 8, "little" },
#   { "linux", "gnu", "x86_64", "5.13", "0", "x86_64-unknown-linux-gnu", 8, "little" },
#  { "linux", "gnu", "x86_64", "5.14", "0", "x86_64-unknown-linux-gnu", 8, "little" },
#  { "linux", "gnu", "x86_64", "5.15", "0", "x86_64-unknown-linux-gnu", 8, "little" },
#  {"darwin", "unknown", "x86_64", "5.13", "x86_64-apple-darwin19.6.0", 8, "little"},
#  {"darwin", "unknown", "x86_64", "5.15", "x86_64-apple-darwin19.6.0", 8, "little"},
  {"darwin", "unknown", "aarch64", "5.15", "0", "", 8, "little"}#  binding_darwin-unknown-aarch64-qt5.15
]
  1. Failure generate bindings
 crystal lib/qt5/support/generate_bindings.cr
-- Build files have been written to: /Users/marcin/Documents/crystal_projects/qt_sample/lib/bindgen/clang
Consolidate compiler generated dependencies of target parser
[  7%] Linking CXX executable parser
ld: library not found for -lclangTidyMPIModule
clang-14: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [parser] Error 1
make[1]: *** [CMakeFiles/parser.dir/all] Error 2
make: *** [all] Error 2
  Bindgen requires a full installation of Clang, its libraries and development
  headers.  Please install these first, and restart this script.
  You can also manually run 'cmake . && make' in clang/ for debugging this issue.
  Full path to clang/: /Users/marcin/Documents/crystal_projects/qt_sample/lib/bindgen/clang/
Failed to build darwin-unknown-aarch64-qt5.15 using Qt5.15 on  - Abort.


```bash
clang --version
Homebrew clang version 14.0.6
Target: arm64-apple-darwin21.6.0
Thread model: posix
InstalledDir: /opt/homebrew/opt/llvm/bin
  1. Cannot build via shards
shards build
Dependencies are satisfied
Building: shards
Error target shards failed to compile:
Showing last frame. Use --error-trace for full trace.

There was a problem expanding macro 'macro_4450161088'

Code in lib/qt5/src/qt5/binding.cr:6:1

 6 | {% begin %}
     ^
Called macro defined in lib/qt5/src/qt5/binding.cr:6:1

 6 | {% begin %}

Which expanded to:

 > 1 | 
 > 2 |   
 > 3 |   require "./binding/binding_darwin-unknown-aarch64-qt5.15"
         ^
Error: can't find file './binding/binding_darwin-unknown-aarch64-qt5.15' relative to '/Users/marcin/Documents/crystal_projects/qt_sample/lib/qt5/src/qt5/binding.cr'
  1. lib/qt5/config/find_paths.yml not support latest version (=14)
  LLVM_CONFIG_BINARY:
    kind: Executable
    optional: false
    try:
      - llvm-config
    version:
      min: "4"
      max: "14" # was 11
      variable: LLVM_VERSION
      command: "% --version"
      regex: "^([0-9]+)."
    error_message: Failed to find llvm version
@docelic
Copy link
Collaborator

docelic commented Sep 11, 2022

Heya, thanks for the report!
If by chance you could come up with partial PRs for the items you mentioned, it would speed up the progress on resolving them.

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

2 participants