Skip to content
This repository has been archived by the owner on Nov 12, 2022. It is now read-only.

Updating Bindgen Instructions for Glue #563

Open
Redfire75369 opened this issue Nov 1, 2022 · 3 comments
Open

Updating Bindgen Instructions for Glue #563

Redfire75369 opened this issue Nov 1, 2022 · 3 comments

Comments

@Redfire75369
Copy link
Contributor

Redfire75369 commented Nov 1, 2022

I was looking to add a wrapper for JSExternalStringCallbacks so it could be used for rust, and I've updated jsglue.cpp for it.

I was wondering how I can update glue.rs since it seems to be automatically generated. I was looking at the instructions in comments in gen.py but it seems to be very outdated.

# To generate jsglue:
# DYLD_LIBRARY_PATH=~/versioned/rust-mozilla/build/llvm/x86_64-apple-darwin/Release+Asserts/lib/ ~/versioned/rust-bindgen/bindgen ./jsglue.c -I ../../build/src/mozjs/dist/include/ -match glue > glue.rs

# jdm used
# LD_LIBRARY_PATH=~/sdb/rust/build/llvm/x86_64-unknown-linux-gnu/Release+Asserts/lib/ ~/sdb/rust-bindgen/bindgen ./jsglue.c -I ../../build/src/mozjs/dist/include/ -isystem /usr/lib/gcc/x86_64-redhat-linux/4.7.0/include/ -match glue >glue.rs
# on Fedora 17
#
# and remember to mark all generated functions as #[rust_stack]

I think it would be useful if we updated this so that anyone can modify jsglue.cpp easily.

Here's the change I was trying to make: Redfire75369@6893940

@jdm
Copy link
Member

jdm commented Nov 1, 2022

I actually strongly suspect that glue.rs has not been automatically generated for many years, and is only updated by hand.

@Redfire75369
Copy link
Contributor Author

Oh, that would certainly explain it.
It seems gen.py was last updated 10 years ago, which explains the wrong command line arguments and the usage of gcc 4.8.

@Redfire75369
Copy link
Contributor Author

Redfire75369 commented Nov 1, 2022

So far, the furthest I've gotten is this, but that seems to maybe generate a bunch of stuff that's not needed?

// cwd: ./src
bindgen jsglue.cpp --allow-file jsglue.cpp -- -std=c++17 -I ../target/debug/build/mozjs-1d605e44d5141b22/out -I ../target/debug/build/mozjs_sys-253b4187986dd3b4/out/build/dist/include

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants