Skip to content

Commit 013d51b

Browse files
authored
fix unresolved symbol issue when using latest Rust nightly (#87)
As of this writing, recent Rust `nightly` builds include a version of the `libc` crate that expects `wasi-libc` to define the following global variables, but `wasi-libc` defines them as preprocessor constants which aren't visible at link time, so we need to define them somewhere. Ideally, we should fix this upstream, but for now we work around it. This commit also addresses an unused field warning. Fixes #86 Signed-off-by: Joel Dice <joel.dice@fermyon.com>
1 parent fa666b9 commit 013d51b

3 files changed

Lines changed: 12 additions & 5 deletions

File tree

pyo3-config.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
implementation=CPython
2-
version=3.11
2+
version=3.12
33
shared=true
44
abi3=false
5-
lib_name=python3.11
5+
lib_name=python3.12
66
pointer_width=32
77
build_flags=
88
suppress_build_script_link_lines=false

runtime/src/lib.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1256,3 +1256,13 @@ pub mod dl {
12561256
LIBRARIES.0 = libraries;
12571257
}
12581258
}
1259+
1260+
// As of this writing, recent Rust `nightly` builds include a version of the `libc` crate that expects `wasi-libc`
1261+
// to define the following global variables, but `wasi-libc` defines them as preprocessor constants which aren't
1262+
// visible at link time, so we need to define them somewhere. Ideally, we should fix this upstream, but for now we
1263+
// work around it:
1264+
1265+
#[no_mangle]
1266+
static _CLOCK_PROCESS_CPUTIME_ID: u8 = 2;
1267+
#[no_mangle]
1268+
static _CLOCK_THREAD_CPUTIME_ID: u8 = 3;

src/summary.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ pub struct PackageName<'a> {
7373
#[derive(Clone)]
7474
pub struct MyInterface<'a> {
7575
pub id: InterfaceId,
76-
pub package: Option<PackageName<'a>>,
7776
pub name: &'a str,
7877
pub docs: Option<&'a str>,
7978
pub resource_directions: im_rc::HashMap<TypeId, Direction>,
@@ -559,7 +558,6 @@ impl<'a> Summary<'a> {
559558
self.resource_state = Some(ResourceState {
560559
direction,
561560
interface: Some(MyInterface {
562-
package,
563561
name: item_name,
564562
id: *id,
565563
docs: interface.docs.contents.as_deref(),
@@ -578,7 +576,6 @@ impl<'a> Summary<'a> {
578576
for (func_name, func) in &interface.functions {
579577
self.visit_function(
580578
Some(MyInterface {
581-
package,
582579
name: item_name,
583580
id: *id,
584581
docs: interface.docs.contents.as_deref(),

0 commit comments

Comments
 (0)