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

Bzlmod2 #26

Merged
merged 38 commits into from
Jan 11, 2025
Merged

Bzlmod2 #26

merged 38 commits into from
Jan 11, 2025

Conversation

Vertexwahn
Copy link
Owner

@Vertexwahn Vertexwahn commented Dec 16, 2024

@Sayter99 I plan to overtake your Bzlmod approach - currently works fine for me on Ubuntu 24.04 and Windows 11. macOS ARM (with M1) does currently not work

@Sayter99
Copy link
Contributor

Sayter99 commented Dec 17, 2024

Sure thing, if you found any problem I will try my best to help if I got time.

Btw, if you remember I encountered a performance issue a few months ago thread, the good news is that it was gone since bazel 8. I think the culprit was "~" in the path for Windows machines. Bazel 8 uses "+" instead.

In other words, if bazel version < 8.0, I would recommend using WORKSPACE for rules_qt on Windows (other platforms work fine).

For M1 Mac, I tried to build a Qt by myself and it works okay, since I don't want it to depend on system installed one. This change might break something, do you have error messages?

@Vertexwahn
Copy link
Owner Author

Vertexwahn commented Dec 17, 2024

@Sayter99 I get this error if I want to run the Hello World example:

dyld[72072]: Library not loaded: @rpath/QtCore.framework/Versions/A/QtCore
  Referenced from: <C0642707-8F04-301C-A5E9-B3E7A68E8286> /private/var/tmp/_bazel_vertexwahn/ad8c7f893d9cb21055a20000d7a2a1b4/execroot/_main/bazel-out/darwin_arm64-fastbuild/bin/hello_world/hello_world
  Reason: tried: 'external/rules_qt++qt+qt_mac_aarch64/lib/QtCore.framework/Versions/A/QtCore' (no such file), 'external/rules_qt++qt+qt_mac_aarch64/lib/QtCore.framework/Versions/A/QtCore' (no such file)

I just cloned your repo and did a bazel run --config=macos //hello_world:hello_world in the test folder - since I use Bazel 8.0.0 now I also did 2 modifications:

I added build --incompatible_disallow_empty_glob=false to .bazelrc. An I added to tests/MODULES.bazel bazel_dep(name = "platforms", version = "0.0.10"). When looking at https://dl.dropboxusercontent.com/scl/fi/8io4wc9cx2kd2vfwswjmg/qt_6.8.0_mac_aarch64_gamepad.tar.xz?rlkey=afkk9qrub9i1gmelv7vktgtci&dl=0 the file is aprox. 153 MB big.

Have you hints for me - how did you bild Qt 6.8.0 on macos ARM?

If I try to execute one of the binaries in the archive (e.g. bin/Designer) I get a warning that I cannot run an unknown executable from internet (maybe some saftey option on my Mac or the stuff has to be siggned...?)

I tried also to use the Qt version installed by brew via:

load("@bazel_tools//tools/build_defs/repo:local.bzl", "new_local_repository")
new_local_repository(
    name = "qt_mac_aarch64",
    path = "/opt/homebrew/",  # after brew link, is't ok just use /opt/homebrew
    build_file = "@rules_qt//:qt_mac_aarch64.BUILD",
)

But this leads to other errors...

@Sayter99
Copy link
Contributor

Sayter99 commented Dec 18, 2024

I can reproduce the error for bazel 8. It is working at my end with bazel 7.4.1, not sure what got changed, will look into it later.

W.r.t. the Qt I've built, I enabled webengine (it's huge!) that's the reason it is large. I built it from scratch without signing anything, it might be the reason Qt creator cannot load it.

@Sayter99
Copy link
Contributor

Sayter99 commented Dec 18, 2024

@Vertexwahn Could you try to modify this line from "-rpath $(location :lib)", to "-rpath ../rules_qt++qt+qt_mac_aarch64/lib", and see if it works at your end? I can confirm that the output of $(location :lib) has been changed, this might be a wrong usage of location though.. I asked this in bazel slack channel, FYI https://bazelbuild.slack.com/archives/CGA9QFQ8H/p1734501754834529

update: per the help I got from slack channel, I updated the way to set rpath for mac. The issue should be fixed by this commit

@Vertexwahn Vertexwahn merged commit 0a024d9 into main Jan 11, 2025
14 of 16 checks passed
@Vertexwahn
Copy link
Owner Author

@Sayter99 I merged the pull request! Thanks for the awesome work you did! Build on macOS 13 fails since this uses macOS on x86_64 (and not arm) - would be nice if we could get this also fixed. May plan is to bring this also to the Bazel Central Registry. I am also thinking to bring this over to https://github.com/bazel-contrib organization.

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

Successfully merging this pull request may close these issues.

3 participants