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

CLibrary annotation with requireStatic doesn't include library #4653

Closed
davecramer opened this issue Jun 18, 2022 · 3 comments
Closed

CLibrary annotation with requireStatic doesn't include library #4653

davecramer opened this issue Jun 18, 2022 · 3 comments
Assignees

Comments

@davecramer
Copy link

davecramer commented Jun 18, 2022

With the following code

@CLibrary(value = "test1", requireStatic = true)
public class HelloWorld {

    @CLibrary(value = "test")
    public static void main(String[] args) {

    }
    
    @CEntryPoint(name="addJ")
    static int addJ(IsolateThread thread, int a, int b) {
        return a+b;
    }
    @CEntryPoint(name="subtractJ")
    static int subtractJ( IsolateThread thread, int a, int b) { return a-b; }
}

The linker does try to link test, but not test1

@davecramer davecramer changed the title Is it possible to add an object file when creating a shared library CLibrary annotation with requireStatic doesn't include library Jun 18, 2022
@oubidar-Abderrahim oubidar-Abderrahim self-assigned this Jun 22, 2022
@oubidar-Abderrahim
Copy link
Member

Hi, Thank you for reporting this, could you please share what version of GraalVM you're using? what OS you're using? and the command used to reproduce this issue? Thank you

@davecramer
Copy link
Author

Sad that you had to ask for this. I routinely ask my bug reporters for the same :(

/usr/lib/jvm/graalvm-ce-java11-22.1.0/bin/native-image --verbose -cp build/libs//testnative-1.0-SNAPSHOT.jar org.postgresql.HelloWorld

answers 2 of the questions

uname -a
Linux LAPTOP-FQV2GSJC 5.10.60.1-microsoft-standard-WSL2 #1 SMP Wed Aug 25 23:20:18 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
davec@LAPTOP-FQV2GSJC:/mnt/c/projects/testnative$ cat /etc/issue
Ubuntu 20.04.4 LTS \n \l

answers the last

@oubidar-Abderrahim
Copy link
Member

Sorry for this super late response, I believe you shouldn't use 2 CLibrary annotations with different library names. Two annotations means you are linking two different libraries. In this case, test1 is linked statically and test is linked dynamically.

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

No branches or pull requests

2 participants