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

Pin the inkwell version to latest stable on master #11

Merged
merged 5 commits into from
Jul 15, 2024

Conversation

tewaro
Copy link
Contributor

@tewaro tewaro commented Jul 6, 2024

The current master branch of inkwell seems to change a lot and for compatibility issues it might help to pin the commit.

I was having trouble building this as well because the macro for llvm_versions now uses different syntax so I fixed that as well.

Please let me know what steps I can take to help get this merged, I really like the idea of this tool and this allows me to use it for my research.

Copy link
Owner

@jamesmth jamesmth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, we should pin to a specific commit, I overlooked that!

Copy link
Owner

@jamesmth jamesmth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most MacOS tests failed and some Linux tests failed as well.

For MacOS, it seems that TheDan64/inkwell@5c9f7fc fixes the issue. For Linux, however, we may have to pin to an older commit (one that would not break MacOS builds either).

It may help you to know that I was using TheDan64/inkwell@5d5a531 the last time the CI was run and succeeded.

@tewaro
Copy link
Contributor Author

tewaro commented Jul 13, 2024

Cool I'll start the search from there thanks!

@tewaro
Copy link
Contributor Author

tewaro commented Jul 13, 2024

is there some sort of docker style tests for this? the different linux instances/would you be opposed to introducing that so I can build the linux builds locally?

@jamesmth
Copy link
Owner

There are no docker images for testing the Linux builds, since I wanted to keep the CI workflow similar between MacOS, Windows and Linux.

If you look at the .github/workflows/linux.yml file, you can reproduce the Linux test locally with a few commands. Running the test 4 (which fails) with llvm-12 for instance:

$ wget -O llvm.tar.gz https://github.com/jamesmth/llvm-project/releases/download/v12.0.1-rust-1.55/llvm-lld-12.0.1-rust-1.55-linux-x86_64.tar.gz
$ tar xf llvm.tar.gz
$ LLVM_SYS_120_PREFIX=$PWD/llvm cargo b --manifest-path tests/plugins/Cargo.toml -p plugin* --no-default-features --features target-x86,llvm12-0
$ llvm/bin/opt --load-pass-plugin="tests/plugins/target/debug/libplugin4.so" --passes="mpass,function(fpass)" tests/test.ll -disable-output

@jamesmth
Copy link
Owner

Anyway, I fixed the issue with Linux tests with the following modifications:

Replacing these lines:

unsafe {
let res = crate::get_function_analysis_cached_result(
self.inner,
id,
function.as_value_ref().cast(),
);
(!res.is_null()).then_some(Box::leak(Box::from_raw(res.cast())))
}

With:

let res = crate::get_function_analysis_cached_result(
     self.inner,
     id,
     function.as_value_ref().cast(),
);

if !res.is_null() {
    let res = unsafe { Box::leak(Box::from_raw(res.cast())) };
    Some(res)
} else {
    None
}}

And replacing this line:

unsafe { (!res.is_null()).then_some(Box::leak(Box::from_raw(res.cast()))) }

With:

if !res.is_null() {
    let res = unsafe { Box::leak(Box::from_raw(res.cast())) };
    Some(res)
} else {
    None
}

If you apply these changes it should pass the CI tests (hopefully).

Copy link
Owner

@jamesmth jamesmth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just apply rustfmt and we are good to merge!

@jamesmth jamesmth merged commit bf6b4d7 into jamesmth:master Jul 15, 2024
41 checks passed
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 this pull request may close these issues.

2 participants