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

LLVMTargetParser doesn't link against libkstat on Solaris/SPARC #64186

Open
inferiorhumanorgans opened this issue Jul 28, 2023 · 0 comments
Open

Comments

@inferiorhumanorgans
Copy link

In trying to cross compile rust macos → solaris (SPARCv9 and x86-64) I've run into an issue on the SPARC side of things where the build fails with these errors:

/Users/alex/cross/gnu-solaris11/lib/gcc/sparcv9-sun-solaris2.11/11.2.0/../../../../sparcv9-sun-solaris2.11/bin/ld: /Users/alex/cross/rust-1.70.0/build/x86_64-apple-darwin/stage1-rustc/sparcv9-sun-solaris/release/deps/librustc_driver-4d9f640bd5851ea5.so: undefined reference to `kstat_data_lookup'
/Users/alex/cross/gnu-solaris11/lib/gcc/sparcv9-sun-solaris2.11/11.2.0/../../../../sparcv9-sun-solaris2.11/bin/ld: /Users/alex/cross/rust-1.70.0/build/x86_64-apple-darwin/stage1-rustc/sparcv9-sun-solaris/release/deps/librustc_driver-4d9f640bd5851ea5.so: undefined reference to `kstat_open'
/Users/alex/cross/gnu-solaris11/lib/gcc/sparcv9-sun-solaris2.11/11.2.0/../../../../sparcv9-sun-solaris2.11/bin/ld: /Users/alex/cross/rust-1.70.0/build/x86_64-apple-darwin/stage1-rustc/sparcv9-sun-solaris/release/deps/librustc_driver-4d9f640bd5851ea5.so: undefined reference to `kstat_close'
/Users/alex/cross/gnu-solaris11/lib/gcc/sparcv9-sun-solaris2.11/11.2.0/../../../../sparcv9-sun-solaris2.11/bin/ld: /Users/alex/cross/rust-1.70.0/build/x86_64-apple-darwin/stage1-rustc/sparcv9-sun-solaris/release/deps/librustc_driver-4d9f640bd5851ea5.so: undefined reference to `kstat_read'
/Users/alex/cross/gnu-solaris11/lib/gcc/sparcv9-sun-solaris2.11/11.2.0/../../../../sparcv9-sun-solaris2.11/bin/ld: /Users/alex/cross/rust-1.70.0/build/x86_64-apple-darwin/stage1-rustc/sparcv9-sun-solaris/release/deps/librustc_driver-4d9f640bd5851ea5.so: undefined reference to `kstat_lookup'
collect2: error: ld returned 1 exit status

A quick check shows:

[~/cross/rust-1.70.0]$ ag kstat_lookup
src/llvm-project/llvm/lib/TargetParser/Host.cpp
1521:    ksp = kstat_lookup(kc, const_cast<char *>("cpu_info"), -1, NULL);

src/llvm-project/third-party/benchmark/src/sysinfo.cc
659:  kstat_t* ksp = kstat_lookup(kc, (char*)"cpu_info", -1, (char*)"cpu_info0");

[~/cross/rust-1.70.0]$ ag -F -- -lkstat
src/llvm-project/third-party/benchmark/docs/platform_specific_build_instructions.md
48:too (`-lkstat`).

So it looks like the benchmark docs mention end users should manually link against libkstat. However for libLLVMTargetParser it seems like it should ideally be linked against libkstat at build time (or at least documented).

inferiorhumanorgans pushed a commit to inferiorhumanorgans/rust that referenced this issue Jul 29, 2023
getHostCPUName calls into libkstat but as of
LLVM 16.0.6 libLLVMTargetParser is not explicitly
linked against libkstat causing builds to fail
due to undefined symbols.

See also: llvm/llvm-project#64186
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Nov 13, 2023
…rapper, r=cuviper

rustc_llvm: Link to libkstat on Solaris/SPARC

getHostCPUName calls into libkstat but as of
LLVM 16.0.6 libLLVMTargetParser is not explicitly
linked against libkstat causing builds to fail
due to undefined symbols.

See also: llvm/llvm-project#64186
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Nov 13, 2023
Rollup merge of rust-lang#114224 - inferiorhumanorgans:solaris-llvm-wrapper, r=cuviper

rustc_llvm: Link to libkstat on Solaris/SPARC

getHostCPUName calls into libkstat but as of
LLVM 16.0.6 libLLVMTargetParser is not explicitly
linked against libkstat causing builds to fail
due to undefined symbols.

See also: llvm/llvm-project#64186
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants