dtolnay / dtolnay/linkme

Missing symbol on Linux

Open
#107 3 comments 3 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
890
Forks
46
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the ROLE_CHANGED_SERVER_EVENTS_LIST declaration and role_changed_callback shown in the report, then reproduce loading the module on Linux and inspect the missing __start_linkme_ROLE_CHANGED_SERVER_EVENTS_LIST symbol. Done means the module loads on Linux without the missing-symbol error and the role-change callbacks still work.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.