[Bug 2049904] Re: meson x rustc library ordering issue

Jussi Pakkanen 2049904 at bugs.launchpad.net
Mon Feb 19 20:03:18 UTC 2024


> and it's rustc itself that emits `-lc` at the wrong location.

My reading of the issue is that Meson does not specify anything
regarding `-lc`, but `rustc` adds it by itself. Is this correct?

If yes and Meson starts putting `-Clink-arg=-lc` on the command line,
does `rustc` still add its own `-lc` or not?

Depending on the answers to the questions above, there may be two
different bugs at play:

1. `rustc` puts its own `-lc` in the wrong place
2. Meson does not tell `rustc` that the libraries it is linking against need to be linked against the C runtime lib

If the bug is the former, then it should be fixed in `rustc`. If it is
the latter then it should arguably be fixed in Meson. Even in this case
it would be better for `rustc` to have a compiler argument like `--link-
against-system-C-library` as opposed to a plain `-lc` because it is more
declarative than imperative.

In any case it would be nice to get comments from `rustc` developers or
maintainers. I don't know any and I don't think they have commented on
this issue.

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to rustc in Ubuntu.
https://bugs.launchpad.net/bugs/2049904

Title:
  meson x rustc library ordering issue

Status in meson package in Ubuntu:
  New
Status in rustc package in Ubuntu:
  New
Status in meson package in Debian:
  New

Bug description:
  meson 1.3.1-1 is stuck in -proposed with failing autopkgtests on
  arm64.

  This is failing the same way in debian.

  Two tests in the test suite are failing when compiling (apparently for
  the same reason):

  2308s   = note: /usr/bin/ld: libcpp.a.p/lib.cpp.o: undefined reference to symbol '__stack_chk_guard@@GLIBC_2.17'
  2308s           /usr/bin/ld: /lib/ld-linux-aarch64.so.1: error adding symbols: DSO missing from command line
  2308s           collect2: error: ld returned 1 exit status
  2308s
  2308s   = note: some `extern` functions couldn't be found; some native libraries may need to be installed or havetheir path specified
  2308s   = note: use the `-l` flag to specify native libraries to link
  2308s   = note: use the `cargo:rustc-link-lib` directive to specify the native libraries to link with Cargo (see https://doc.rust-lang.org/cargo/reference/build-scripts.html#cargorustc-link-libkindname)

  It looks like this is linked to a newly added or missing `-fstack-
  protector-all` flag.

  Some research on this error lead me to try adding this `-fstack-
  protected` flag when building on arm64.

  See my patch [0] and the package in my ppa [1].

  But autopkgtests are still failing [2] and it looks like my flag is
  ignored. I may have missed something in the meson syntax.

  [0] https://launchpadlibrarian.net/710064457/meson_1.3.1-1ubuntu1_1.3.1-1ubuntu2.diff.gz
  [1] https://launchpad.net/~upils/+archive/ubuntu/test-ppa/+packages
  [2] https://autopkgtest.ubuntu.com/results/autopkgtest-noble-upils-test-ppa/noble/arm64/m/meson/20240119_115804_82043@/log.gz

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/meson/+bug/2049904/+subscriptions




More information about the foundations-bugs mailing list