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

Missing symbol on Linux #107

Open
j8-redis opened this issue Dec 5, 2024 · 2 comments
Open

Missing symbol on Linux #107

j8-redis opened this issue Dec 5, 2024 · 2 comments

Comments

@j8-redis
Copy link

j8-redis commented Dec 5, 2024

I've inherited a project and I'm trying to compile and use it on Linux instead of MacOS.
There are several such declarations:
pub static ROLE_CHANGED_SERVER_EVENTS_LIST: [fn(&Context, ServerRole)] = [..];
Which are subsequently called thusly:
extern "C" fn role_changed_callback(
ctx: *mut raw::RedisModuleCtx,
_eid: raw::RedisModuleEvent,
subevent: u64,
_data: *mut ::std::os::raw::c_void,
) {
let new_role = if subevent == raw::REDISMODULE_EVENT_REPLROLECHANGED_NOW_MASTER {
ServerRole::Primary
} else {
ServerRole::Replica
};
let ctx = Context::new(ctx);
ROLE_CHANGED_SERVER_EVENTS_LIST.iter().for_each(|callback| {
callback(&ctx, new_role);
});
}
All of this works fine under MacOS, but when we try to load the module in Linux we receive an error that the following symbol is missing:
__start_linkme_ROLE_CHANGED_SERVER_EVENTS_LIST

Thanks

@MeirShpilraien
Copy link

If it helps. The problem seems to be related to building using the nightly toolchain. I build with the stable toolchain and everything works fine, when I build with the nightly toolchain I get this error.

@j8-redis
Copy link
Author

j8-redis commented Dec 9, 2024

Another datapoint is that a binary cross-compiled on Mac for linux-x86_64 works fine.

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

No branches or pull requests

2 participants