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

rustc: Enable profiler on more platforms #314832

Closed
wants to merge 1 commit into from

Conversation

Artturin
Copy link
Member

@Artturin Artturin commented May 26, 2024

remove the isRedox condition which was added because stdenv.isLinux uses hostPlatform, after specifying targetPlatform it's no longer necessary

For error[E0463]: can't find crate for 'profiler_builtins'
#266570
https://logs.ofborg.org/?key=nixos/nixpkgs.266570&attempt_id=450d0b18-fd6a-4c44-893d-30de5941b73f

Description of changes

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.11 Release Notes (or backporting 23.11 and 24.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@ofborg ofborg bot added the 6.topic: darwin Running or building packages on Darwin label May 26, 2024
@alyssais
Copy link
Member

Wouldn't it be better to assume this works on all platforms except ones where we have a reason to think it doesn't, like Redox? On a platform it doesn't work on, it would be IMO less confusing to get an error about profiler_builtins not building than one about it being missing from the standard library.

@ofborg ofborg bot requested a review from tjni May 26, 2024 12:41
@ofborg ofborg bot added 10.rebuild-darwin: 501+ 10.rebuild-darwin: 5001+ 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux labels May 26, 2024
@Artturin Artturin force-pushed the rustcprofiler branch 2 times, most recently from 34dafe9 to 5b7f605 Compare May 26, 2024 13:14
@@ -139,7 +139,7 @@ in stdenv.mkDerivation (finalAttrs: {
"${setBuild}.llvm-config=${llvmSharedForBuild.dev}/bin/llvm-config"
"${setHost}.llvm-config=${llvmSharedForHost.dev}/bin/llvm-config"
"${setTarget}.llvm-config=${llvmSharedForTarget.dev}/bin/llvm-config"
] ++ optionals (stdenv.isLinux && !stdenv.targetPlatform.isRedox) [
] ++ optionals (stdenv.targetPlatform.isLinux || stdenv.targetPlatform.isDarwin || stdenv.targetPlatform.isAndroid || stdenv.targetPlatform.isFreeBSD || (stdenv.targetPlatform.isWindows && !stdenv.targetPlatform.isMinGW)) [
Copy link
Member

Choose a reason for hiding this comment

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

These links in your commit message are great — but maybe they should be in a comment so they can easily be checked and updated?

Copy link
Member

@alyssais alyssais left a comment

Choose a reason for hiding this comment

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

LGTM as long as OfBorg is happy.

@Artturin
Copy link
Member Author

LGTM as long as OfBorg is happy.

Ofborg failed with a timeout in llvm.

Tried building on the build box but

rustc> Building bootstrap
rustc> Auto configuration failed
rustc> 8646315008:error:02FFF001:system library:func(4095):Operation not permitted:/AppleInternal/Library/BuildRoots/91a344b1-f985-11ee-b563-fe8bc7981bff/Library/Caches/com.apple.xbs/Sources/libressl/libressl-3.3/crypto/bio/bss_file.c:122:fopen('/private/etc/ssl/openssl.cnf', 'rb')
rustc> 8646315008:error:20FFF002:BIO routines:CRYPTO_internal:system lib:/AppleInternal/Library/BuildRoots/91a344b1-f985-11ee-b563-fe8bc7981bff/Library/Caches/com.apple.xbs/Sources/libressl/libressl-3.3/crypto/bio/bss_file.c:127:
rustc> 8646315008:error:0EFFF002:configuration file routines:CRYPTO_internal:system lib:/AppleInternal/Library/BuildRoots/91a344b1-f985-11ee-b563-fe8bc7981bff/Library/Caches/com.apple.xbs/Sources/libressl/libressl-3.3/crypto/conf/conf_def.c:202:
rustc> failed to run: /nix/store/d4ih07nvbvvrhgsyxgy4in0b4q220wcl-cargo-bootstrap-1.76.0/bin/cargo build --manifest-path /private/tmp/nix-build-rustc-1.77.2.drv-0/rustc-1.77.2-src/src/bootstrap/Cargo.toml --frozen
rustc> Build completed unsuccessfully in 0:00:00
rustc> make: *** [Makefile:19: all] Error 1

Error happens without this pr too (nix build ".#rustc.unwrapped" --rebuild)

nix-community/infra#1289

@Artturin
Copy link
Member Author

Compiling profiler_builtins v0.0.0 (/private/tmp/nix-build-rustc-1.77.2.drv-0/rustc-1.77.2-src/library/profiler_builtins)
The following warnings were emitted during compilation:

warning: [email protected]: clang-16: warning: argument unused during compilation: '-mmacos-version-min=11.0' [-Wunused-command-line-argument]
warning: [email protected]: clang-16: warning: argument unused during compilation: '-arch arm64' [-Wunused-command-line-argument]
warning: [email protected]: error: unknown target CPU 'apple-a13'
warning: [email protected]: note: valid target CPU values are: mvp, bleeding-edge, generic

error: failed to run custom build command for `profiler_builtins v0.0.0 (/private/tmp/nix-build-rustc-1.77.2.drv-0/rustc-1.77.2-src/library/profiler_builtins)`

Caused by:
  process didn't exit successfully: `/private/tmp/nix-build-rustc-1.77.2.drv-0/rustc-1.77.2-src/build/aarch64-apple-darwin/stage2-std/release/build/profiler_builtins-15fb419c8ddde0e8/build-script-build` (exit status: 1)
  --- stdout
  cargo:rerun-if-env-changed=LLVM_PROFILER_RT_LIB
  TARGET = Some("wasm32-unknown-unknown")
  OPT_LEVEL = Some("3")
  HOST = Some("aarch64-apple-darwin")
  cargo:rerun-if-env-changed=CC_wasm32-unknown-unknown
  CC_wasm32-unknown-unknown = None
  cargo:rerun-if-env-changed=CC_wasm32_unknown_unknown
  CC_wasm32_unknown_unknown = Some("clang")
  cargo:rerun-if-env-changed=CFLAGS_wasm32-unknown-unknown
  CFLAGS_wasm32-unknown-unknown = None
  cargo:rerun-if-env-changed=CFLAGS_wasm32_unknown_unknown
  CFLAGS_wasm32_unknown_unknown = Some("-ffunction-sections -fdata-sections -fPIC --target=wasm32-unknown-unknown")
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("false")
  running: "clang" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "--target=wasm32-unknown-unknown" "-ffunction-sections" "-fdata-sections" "-fPIC" "--target=wasm32-unknown-unknown" "-I" "../../src/llvm-project/compiler-rt/include" "-fno-builtin" "-fomit-frame-pointer" "-fvis>
  cargo:warning=clang-16: warning: argument unused during compilation: '-mmacos-version-min=11.0' [-Wunused-command-line-argument]
  cargo:warning=clang-16: warning: argument unused during compilation: '-arch arm64' [-Wunused-command-line-argument]
  cargo:warning=error: unknown target CPU 'apple-a13'
  cargo:warning=note: valid target CPU values are: mvp, bleeding-edge, generic
  exit status: 1

  --- stderr


  error occurred: Command "clang" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "--target=wasm32-unknown-unknown" "-ffunction-sections" "-fdata-sections" "-fPIC" "--target=wasm32-unknown-unknown" "-I" "../../src/llvm-project/compiler-rt/include" "-fno-builtin" "-fomit-frame->


warning: build failed, waiting for other jobs to finish...

@Artturin Artturin marked this pull request as draft May 28, 2024 14:30
@wegank wegank added the 2.status: merge conflict This PR has merge conflicts with the target branch label Jul 4, 2024
@Artturin
Copy link
Member Author

Been a few months so retrying.

@ofborg ofborg bot removed the 2.status: merge conflict This PR has merge conflicts with the target branch label Sep 18, 2024
@Artturin
Copy link
Member Author

New errors

Compiling profiler_builtins v0.0.0 (/private/tmp/nix-build-rustc-1.80.1.drv-0/rustc-1.80.1-src/library/profiler_builtins)
The following warnings were emitted during compilation:

warning: [email protected]: clang-16: warning: argument unused during compilation: '-mmacos-version-min=11.0' [-Wunused-command-line-argument]
warning: [email protected]: clang-16: warning: argument unused during compilation: '-arch arm64' [-Wunused-command-line-argument]
warning: [email protected]: In file included from ../../src/llvm-project/compiler-rt/lib/profile/GCDAProfiling.c:24:
warning: [email protected]: In file included from /nix/store/apgxk5abmyyc4b8xydd5ghf4fpb5shkl-libSystem-11.0.0/include/errno.h:23:
warning: [email protected]: In file included from /nix/store/apgxk5abmyyc4b8xydd5ghf4fpb5shkl-libSystem-11.0.0/include/sys/errno.h:72:
warning: [email protected]: /nix/store/apgxk5abmyyc4b8xydd5ghf4fpb5shkl-libSystem-11.0.0/include/sys/cdefs.h:828:2: error: Unsupported architecture
warning: [email protected]: #error Unsupported architecture
warning: [email protected]:  ^
warning: [email protected]: In file included from ../../src/llvm-project/compiler-rt/lib/profile/GCDAProfiling.c:25:
warning: [email protected]: In file included from /nix/store/apgxk5abmyyc4b8xydd5ghf4fpb5shkl-libSystem-11.0.0/include/fcntl.h:23:
warning: [email protected]: In file included from /nix/store/apgxk5abmyyc4b8xydd5ghf4fpb5shkl-libSystem-11.0.0/include/sys/fcntl.h:78:
warning: [email protected]: In file included from /nix/store/apgxk5abmyyc4b8xydd5ghf4fpb5shkl-libSystem-11.0.0/include/sys/_types.h:33:
warning: [email protected]: /nix/store/apgxk5abmyyc4b8xydd5ghf4fpb5shkl-libSystem-11.0.0/include/machine/_types.h:36:2: error: architecture not supported
warning: [email protected]: #error architecture not supported
warning: [email protected]:  ^
warning: [email protected]: In file included from ../../src/llvm-project/compiler-rt/lib/profile/GCDAProfiling.c:25:
warning: [email protected]: In file included from /nix/store/apgxk5abmyyc4b8xydd5ghf4fpb5shkl-libSystem-11.0.0/include/fcntl.h:23:
warning: [email protected]: In file included from /nix/store/apgxk5abmyyc4b8xydd5ghf4fpb5shkl-libSystem-11.0.0/include/sys/fcntl.h:78:
warning: [email protected]: /nix/store/apgxk5abmyyc4b8xydd5ghf4fpb5shkl-libSystem-11.0.0/include/sys/_types.h:55:9: error: unknown type name '__int64_t'; did you mean '__int>
warning: [email protected]: typedef __int64_t       __darwin_blkcnt_t;      /* total blocks */
warning: [email protected]:         ^
warning: [email protected]: note: '__int128_t' declared here
warning: [email protected]: /nix/store/apgxk5abmyyc4b8xydd5ghf4fpb5shkl-libSystem-11.0.0/include/sys/_types.h:56:9: error: unknown type name '__int32_t'; did you mean '__int>
warning: [email protected]: typedef __int32_t       __darwin_blksize_t;     /* preferred block size */
warning: [email protected]:         ^
warning: [email protected]: note: '__int128_t' declared here
warning: [email protected]: /nix/store/apgxk5abmyyc4b8xydd5ghf4fpb5shkl-libSystem-11.0.0/include/sys/_types.h:57:9: error: unknown type name '__int32_t'; did you mean '__int>
warning: [email protected]: typedef __int32_t       __darwin_dev_t;         /* dev_t */
warning: [email protected]:         ^
warning: [email protected]: note: '__int128_t' declared here
warning: [email protected]: /nix/store/apgxk5abmyyc4b8xydd5ghf4fpb5shkl-libSystem-11.0.0/include/sys/_types.h:60:9: error: unknown type name '__uint32_t'; did you mean '__ui>
warning: [email protected]: typedef __uint32_t      __darwin_gid_t;         /* [???] process and group IDs */
warning: [email protected]:         ^
warning: [email protected]: note: '__uint128_t' declared here
warning: [email protected]: /nix/store/apgxk5abmyyc4b8xydd5ghf4fpb5shkl-libSystem-11.0.0/include/sys/_types.h:61:9: error: unknown type name '__uint32_t'; did you mean '__ui>
warning: [email protected]: typedef __uint32_t      __darwin_id_t;          /* [XSI] pid_t, uid_t, or gid_t*/
warning: [email protected]:         ^
warning: [email protected]: note: '__uint128_t' declared here
warning: [email protected]: /nix/store/apgxk5abmyyc4b8xydd5ghf4fpb5shkl-libSystem-11.0.0/include/sys/_types.h:62:9: error: unknown type name '__uint64_t'; did you mean '__ui>
warning: [email protected]: typedef __uint64_t      __darwin_ino64_t;       /* [???] Used for 64 bit inodes */
warning: [email protected]:         ^
warning: [email protected]: note: '__uint128_t' declared here
warning: [email protected]: /nix/store/apgxk5abmyyc4b8xydd5ghf4fpb5shkl-libSystem-11.0.0/include/sys/_types.h:68:9: error: unknown type name '__darwin_natural_t'
warning: [email protected]: typedef __darwin_natural_t __darwin_mach_port_name_t; /* Used by mach */
warning: [email protected]:         ^
warning: [email protected]: /nix/store/apgxk5abmyyc4b8xydd5ghf4fpb5shkl-libSystem-11.0.0/include/sys/_types.h:70:9: error: unknown type name '__uint16_t'; did you mean '__ui>
warning: [email protected]: typedef __uint16_t      __darwin_mode_t;        /* [???] Some file attributes */
warning: [email protected]:         ^
warning: [email protected]: note: '__uint128_t' declared here
warning: [email protected]: /nix/store/apgxk5abmyyc4b8xydd5ghf4fpb5shkl-libSystem-11.0.0/include/sys/_types.h:71:9: error: unknown type name '__int64_t'; did you mean '__int>
warning: [email protected]: typedef __int64_t       __darwin_off_t;         /* [???] Used for file sizes */
warning: [email protected]:         ^
warning: [email protected]: note: '__int128_t' declared here
warning: [email protected]: /nix/store/apgxk5abmyyc4b8xydd5ghf4fpb5shkl-libSystem-11.0.0/include/sys/_types.h:72:9: error: unknown type name '__int32_t'; did you mean '__int>
warning: [email protected]: typedef __int32_t       __darwin_pid_t;         /* [???] process and group IDs */
warning: [email protected]:         ^
warning: [email protected]: note: '__int128_t' declared here
warning: [email protected]: /nix/store/apgxk5abmyyc4b8xydd5ghf4fpb5shkl-libSystem-11.0.0/include/sys/_types.h:73:9: error: unknown type name '__uint32_t'; did you mean '__ui>
warning: [email protected]: typedef __uint32_t      __darwin_sigset_t;      /* [???] signal set */
warning: [email protected]:         ^
warning: [email protected]: note: '__uint128_t' declared here
warning: [email protected]: /nix/store/apgxk5abmyyc4b8xydd5ghf4fpb5shkl-libSystem-11.0.0/include/sys/_types.h:74:9: error: unknown type name '__int32_t'; did you mean '__int>
warning: [email protected]: typedef __int32_t       __darwin_suseconds_t;   /* [???] microseconds */
warning: [email protected]:         ^
warning: [email protected]: note: '__int128_t' declared here
warning: [email protected]: /nix/store/apgxk5abmyyc4b8xydd5ghf4fpb5shkl-libSystem-11.0.0/include/sys/_types.h:75:9: error: unknown type name '__uint32_t'; did you mean '__ui>
warning: [email protected]: typedef __uint32_t      __darwin_uid_t;         /* [???] user IDs */
warning: [email protected]:         ^
warning: [email protected]: note: '__uint128_t' declared here
warning: [email protected]: /nix/store/apgxk5abmyyc4b8xydd5ghf4fpb5shkl-libSystem-11.0.0/include/sys/_types.h:76:9: error: unknown type name '__uint32_t'; did you mean '__ui>
warning: [email protected]: typedef __uint32_t      __darwin_useconds_t;    /* [???] microseconds */
warning: [email protected]:         ^
warning: [email protected]: note: '__uint128_t' declared here
warning: [email protected]: In file included from ../../src/llvm-project/compiler-rt/lib/profile/GCDAProfiling.c:25:
warning: [email protected]: In file included from /nix/store/apgxk5abmyyc4b8xydd5ghf4fpb5shkl-libSystem-11.0.0/include/fcntl.h:23:
warning: [email protected]: In file included from /nix/store/apgxk5abmyyc4b8xydd5ghf4fpb5shkl-libSystem-11.0.0/include/sys/fcntl.h:83:
warning: [email protected]: /nix/store/apgxk5abmyyc4b8xydd5ghf4fpb5shkl-libSystem-11.0.0/include/sys/_types/_size_t.h:31:9: error: unknown type name '__darwin_size_t'
warning: [email protected]: typedef __darwin_size_t        size_t;
warning: [email protected]:         ^
warning: [email protected]: In file included from ../../src/llvm-project/compiler-rt/lib/profile/GCDAProfiling.c:25:
warning: [email protected]: In file included from /nix/store/apgxk5abmyyc4b8xydd5ghf4fpb5shkl-libSystem-11.0.0/include/fcntl.h:23:
warning: [email protected]: In file included from /nix/store/apgxk5abmyyc4b8xydd5ghf4fpb5shkl-libSystem-11.0.0/include/sys/fcntl.h:358:
warning: [email protected]: In file included from /nix/store/apgxk5abmyyc4b8xydd5ghf4fpb5shkl-libSystem-11.0.0/include/sys/_types/_timespec.h:31:
warning: [email protected]: /nix/store/apgxk5abmyyc4b8xydd5ghf4fpb5shkl-libSystem-11.0.0/include/machine/types.h:39:2: error: architecture not supported
warning: [email protected]: #error architecture not supported
warning: [email protected]:  ^
warning: [email protected]: In file included from ../../src/llvm-project/compiler-rt/lib/profile/GCDAProfiling.c:25:
warning: [email protected]: In file included from /nix/store/apgxk5abmyyc4b8xydd5ghf4fpb5shkl-libSystem-11.0.0/include/fcntl.h:23:
warning: [email protected]: In file included from /nix/store/apgxk5abmyyc4b8xydd5ghf4fpb5shkl-libSystem-11.0.0/include/sys/fcntl.h:358:
warning: [email protected]: /nix/store/apgxk5abmyyc4b8xydd5ghf4fpb5shkl-libSystem-11.0.0/include/sys/_types/_timespec.h:35:2: error: unknown type name '__darwin_time_t'
warning: [email protected]:         __darwin_time_t tv_sec;
warning: [email protected]:         ^
warning: [email protected]: fatal error: too many errors emitted, stopping now [-ferror-limit=]
warning: [email protected]: 20 errors generated.

error: failed to run custom build command for `profiler_builtins v0.0.0 (/private/tmp/nix-build-rustc-1.80.1.drv-0/rustc-1.80.1-src/library/profiler_builtins)`

@Artturin Artturin changed the title rustc: Enable profiler on darwin rustc: Enable profiler on more platforms Sep 19, 2024
@Artturin
Copy link
Member Author

Split out the stdenv.targetPlatform.isLinux fix. #343059

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: darwin Running or building packages on Darwin 6.topic: rust 10.rebuild-darwin: 501+ 10.rebuild-darwin: 5001+ 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants