Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cross-compilation fails for custom target #1509

Open
semaraugusto opened this issue Apr 23, 2024 · 0 comments · May be fixed by #1510
Open

Cross-compilation fails for custom target #1509

semaraugusto opened this issue Apr 23, 2024 · 0 comments · May be fixed by #1510

Comments

@semaraugusto
Copy link

semaraugusto commented Apr 23, 2024

I'm compiling tokenizers into a custom target that's not x86 nor unstable_wasm. I cannot use oniguruma but it would be possible to use the fancy-regex library instead.

Solution would be as simple as changing tokenizers/src/utils/mod.rs from

#[cfg(feature = "unstable_wasm")]
mod fancy;
#[cfg(feature = "unstable_wasm")]
pub use fancy::SysRegex;
#[cfg(not(feature = "unstable_wasm"))]
mod onig;
#[cfg(not(feature = "unstable_wasm"))]
pub use crate::utils::onig::SysRegex;

to

#[cfg(feature = "fancy-regex")]
mod fancy;
#[cfg(feature = "fancy-regex")]
pub use fancy::SysRegex;
#[cfg(feature = "onig")]
mod onig;
#[cfg(feature = "onig")]
pub use crate::utils::onig::SysRegex;

Since onig is enabled by default and unstable_wasm "requires" fancy-regex, this change would not break anything that I'm aware of.
It would only break if users didn't set either flag of the regex features or if they set both simultaneously.

This change would also make it easier to switch between regex implementations and provide new ones in the future.

I'm opening a pull-request with said changes, let me know if there are any issues with it

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

Successfully merging a pull request may close this issue.

1 participant