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

Skiko Linux binary depends on dynamically linked libc++ #273

Closed
theapache64 opened this issue Jan 15, 2021 · 16 comments
Closed

Skiko Linux binary depends on dynamically linked libc++ #273

theapache64 opened this issue Jan 15, 2021 · 16 comments

Comments

@theapache64
Copy link
Contributor

theapache64 commented Jan 15, 2021

When run executed, I am getting build error.

Stacktrace

7:08:39 AM: Executing task 'run'...

> Task :wrapper

BUILD SUCCESSFUL in 103ms
1 actionable task: 1 executed
> Task :compileKotlin UP-TO-DATE
> Task :compileJava NO-SOURCE
> Task :processResources NO-SOURCE
> Task :classes UP-TO-DATE
> Task :inspectClassesForKotlinIC UP-TO-DATE
> Task :jar UP-TO-DATE

> Task :run

BUILD SUCCESSFUL in 1s
4 actionable tasks: 1 executed, 3 up-to-date
java.lang.UnsatisfiedLinkError: /home/theapache64/.skiko/92d528bd0f0b085330000592a5dbc97e63d8b8f258b56d931579e47e178f37ce/libskiko.so: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.22' not found (required by /home/theapache64/.skiko/92d528bd0f0b085330000592a5dbc97e63d8b8f258b56d931579e47e178f37ce/libskiko.so)
	at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
	at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:383)
	at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:227)
	at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:169)
	at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2407)
	at java.base/java.lang.Runtime.load0(Runtime.java:747)
	at java.base/java.lang.System.load(System.java:1857)
	at org.jetbrains.skiko.Library.loadOrGet(Library.kt:25)
	at org.jetbrains.skiko.Library.load(Library.kt:46)
	at org.jetbrains.skija.CustomLoader.run(CustomLoader.kt:5)
	at org.jetbrains.skija.impl.Library.staticLoad(Library.java:21)
	at org.jetbrains.skija.PictureRecorder.<clinit>(PictureRecorder.java:8)
	at androidx.compose.desktop.ComposeLayer.<init>(ComposeLayer.kt:70)
	at androidx.compose.desktop.ComposeWindow.<init>(ComposeWindow.kt:26)
	at androidx.compose.desktop.AppWindow.<init>(AppWindow.kt:102)
	at androidx.compose.desktop.AppWindow.<init>(AppWindow.kt)
	at androidx.compose.desktop.AppWindowKt$Window$1.run(AppWindow.kt:72)
	at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:316)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:770)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:740)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
Exception in thread "AWT-EventQueue-0" java.lang.ExceptionInInitializerError
	at androidx.compose.desktop.ComposeLayer.<init>(ComposeLayer.kt:70)
	at androidx.compose.desktop.ComposeWindow.<init>(ComposeWindow.kt:26)
	at androidx.compose.desktop.AppWindow.<init>(AppWindow.kt:102)
	at androidx.compose.desktop.AppWindow.<init>(AppWindow.kt)
	at androidx.compose.desktop.AppWindowKt$Window$1.run(AppWindow.kt:72)
	at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:316)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:770)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:740)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
Caused by: java.lang.RuntimeException: java.lang.IllegalArgumentException: Library file libskija.so not found in /
	at org.jetbrains.skija.impl.Library._extract(Library.java:85)
	at org.jetbrains.skija.impl.Library.load(Library.java:50)
	at org.jetbrains.skija.impl.Library.staticLoad(Library.java:32)
	at org.jetbrains.skija.PictureRecorder.<clinit>(PictureRecorder.java:8)
	... 18 more
Caused by: java.lang.IllegalArgumentException: Library file libskija.so not found in /
	at org.jetbrains.skija.impl.Library._extract(Library.java:68)
	... 21 more
7:08:41 AM: Task execution finished 'run'.

FYI, the libskiko.so exist in the expected path.

~$ stat /home/theapache64/.skiko/92d528bd0f0b085330000592a5dbc97e63d8b8f258b56d931579e47e178f37ce/libskiko.so
  File: '/home/theapache64/.skiko/92d528bd0f0b085330000592a5dbc97e63d8b8f258b56d931579e47e178f37ce/libskiko.so'
  Size: 33949752  	Blocks: 66320      IO Block: 4096   regular file
Device: 812h/2066d	Inode: 6565195     Links: 1
Access: (0664/-rw-rw-r--)  Uid: ( 1000/theapache64)   Gid: ( 1000/theapache64)
Access: 2021-01-15 06:54:16.494249012 +0530
Modify: 2021-01-15 06:54:16.482248896 +0530
Change: 2021-01-15 06:54:16.482248896 +0530

OS : Ubuntu 16.04

IntelliJ Version

IntelliJ IDEA 2020.3.1 (Community Edition)
Build #IC-203.6682.168, built on December 29, 2020
Runtime version: 11.0.9.1+11-b1145.63 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Linux 4.15.0-129-generic
GC: ParNew, ConcurrentMarkSweep
Memory: 725M
Cores: 6

Current Desktop: Unity

Any idea how to fix this ?

@kirill-grouchnikov
Copy link

Probably the most relevant part is version GLIBCXX_3.4.22 not found

@kirill-grouchnikov
Copy link

See if this helps:

apt-get update
apt-get install libstdc++6

If it does, they might want to add it to the readme

@theapache64
Copy link
Contributor Author

@kirill-grouchnikov I have that already installed.

~$ stat /usr/lib/x86_64-linux-gnu/libstdc++.so.6
  File: '/usr/lib/x86_64-linux-gnu/libstdc++.so.6' -> 'libstdc++.so.6.0.21'
  Size: 19        	Blocks: 0          IO Block: 4096   symbolic link
Device: 812h/2066d	Inode: 12584966    Links: 1
Access: (0777/lrwxrwxrwx)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2021-01-14 19:18:58.796433104 +0530
Modify: 2019-10-05 00:06:22.000000000 +0530
Change: 2019-11-06 06:31:47.524375702 +0530
 Birth: -

@kirill-grouchnikov
Copy link

Is that version in there? strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBCXX

@theapache64
Copy link
Contributor Author

@kirill-grouchnikov That was the issue, I was having an old version (GLIBCXX_3.4.21). I've installed the new version using

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-4.9
sudo apt-get upgrade libstdc++6

Thanks for your time @kirill-grouchnikov

mp4 mp4

@kirill-grouchnikov
Copy link

Maybe this needs to be reopened for the project devs to add some kind of a section of building on Linux

@theapache64
Copy link
Contributor Author

Yeah, that's a good idea.

Reopening to update docs

@theapache64 theapache64 reopened this Jan 15, 2021
@olonho
Copy link
Contributor

olonho commented Jan 15, 2021

Shall be fixed with JetBrains/skiko@91e9bd0

@olonho olonho changed the title java.lang.IllegalArgumentException: Library file libskija.so not found in / Skiko Linux binary depends on dynamically linked libc++ Jan 15, 2021
@theapache64
Copy link
Contributor Author

@olonho Okay. Feel free to close this issue when the fix merged with a public release.

@jimgoog
Copy link
Collaborator

jimgoog commented Feb 19, 2021

@olonho I am getting the same error on a fresh install of Ubuntu 16.04 (uncheck the 'install updates on installation' box) even with build154 which presumably includes JetBrains/skiko@91e9bd0 since that was a month ago? Repro steps in #275 (comment)

@jimgoog
Copy link
Collaborator

jimgoog commented Feb 19, 2021

And to be clear, it occurs not just when building the app, but also when running a pre-packaged app that was packaged by someone else.

@olonho
Copy link
Contributor

olonho commented Feb 19, 2021

Indeed previous fix was wrong, maybe smth like

diff --git a/skiko/build.gradle.kts b/skiko/build.gradle.kts
index aeb56d3..358d431 100644
--- a/skiko/build.gradle.kts
+++ b/skiko/build.gradle.kts
@@ -366,6 +366,7 @@ tasks.withType(LinkSharedLibrary::class.java).configureEach {
         OS.Linux -> {
             linkerArgs.addAll(
                 listOf(
+                    "-Wl,-Bstatic", "-lstdc++", "-Wl,-Bdynamic",
                     "-lGL",
                     "-lfontconfig",
                     // Hack to fix problem with linker not always finding certain declarations.

shall help.

@olonho
Copy link
Contributor

olonho commented Feb 19, 2021

Shall be actually fixed with JetBrains/skiko@b25d00b

@olonho olonho self-assigned this Feb 19, 2021
@jamesward
Copy link

I was able to workaround this with:

val os = System.getProperty("os.name")
val currentTarget = when {
  os.equals("Mac OS X", ignoreCase = true) -> "macos"
  os.startsWith("Win", ignoreCase = true) -> "windows"
  os.startsWith("Linux", ignoreCase = true) -> "linux"
  else -> error("Unknown OS name: $os")
}
runtimeOnly("org.jetbrains.skiko:skiko-jvm-runtime-${currentTarget}-x64:0.2.33")

@akurasov
Copy link
Contributor

Does anyone still have this issue with the latest skiko fix?

@okushnikov
Copy link
Collaborator

Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.

@JetBrains JetBrains locked and limited conversation to collaborators Dec 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants