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

Undefined getdtablesize symbol #761

Closed
jperedadnr opened this issue Aug 28, 2020 · 4 comments
Closed

Undefined getdtablesize symbol #761

jperedadnr opened this issue Aug 28, 2020 · 4 comments
Assignees
Labels
android Android

Comments

@jperedadnr
Copy link
Contributor

Follow-up of gluonhq/gluonfx-maven-plugin#236, when using JMX.

@jperedadnr jperedadnr added the android Android label Aug 28, 2020
@jperedadnr
Copy link
Contributor Author

jperedadnr commented Aug 28, 2020

This HelloWorld class can be used to reproduce the issue:

package hello;

import com.sun.management.UnixOperatingSystemMXBean;

import java.lang.management.ManagementFactory;
import java.lang.management.OperatingSystemMXBean;

public class HelloWorld {

    private static final OperatingSystemMXBean osMxBean = ManagementFactory.getOperatingSystemMXBean();


    public static void main(String[] args) {
        System.out.println("Hello World!! " + osMxBean + ", Unix: " + (osMxBean instanceof UnixOperatingSystemMXBean));
        UnixOperatingSystemMXBean unixOsBean = (UnixOperatingSystemMXBean) osMxBean;;
        unixOsBean.getOpenFileDescriptorCount();
        System.exit(0);
    }

}

It produces this runtime error on Android:

==================== RUN TASK ====================
[SUB] --------- beginning of main
[SUB] --------- beginning of system
[SUB] V/GraalActivity( 4413): onCreate start, using Android Logging v1
[SUB] V/GraalActivity( 4413): onCreate done
[SUB] V/GraalActivity( 4413): onStart
[SUB] V/GraalActivity( 4413): onStart done
[SUB] V/GraalActivity( 4413): onResume
[SUB] V/GraalActivity( 4413): onResume done
[SUB] V/GraalActivity( 4413): surfaceCreated for com.gluonhq.helloandroid.MainActivity@2baa7b5
[SUB] V/GraalActivity( 4413): loading substrate library
[SUB] --------- beginning of crash
[SUB] E/AndroidRuntime( 4413): FATAL EXCEPTION: main
[SUB] E/AndroidRuntime( 4413): Process: hello.helloworld, PID: 4413
[SUB] E/AndroidRuntime( 4413): java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "getdtablesize" referenced by "/data/app/hello.helloworld-Db4RLY2UlsTroZ5k5pqaLg==/lib/arm64/libsubstrate.so"...
[SUB] E/AndroidRuntime( 4413):  at java.lang.Runtime.loadLibrary0(Runtime.java:1071)
[SUB] E/AndroidRuntime( 4413):  at java.lang.Runtime.loadLibrary0(Runtime.java:1007)
[SUB] E/AndroidRuntime( 4413):  at java.lang.System.loadLibrary(System.java:1667)
[SUB] E/AndroidRuntime( 4413):  at com.gluonhq.helloandroid.MainActivity.surfaceCreated(MainActivity.java:104)
[SUB] E/AndroidRuntime( 4413):  at android.view.SurfaceView.updateSurface(SurfaceView.java:758)

@johanvos
Copy link
Contributor

The reason for this is that GraalVM uses getdtablesize in com.oracle.svm.core.posix.PosixSubstrateOperatingSystemMXBean.java which is not supported (anymore) on Android.
At least on Android, we can use syscont(_SC_OPEN_MAX)

@johanvos
Copy link
Contributor

While the fix for this is a PR in GraalVM (oracle/graal#2812) we can work-around for now by defining getdtablesize in launcher.c

johanvos added a commit to johanvos/substrate that referenced this issue Aug 28, 2020
johanvos added a commit that referenced this issue Aug 28, 2020
workaround for #761
@johanvos
Copy link
Contributor

Fixed by #766

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

No branches or pull requests

2 participants