rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
98.66k stars 12.75k forks source link

openindiana filename confusion for '*-x86_64-sun-solaris.tar.xz' #90393

Open 3eka opened 3 years ago

3eka commented 3 years ago

Hi,

just wanted to try to build latest rustc on openindiana:

:; git clone https://github.com/rust-lang/rust.git && cd rust
:; python3 x.py setup
Updating only changed submodules
Submodules updated in 0.47 seconds
extracting /nobackup/SFW_build/rust/build/cache/2021-10-22/rust-std-beta-x86_64-sun-solaris.tar.xz
Traceback (most recent call last):
  File "/nobackup/SFW_build/rust/x.py", line 27, in <module>
    bootstrap.main()
  File "/nobackup/SFW_build/rust/src/bootstrap/bootstrap.py", line 1252, in main
    bootstrap(help_triggered)
  File "/nobackup/SFW_build/rust/src/bootstrap/bootstrap.py", line 1218, in bootstrap
    build.download_toolchain()
  File "/nobackup/SFW_build/rust/src/bootstrap/bootstrap.py", line 415, in download_toolchain
    self._download_component_helper(filename, "rustc", tarball_suffix, stage0)
  File "/nobackup/SFW_build/rust/src/bootstrap/bootstrap.py", line 553, in _download_component_helper
    get(
  File "/nobackup/SFW_build/rust/src/bootstrap/bootstrap.py", line 35, in get
    raise RuntimeError("src/stage0.json doesn't contain a checksum for {}".format(url))
RuntimeError: src/stage0.json doesn't contain a checksum for dist/2021-10-22/rustc-beta-x86_64-sun-solaris.tar.xz

note difference: rust-std-beta-x86_64-sun-solaris.tar.xz vs rustc-beta-x86_64-sun-solaris.tar.xz

Why it downloads one file, and then tries to use another one? For example:

:; grep x86_64-sun-solaris.tar.xz src/stage0.json
    "dist/2021-10-22/rust-std-beta-x86_64-sun-solaris.tar.xz": "3a7d686102d9f2469e180a80679db52b6c8dc8ca35adf3e50a25b7bd35f4c6a5",

Am I doing something wrong? Regards.

hkratz commented 3 years ago

./x.py setup --build x86_64-unknown-illumos should work. The build target auto-detection incorrectly assumes the deprecated build triple x86_64-sun-solaris which is only supported for cross-compilation from other platforms.

3eka commented 3 years ago

Thanks, I should guess myself. Will give it a try.

3eka commented 3 years ago

Hi, tried, and after hour or two, it has failed... Failure output is 3,1MG (uncompressed)... This was command:

:; python3 x.py build --build x86_64-unknown-illumos --j 2 |& tee /tmp/rust-compile.txt

not sure if you are interested in log. Regards.

hkratz commented 3 years ago

The actual error should be in the last 100-200 lines. So those should be enough.

3eka commented 3 years ago

Here you are:

rust-compile.last_200_lines.txt

...
Building stage0 compiler artifacts (x86_64-unknown-illumos -> x86_64-unknown-illumos)
   Compiling rustc_driver v0.0.0 (/nobackup/SFW_build/rust/compiler/rustc_driver)
error: linking with `gcc` failed: exit status: 1
...
  = note: Text relocation remains                 referenced
              against symbol    offsetin file
          vtable for llvm::format_object<float> 0x62      /nobackup/SFW_build/rust/build/x86_64-unknown-illumos/stage0-rustc/x86_64-unknown-illumos/release/deps/librustc_llvm-b3854e7bc8fbee87.rlib(AArch64I
nstPrinter.cpp.o)
          vtable for llvm::format_object<float> 0x5d      /nobackup/SFW_build/rust/build/x86_64-unknown-illumos/stage0-rustc/x86_64-unknown-illumos/release/deps/librustc_llvm-b3854e7bc8fbee87.rlib(AArch64InstPrinter.cpp.o)
...

plenty of it (last 200 in the attached file)

THanks

hkratz commented 3 years ago

This seems to be a Solaris/Illumos-specific ld error linking in the llvm library, so I am not sure if I can help here. One idea would be to build llvm locally on your machine by putting this in your config.toml file:

[llvm]
download-ci-llvm = false

Of course this will make the build take even longer.

3eka commented 3 years ago

Thanks @hkratz, anyway, I will give it a try...

3eka commented 3 years ago

It has failed (after setting in config.toml were applied:

...
error: could not compile `rustc_driver` due to previous error
Build completed unsuccessfully in 2:05:13

to me, it seems with identical error...

So, I am also out of ideas. Thanks anyway. Regards.

3eka commented 3 years ago

FYI, SmartOS has it built (see https://www.pkgsrc.org), but using different methods (I would say). I was just curious if it could be built with instructions from github.

Will do investigation, and give it a try later. Regards.

3eka commented 3 years ago

@hkratz ; would be possible to specify different Compiler, etc via config.toml:

#cc = "cc" (path)
#cxx = "c++" (path)
#ar = "ar" (path)

For example, if there is GCC 9 present under /usr/gcc/9/bin/gcc what would be cc value? Regards.

hkratz commented 3 years ago

Yes, like this:

cc = "/usr/gcc/9/bin/gcc"
cxx = "/usr/gcc/9/bin/g++"
ar = "/usr/gcc/9/bin/ar"
3eka commented 3 years ago

Hmm, (cloned rust from git again), and

:; python3 x.py build --build x86_64-unknown-illumos
...
   Compiling cmake v0.1.44
   Compiling quote v1.0.7
   Compiling filetime v0.2.14
   Compiling time v0.1.43
   Compiling num_cpus v1.13.0
   Compiling aho-corasick v0.7.18
   Compiling bstr v0.2.13
   Compiling regex v1.5.4
   Compiling globset v0.4.5
   Compiling ignore v0.4.17
   Compiling merge_derive v0.1.0
   Compiling merge v0.1.0
   Compiling toml v0.5.7
    Finished dev [unoptimized] target(s) in 56.03s
failed to parse TOML configuration 'config.toml': unknown field `cc`, expected one of `optimize`, `debug`, `codegen-units`, `codegen-units-std`, `debug-assertions`, `debug-assertions-std`, `overflow-checks`, `overflow-checks-std`, `debug-logging`, `debuginfo-level`, `debuginfo-level-rustc`, `debuginfo-level-std`, `debuginfo-level-tools`, `debuginfo-level-tests`, `run-dsymutil`, `backtrace`, `incremental`, `parallel-compiler`, `default-linker`, `channel`, `description`, `musl-root`, `rpath`, `verbose-tests`, `optimize-tests`, `codegen-tests`, `ignore-git`, `dist-src`, `save-toolstates`, `codegen-backends`, `lld`, `use-lld`, `llvm-tools`, `deny-warnings`, `backtrace-on-ice`, `verify-llvm-ir`, `thin-lto-import-instr-limit`, `remap-debuginfo`, `jemalloc`, `test-compare-mode`, `llvm-libunwind`, `control-flow-guard`, `new-symbol-mangling`, `profile-generate`, `profile-use`, `download-rustc` for key `rust` at line 708 column 1
Build completed unsuccessfully in 0:01:37

with:

:; grep -E "(cc|cxx|ar) =" config.toml | grep -v ^#
cc = "/usr/gcc/9/bin/gcc"
cxx = "/usr/gcc/9/bin/g++"
ar = "/usr/gcc/9/bin/gcc-ar"

so, I have probably done something wrong. Thanks for being patient. Regards.

hkratz commented 3 years ago

It must be in a target section, like this:

[target.x86_64-unknown-illumos]
cc = "/usr/gcc/9/bin/gcc"
cxx = "/usr/gcc/9/bin/g++"
ar = "/usr/gcc/9/bin/gcc-ar"
3eka commented 3 years ago

Thanks, that has helped, but compilation died (see https://app.box.com/s/ykkfjp2j8g03fs81oipdo6zzbosn88cg) log file.

:; grep -v ^# config.toml | grep .
changelog-seen = 2
[llvm]
download-ci-llvm = false
[build]
[install]
prefix = "/pz/SFW"
[rust]
[target.x86_64-unknown-illumos]
cc = "/usr/gcc/9/bin/gcc"
cxx = "/usr/gcc/9/bin/g++"
ar = "/usr/gcc/9/bin/gcc-ar"
[dist]

was configuration . If you have no idea, let me know (again, this is just my curiosity, not so important atm).

Regards.

P.S. I will delete log file next Wednesday.

inferiorhumanorgans commented 1 year ago

For @3eka's issue with undefined symbols setting target.x86_64-pc-solaris.ar and target.x86_64-pc-solaris.ranlib in config.toml to point at newer toolchain bits should help things along. I'm not sure what OpenIndiana comes with but both GNU binutils 2.40 and LLVM 14 worked for me where the stock Apple stuff did not. See also #114162.