Program.launch will first attempt to open files using libgio and then fallback to gnome-vfs. gio_launch uses g_file_new_for_path which fails when passed a URI. If swt was built with USE="-gnome" then the fallback fails as well, making it appear that a package has a dependency on swt[gnome] when it does not. Caused by: java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons: no swt-gnome-gtk-3740 in java.library.path no swt-gnome-gtk in java.library.path Can't load library: /home/xxx/.swt/lib/linux/x86_64/libswt-gnome-gtk-3740.so Can't load library: /home/xxx/.swt/lib/linux/x86_64/libswt-gnome-gtk.so Use g_file_new_for_commandline_arg instead. https://bugs.gentoo.org/424151 --- a/os.c +++ b/os.c @@ -3059,6 +3059,30 @@ fail: } #endif +#ifndef NO__1g_1file_1new_1for_1commandline_1arg +JNIEXPORT jintLong JNICALL OS_NATIVE(_1g_1file_1new_1for_1commandline_1arg) + (JNIEnv *env, jclass that, jbyteArray arg0) +{ + jbyte *lparg0=NULL; + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, _1g_1file_1new_1for_1commandline_1arg_FUNC); + if (arg0) if ((lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL)) == NULL) goto fail; +/* + rc = (jintLong)g_file_new_for_commandline_arg(lparg0); +*/ + { + LOAD_FUNCTION(fp, g_file_new_for_commandline_arg) + if (fp) { + rc = (jintLong)((jintLong (CALLING_CONVENTION*)(jbyte *))fp)(lparg0); + } + } +fail: + if (arg0 && lparg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0); + OS_NATIVE_EXIT(env, that, _1g_1file_1new_1for_1commandline_1arg_FUNC); + return rc; +} +#endif + #ifndef NO__1g_1file_1new_1for_1path JNIEXPORT jintLong JNICALL OS_NATIVE(_1g_1file_1new_1for_1path) (JNIEnv *env, jclass that, jbyteArray arg0) --- a/os_custom.h +++ b/os_custom.h @@ -280,6 +280,7 @@ #define g_file_icon_get_file_LIB LIB_GIO #define g_file_info_get_content_type_LIB LIB_GIO #define g_file_info_get_modification_time_LIB LIB_GIO +#define g_file_new_for_commandline_arg_LIB LIB_GIO #define g_file_new_for_path_LIB LIB_GIO #define g_file_new_for_uri_LIB LIB_GIO #define g_file_read_LIB LIB_GIO --- a/os_stats.c +++ b/os_stats.c @@ -18,8 +18,8 @@ #ifdef NATIVE_STATS -int OS_nativeFunctionCount = 1396; -int OS_nativeFunctionCallCount[1396]; +int OS_nativeFunctionCount = 1397; +int OS_nativeFunctionCallCount[1397]; char * OS_nativeFunctionNames[] = { #ifndef JNI64 "Call__IIII", @@ -250,6 +250,7 @@ char * OS_nativeFunctionNames[] = { "_1g_1file_1icon_1get_1file", "_1g_1file_1info_1get_1content_1type", "_1g_1file_1info_1get_1modification_1time", + "_1g_1file_1new_1for_1commandline_1arg", "_1g_1file_1new_1for_1path", "_1g_1file_1new_1for_1uri", "_1g_1file_1query_1info", --- a/os_stats.h +++ b/os_stats.h @@ -258,6 +258,7 @@ typedef enum { _1g_1file_1icon_1get_1file_FUNC, _1g_1file_1info_1get_1content_1type_FUNC, _1g_1file_1info_1get_1modification_1time_FUNC, + _1g_1file_1new_1for_1commandline_1arg_FUNC, _1g_1file_1new_1for_1path_FUNC, _1g_1file_1new_1for_1uri_FUNC, _1g_1file_1query_1info_FUNC, --- a/src/org/eclipse/swt/internal/gtk/OS.java +++ b/src/org/eclipse/swt/internal/gtk/OS.java @@ -2113,6 +2113,16 @@ public static final long /*int*/ g_file_new_for_path(byte[] fileName) { } } /** @method flags=dynamic */ +public static final native long /*int*/ _g_file_new_for_commandline_arg(byte[] fileName); +public static final long /*int*/ g_file_new_for_commandline_arg(byte[] fileName) { + lock.lock(); + try { + return _g_file_new_for_commandline_arg(fileName); + } finally { + lock.unlock(); + } +} +/** @method flags=dynamic */ public static final native long /*int*/ _g_file_new_for_uri(byte[] fileName); public static final long /*int*/ g_file_new_for_uri(byte[] fileName) { lock.lock(); --- a/src/org/eclipse/swt/program/Program.java +++ b/src/org/eclipse/swt/program/Program.java @@ -954,7 +954,7 @@ static boolean gio_isExecutable(String fileName) { static boolean gio_launch(String fileName) { boolean result = false; byte[] fileNameBuffer = Converter.wcsToMbcs (null, fileName, true); - long /*int*/ file = OS.g_file_new_for_path (fileNameBuffer); + long /*int*/ file = OS.g_file_new_for_commandline_arg (fileNameBuffer); if (file != 0) { long /*int*/ uri = OS.g_file_get_uri (file); if (uri != 0) {