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

qbe: update to 1.2. #49016

Merged
merged 1 commit into from
Mar 10, 2024
Merged

qbe: update to 1.2. #49016

merged 1 commit into from
Mar 10, 2024

Conversation

echoptic
Copy link
Contributor

@echoptic echoptic commented Mar 1, 2024

Testing the changes

  • I tested the changes in this PR: YES

Local build testing

  • I built this PR locally for my native architecture, x86_64-glibc

@oreo639
Copy link
Member

oreo639 commented Mar 1, 2024

Partial duplicate of #48784

@echoptic
Copy link
Contributor Author

echoptic commented Mar 1, 2024

Why did the CI check fail? Lint failed because there is no comment next to make_check=no. But what about the other 2 checks? I ran ./xbps-src -Q pkg qbe locally and it worked. Sorry, this is my first time trying to do this.

@oreo639
Copy link
Member

oreo639 commented Mar 1, 2024

Cross compiling failed because it used the wrong compiler.

@echoptic
Copy link
Contributor Author

echoptic commented Mar 1, 2024

OK, I think the problem is this in the Makefile: CC = cc right?
Does adding this in the template file fix the issue?

do_build() {
        if [ "$CROSS_BUILD" ]; then
                make CC="${XBPS_CROSS_TRIPLET}-gcc"
        fi
}

@echoptic
Copy link
Contributor Author

echoptic commented Mar 1, 2024

Cross compiling to riscv64 and aarch64 works and added comment for make_check=no

@Duncaen
Copy link
Member

Duncaen commented Mar 1, 2024

Overwriting do_build will now not build the package if natively compiled.
You probably want make_use_env=yes instead, the gnu-makefile buildstyle already sets CC.

Edit: make_use_env is already used, so you want the opposite, but then it might not use the right cflags, you could just vsed -e '/^CC/d' -i Makefile in post_patch.


# Currently only aarch64 and x86_64 targets are supported and the checks
# test the compiled binaries.
case "$XBPS_TARGET_MACHINE" in
aarch64*|x86_64*) ;;
*) make_check=no ;;
*) make_check=no # tests are broken ;;
Copy link
Member

Choose a reason for hiding this comment

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

This comment is wrong, the tests don't exist for other architectures.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Tests exist for riscv64 and aarch64, but they can only be ran with the host qbe and I wasnt sure if it would work in the github workflow, but I tested locally and it looks like it doesnt run tests for target arch when you are cross compiling.

check-arm64: qbe
        TARGET=arm64 tools/test.sh all

check-rv64: qbe
        TARGET=rv64 tools/test.sh all

I updated the template and I think its OK now.

@echoptic
Copy link
Contributor Author

echoptic commented Mar 2, 2024

Overwriting do_build will now not build the package if natively compiled. You probably want make_use_env=yes instead, the gnu-makefile buildstyle already sets CC.

Edit: make_use_env is already used, so you want the opposite, but then it might not use the right cflags, you could just vsed -e '/^CC/d' -i Makefile in post_patch.

Natively compiling works for me:

./xbps-src pkg qbe
=> xbps-src: updating repositories for host (x86_64)...
[*] Updating repository `https://repo-default.voidlinux.org/current/bootstrap/x86_64-repodata' ...
[*] Updating repository `https://repo-default.voidlinux.org/current/x86_64-repodata' ...
[*] Updating repository `https://repo-default.voidlinux.org/current/nonfree/x86_64-repodata' ...
[*] Updating repository `https://repo-default.voidlinux.org/current/debug/x86_64-repodata' ...
[*] Updating repository `https://repo-default.voidlinux.org/current/multilib/bootstrap/x86_64-repodata' ...
[*] Updating repository `https://repo-default.voidlinux.org/current/multilib/x86_64-repodata' ...
[*] Updating repository `https://repo-default.voidlinux.org/current/multilib/nonfree/x86_64-repodata' ...
=> xbps-src: updating software in / masterdir...
=> xbps-src: cleaning up / masterdir...
=> qbe-1.2_1: removing autodeps, please wait...
=> qbe-1.2_1: building with [gnu-makefile] for x86_64...
=> qbe-1.2_1: running do-fetch hook: 00-distfiles ...
=> qbe-1.2_1: running do-extract hook: 00-distfiles ...
=> qbe-1.2_1: extracting distfile(s), please wait...
=> qbe-1.2_1: running do-patch hook: 00-patches ...
=> qbe-1.2_1: running pre-configure hook: 00-gnu-configure-asneeded ...
=> qbe-1.2_1: running pre-configure hook: 01-override-config ...
=> qbe-1.2_1: running pre-configure hook: 02-script-wrapper ...
=> qbe-1.2_1: running pre-build hook: 02-script-wrapper ...
=> qbe-1.2_1: running do_build ...
=> qbe-1.2_1: skipping check (XBPS_CHECK_PKGS is disabled) ...
=> qbe-1.2_1: running pre-install hook: 00-libdir ...
=> qbe-1.2_1: running pre-install hook: 02-script-wrapper ...
=> qbe-1.2_1: running pre-install hook: 98-fixup-gir-path ...
=> qbe-1.2_1: running do_install ...
cc -std=c99 -g -Wall -Wextra -Wpedantic -c main.c -o main.o
cc -std=c99 -g -Wall -Wextra -Wpedantic -c util.c -o util.o
cc -std=c99 -g -Wall -Wextra -Wpedantic -c parse.c -o parse.o
cc -std=c99 -g -Wall -Wextra -Wpedantic -c abi.c -o abi.o
cc -std=c99 -g -Wall -Wextra -Wpedantic -c cfg.c -o cfg.o
cc -std=c99 -g -Wall -Wextra -Wpedantic -c mem.c -o mem.o
cc -std=c99 -g -Wall -Wextra -Wpedantic -c ssa.c -o ssa.o
cc -std=c99 -g -Wall -Wextra -Wpedantic -c alias.c -o alias.o
cc -std=c99 -g -Wall -Wextra -Wpedantic -c load.c -o load.o
cc -std=c99 -g -Wall -Wextra -Wpedantic -c copy.c -o copy.o
cc -std=c99 -g -Wall -Wextra -Wpedantic -c fold.c -o fold.o
cc -std=c99 -g -Wall -Wextra -Wpedantic -c simpl.c -o simpl.o
cc -std=c99 -g -Wall -Wextra -Wpedantic -c live.c -o live.o
cc -std=c99 -g -Wall -Wextra -Wpedantic -c spill.c -o spill.o
cc -std=c99 -g -Wall -Wextra -Wpedantic -c rega.c -o rega.o
cc -std=c99 -g -Wall -Wextra -Wpedantic -c emit.c -o emit.o
cc -std=c99 -g -Wall -Wextra -Wpedantic -c amd64/targ.c -o amd64/targ.o
cc -std=c99 -g -Wall -Wextra -Wpedantic -c amd64/sysv.c -o amd64/sysv.o
cc -std=c99 -g -Wall -Wextra -Wpedantic -c amd64/isel.c -o amd64/isel.o
cc -std=c99 -g -Wall -Wextra -Wpedantic -c amd64/emit.c -o amd64/emit.o
cc -std=c99 -g -Wall -Wextra -Wpedantic -c arm64/targ.c -o arm64/targ.o
cc -std=c99 -g -Wall -Wextra -Wpedantic -c arm64/abi.c -o arm64/abi.o
cc -std=c99 -g -Wall -Wextra -Wpedantic -c arm64/isel.c -o arm64/isel.o
cc -std=c99 -g -Wall -Wextra -Wpedantic -c arm64/emit.c -o arm64/emit.o
cc -std=c99 -g -Wall -Wextra -Wpedantic -c rv64/targ.c -o rv64/targ.o
cc -std=c99 -g -Wall -Wextra -Wpedantic -c rv64/abi.c -o rv64/abi.o
cc -std=c99 -g -Wall -Wextra -Wpedantic -c rv64/isel.c -o rv64/isel.o
cc -std=c99 -g -Wall -Wextra -Wpedantic -c rv64/emit.c -o rv64/emit.o
cc -Wl,-z,relro -Wl,-z,now -Wl,--as-needed     main.o util.o parse.o abi.o cfg.o mem.o ssa.o alias.o load.o  copy.o fold.o simpl.o live.o spill.o rega.o emit.o amd64/targ.o amd64/sysv.o amd64/isel.o amd64/emit.o arm64/targ.o arm64/abi.o arm64/isel.o arm64/emit.o rv64/targ.o rv64/abi.o rv64/isel.o rv64/emit.o -o qbe
mkdir -p "/destdir//qbe-1.2/usr/bin"
install -m755 qbe "/destdir//qbe-1.2/usr/bin/qbe"
=> qbe-1.2_1: running post_install ...
=> qbe-1.2_1: running post-install hook: 00-compress-info-files ...
=> qbe-1.2_1: running post-install hook: 00-fixup-gir-path ...
=> qbe-1.2_1: running post-install hook: 00-libdir ...
=> qbe-1.2_1: running post-install hook: 00-uncompress-manpages ...
=> qbe-1.2_1: running post-install hook: 01-remove-misc ...
=> qbe-1.2_1: running post-install hook: 02-remove-libtool-archives ...
=> qbe-1.2_1: running post-install hook: 02-remove-perl-files ...
=> qbe-1.2_1: running post-install hook: 02-remove-python-bytecode-files ...
=> qbe-1.2_1: running post-install hook: 03-remove-empty-dirs ...
=> WARNING: qbe-1.2_1: removed empty dir: /usr/lib
=> qbe-1.2_1: running post-install hook: 04-create-xbps-metadata-scripts ...
=> qbe-1.2_1: running post-install hook: 05-generate-gitrevs ...
=> qbe-1.2_1: running post-install hook: 06-strip-and-debug-pkgs ...
   Stripped position-independent executable: /usr/bin/qbe
=> qbe-1.2_1: running post-install hook: 10-pkglint-devel-paths ...
=> qbe-1.2_1: running post-install hook: 11-pkglint-elf-in-usrshare ...
=> qbe-1.2_1: running post-install hook: 12-rename-python3-c-bindings ...
=> qbe-1.2_1: running post-install hook: 13-pkg-config-clean-xbps-cross-base-ref ...
=> qbe-1.2_1: running post-install hook: 14-fix-permissions ...
=> qbe-1.2_1: running post-install hook: 80-prepare-32bit ...
=> qbe-1.2_1: running post-install hook: 98-shlib-provides ...
=> qbe-1.2_1: running post-install hook: 99-pkglint-warn-cross-cruft ...
=> qbe-1.2_1: running pre-pkg hook: 03-rewrite-python-shebang ...
=> qbe-1.2_1: running pre-pkg hook: 04-generate-runtime-deps ...
   SONAME: libc.so.6 <-> glibc>=2.38_1
=> qbe-1.2_1: running pre-pkg hook: 05-generate-32bit-runtime-deps ...
=> qbe-1.2_1: running pre-pkg hook: 90-set-timestamps ...
=> qbe-1.2_1: setting mtimes to Sat Mar  2 10:15:33 AM UTC 2024
=> qbe-1.2_1: running pre-pkg hook: 99-pkglint-subpkgs ...
=> qbe-1.2_1: running pre-pkg hook: 99-pkglint ...
=> qbe-1.2_1: running pre-pkg hook: 999-collected-rdeps ...
   glibc>=2.38_1
=> qbe-1.2_1: running do-pkg hook: 00-gen-pkg ...
=> Creating qbe-1.2_1.x86_64.xbps for repository /host/binpkgs/qbe-update ...
=> qbe-1.2_1: running post-pkg hook: 00-register-pkg ...
=> Registering new packages to /host/binpkgs/qbe-update
index: added `qbe-1.2_1' (x86_64).
index: 1 packages registered.
=> qbe-1.2_1: removing autodeps, please wait...
=> qbe-1.2_1: cleaning build directory...
=> qbe: removing files from destdir...

@oreo639
Copy link
Member

oreo639 commented Mar 2, 2024

The way you have it set up, make doesn't run in do_build() when native compiling.
The object files getting compiled do_install() is not correct as the variables set when running do_install() are not necessarily the same as with do_build().

You don't need to use a custom do_build() here, there is a variable make_build_args for this purpose, although as Duncaen said, the correct fix is to remove the CC assignment in the makefile using vsed so that the compiler can be specified by the environment.

@echoptic
Copy link
Contributor Author

echoptic commented Mar 2, 2024

Removed CC assignment in Makefile by adding vsed -e '/^CC/d' -i Makefile in post_patch and tested for x86_64 and aarch64 glibc and it works.

@echoptic
Copy link
Contributor Author

echoptic commented Mar 7, 2024

Hi just checking, is there anything else I need to do? Or just have to wait for someone to merge this?

@cinerea0 cinerea0 merged commit e5858c3 into void-linux:master Mar 10, 2024
8 checks passed
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.

None yet

4 participants