Bug 1757548 - missing link attributes on Rust to Lua externs
Summary: missing link attributes on Rust to Lua externs
Keywords:
Status: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: suricata
Version: 37
Hardware: ppc64le
OS: Linux
unspecified
high
Target Milestone: ---
Assignee: Steve Grubb
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PPCTracker
TreeView+ depends on / blocked
 
Reported: 2019-10-01 19:27 UTC by Steve Grubb
Modified: 2022-08-30 12:14 UTC (History)
10 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-11-30 18:53:44 UTC
Type: Bug


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
IBM Linux Technology Center 181990 0 None None None 2019-10-19 08:43:38 UTC

Description Steve Grubb 2019-10-01 19:27:42 UTC
When compiling a program written for rust on ppc64le, I get the following error:

Description of problem:
  = note: /usr/bin/ld: /builddir/build/BUILD/suricata-5.0.0-rc1/rust/target/debug/deps/suricata-e6597667108d11ec.2kpivclfzlxj8xrv.rcgu.o: in function `suricata::json::Json::object':
          /builddir/build/BUILD/suricata-5.0.0-rc1/rust/src/json.rs:54: undefined reference to `json_object'
          /usr/bin/ld: /builddir/build/BUILD/suricata-5.0.0-rc1/rust/target/debug/deps/suricata-e6597667108d11ec.2kpivclfzlxj8xrv.rcgu.o: in function `suricata::json::Json::array':
          /builddir/build/BUILD/suricata-5.0.0-rc1/rust/src/json.rs:60: undefined reference to `json_array'
          /usr/bin/ld: /builddir/build/BUILD/suricata-5.0.0-rc1/rust/target/debug/deps/suricata-e6597667108d11ec.2kpivclfzlxj8xrv.rcgu.o: in function `suricata::json::Json::set':
          /builddir/build/BUILD/suricata-5.0.0-rc1/rust/src/json.rs:82: undefined reference to `json_object_set_new'
          /usr/bin/ld: /builddir/build/BUILD/suricata-5.0.0-rc1/rust/target/debug/deps/suricata-e6597667108d11ec.2kpivclfzlxj8xrv.rcgu.o: in function `suricata::json::Json::set_string':
          /builddir/build/BUILD/suricata-5.0.0-rc1/rust/src/json.rs:100: undefined reference to `json_string'
          /usr/bin/ld: /builddir/build/BUILD/suricata-5.0.0-rc1/rust/src/json.rs:98: undefined reference to `json_object_set_new'
          /usr/bin/ld: /builddir/build/BUILD/suricata-5.0.0-rc1/rust/target/debug/deps/suricata-e6597667108d11ec.2kpivclfzlxj8xrv.rcgu.o: in function `suricata::json::Json::set_integer':
          /builddir/build/BUILD/suricata-5.0.0-rc1/rust/src/json.rs:108: undefined reference to `json_integer'
          /usr/bin/ld: /builddir/build/BUILD/suricata-5.0.0-rc1/rust/src/json.rs:106: undefined reference to `json_object_set_new'
          /usr/bin/ld: /builddir/build/BUILD/suricata-5.0.0-rc1/rust/target/debug/deps/suricata-e6597667108d11ec.2kpivclfzlxj8xrv.rcgu.o: in function `suricata::json::Json::array_append_string':
          /builddir/build/BUILD/suricata-5.0.0-rc1/rust/src/json.rs:127: undefined reference to `json_string'
          /usr/bin/ld: /builddir/build/BUILD/suricata-5.0.0-rc1/rust/src/json.rs:127: undefined reference to `json_array_append_new'
          collect2: error: ld returned 1 exit status
          
error: aborting due to previous error
error: Could not compile `suricata`.

This compiles fine on other arches. I'm wondering if something is missing on the ppc64le that other arches have. This is against the rawhide version.

How reproducible:
Every time

Steps to Reproduce:
1. Build rawhide version of suricata on ppc64le system


Actual results:
https://kojipkgs.fedoraproject.org//work/tasks/8303/37988303/build.log

Comment 1 Josh Stone 2019-10-01 19:47:18 UTC
Those symbols are supposed to be provided by libjansson, right? I don't see -ljansson on the link line.

But this is only in "cargo test" -- are the Json functions not involved in testing? Perhaps other arches are doing a better job of pruning this?

Comment 2 Josh Stone 2019-10-01 22:03:53 UTC
I reproduced this with rust-1.37.0-1.fc30.ppc64le + llvm-libs-8.0.0-6.fc30.ppc64le, so the problem is not rawhide's newer toolchain.

It works if I add a link attribute in src/json.rs:

/// Expose the jansson functions we need.
#[link(name = "jansson")]
extern {
    fn json_object() -> *mut JsonT;
    ...
}

Comment 3 Steve Grubb 2019-10-03 20:39:05 UTC
I did a new build that let's all arches finish instead of fail-fast:
https://koji.fedoraproject.org/koji/taskinfo?taskID=38039091

ppc64le is the only one failing. I wonder if something is different on that platform?

Comment 4 Cameron Kaiser 2019-10-17 22:30:24 UTC
Could this be related to bug 1756838?

Comment 5 Ben Cotton 2020-02-11 17:51:15 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 32 development cycle.
Changing version to 32.

Comment 6 Dan Horák 2020-05-05 09:13:11 UTC
The problem is still in Rawhide.

Josh, what component needs to be fixed? Is it rust, libjansson or something else? Where your workaround should go in?

Comment 7 Josh Stone 2020-05-05 19:49:00 UTC
(In reply to Dan Horák from comment #6)
> The problem is still in Rawhide.
> 
> Josh, what component needs to be fixed? Is it rust, libjansson or something
> else? Where your workaround should go in?

That was in suricata's src/json.rs, and in fact I think that's correct to require, not just a workaround.
(But I still don't really know why only ppc64le is affected.)

Comment 8 Ben Cotton 2020-08-11 15:20:32 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 33 development cycle.
Changing version to 33.

Comment 9 Ben Cotton 2021-11-04 13:54:47 UTC
This message is a reminder that Fedora 33 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora 33 on 2021-11-30.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
Fedora 'version' of '33'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 33 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 10 Ben Cotton 2021-11-04 14:24:12 UTC
This message is a reminder that Fedora 33 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora 33 on 2021-11-30.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
Fedora 'version' of '33'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 33 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 11 Ben Cotton 2021-11-04 15:21:50 UTC
This message is a reminder that Fedora 33 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora 33 on 2021-11-30.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
Fedora 'version' of '33'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 33 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 12 Ben Cotton 2021-11-30 18:53:44 UTC
Fedora 33 changed to end-of-life (EOL) status on 2021-11-30. Fedora 33 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.

Comment 13 Dan Horák 2022-03-21 14:48:59 UTC
something is still broken with suricata or rust, suricata-6.0.4-5.fc37 fails to build using rust-1.59.0-2.fc37.ppc64le in %check due missing liblua functions ...

Comment 14 Josh Stone 2022-03-21 19:02:07 UTC
AFAICS, this is a similar situation as before. The file suricata-6.0.4/rust/src/lua.rs has an extern block with no link attribute, where it should have something like #[link(name = "lua")].

It looks like lua is not actually used by any of suricata's Rust tests, so that bit of code is probably getting pruned on most arches. For whatever reason, it's surviving to the link step on ppc64le though. I don't know if that's LLVM failing to remove that dead code early, or binutils ld failing to gc it, or what.

But IMO it would still be expected to have a proper link attribute.

Comment 15 Steve Grubb 2022-03-21 21:26:15 UTC
OK, I'll pass this along. Thanks for the analysis.

Comment 16 Ben Cotton 2022-08-09 13:10:39 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 37 development cycle.
Changing version to 37.


Note You need to log in before you can comment on or make changes to this bug.