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

[linux-error]undefined symbol: s_mp_rand_source #582

Open
dtera opened this issue Nov 19, 2024 · 5 comments · May be fixed by #583
Open

[linux-error]undefined symbol: s_mp_rand_source #582

dtera opened this issue Nov 19, 2024 · 5 comments · May be fixed by #583

Comments

@dtera
Copy link

dtera commented Nov 19, 2024

I use libtommath in java, the error is as follows(it’s OK on mac os):

xxx/linux-x86_64/libjniTommath.so: undefined symbol: s_mp_rand_source
	at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
	at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:331)
	at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:197)
	at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:139)
	at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2418)
	at java.base/java.lang.Runtime.load0(Runtime.java:852)
	at java.base/java.lang.System.load(System.java:2025)
	at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:1779)
levitte added a commit to levitte/libtommath that referenced this issue Nov 19, 2024
mp_prime_rand.c uses s_mp_rand_source as well, so ensure that the
latter is defined on the conditions of the former as well.

Fixes libtom#582
@levitte
Copy link

levitte commented Nov 19, 2024

I looked at the source and found a case when this could happen. See #583

sjaeckel added a commit that referenced this issue Nov 19, 2024
In order to make `helper.pl` happy, change the ternary operator to an
if-else statement, otherwise it won't properly generate `tommath_class.h`.

This fixes #582

Signed-off-by: Steffen Jaeckel <[email protected]>
@dtera
Copy link
Author

dtera commented Nov 20, 2024

I looked at the source and found a case when this could happen. See #583
@levitte @sjaeckel The both of solutions above don't work. The same error is issued on Linux(it’s ok on Mac). By the way, this error is a runtime error, and there is no problem when compiling.

@dtera
Copy link
Author

dtera commented Nov 22, 2024

I tried to compile the source code with bazel and call it in java, and the problems above did not occur.

@sjaeckel
Copy link
Member

I also thought, "maybe optimizing a bit too much" and removing the symbol even though it's still required.

How exactly did you produce the error?

@dtera
Copy link
Author

dtera commented Nov 25, 2024

I also thought, "maybe optimizing a bit too much" and removing the symbol even though it's still required.

How exactly did you produce the

[Repo] https://github.com/dtera/bazel_java
Before running the java test shown below, you should first run mvn clean package to generate the native library.
image

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.

3 participants