MiraiForum

    • Register
    • Login
    • Search
    • Popular
    • Recent
    • Unsolved
    • Tags
    • Groups
    • 友情链接

    请教在Mirai-Console插件使用skiko报错

    HTTP API和第三方SDK
    2
    8
    472
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      status102 last edited by status102

      我自己写了一个插件,使用了skiko库。在Idea能正常运行,在服务器上运行时,提示找不到so。报错位置为实例化Bitmap
      尝试在libs下放了skiko-awt-runtime-windows-x64-0.7.32.jar,报错没变。
      尝试用ShadowJar打包依赖,jar打包进去了,但是报错没变。

      服务器:
      Linux 64位
      Mcl 2.1.1
      Mirai-console 2.12.1
      Mirai-console-terminal 2.12.1
      Mirai-core-all 2.12.1

      4f2c24f2-a89b-4fc7-927b-af1ff8827307-image.png

      Build.gradle.kts:

      plugins {
      val kotlinVersion = "1.7.10"
      kotlin("jvm") version kotlinVersion
      kotlin("plugin.serialization") version kotlinVersion
      id("net.mamoe.mirai-console") version "2.12.0"
      id("com.github.johnrengelman.shadow") version "7.1.2"
      }

      dependencies {

      implementation("org.jetbrains.skiko:skiko-awt-runtime-linux-x64:0.7.32")
      //shadowLink("org.jetbrains.skiko:skiko-awt-runtime-windows-x64")
      

      }

      mirai {
      jvmTarget = JavaVersion.VERSION_11
      }
      tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
      kotlinOptions.jvmTarget = "11"
      }

      repositories {
      google()
      gradlePluginPortal()
      mavenCentral()
      mavenLocal()
      maven("https://androidx.dev/storage/compose-compiler/repository/")
      maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
      }

      buildscript {
      repositories {
      mavenLocal()
      google()
      mavenCentral()
      maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
      }

      dependencies {
      	// __KOTLIN_COMPOSE_VERSION__
      	classpath(kotlin("gradle-plugin", version = "1.6.10"))
      }
      

      }

      cssxsh 1 Reply Last reply Reply Quote 0
      • cssxsh
        cssxsh @status102 last edited by cssxsh

        @status102

        1. net.mamoe.mirai-console 会自动引入 shadow 不需要单独添加
        2. 不要使用 shadow 打包插件,请使用 net.mamoe.mirai-console 自带的 buildPlugin,
          他会将依赖信息写入 META-INF,用户安装你的插件的时候再又 mirai-console 从云端下载,可以减小包冗余
        3. skiko 有别人写好的 前置插件,可以直接添加到 dependsOn,并且支持
          根据平台(linux ,Windows,macos 。termux)自动下载依赖
          比如我的
          https://github.com/cssxsh/mirai-skia-plugin
          就可以作为前置插件使用,有兴趣可以看看 readme
          使用的例子
          https://github.com/Colter23/bilibili-dynamic-mirai-plugin
        S 1 Reply Last reply Reply Quote 0
        • S
          status102 @cssxsh last edited by status102

          @cssxsh

          感谢提醒,之前尝试过添加Mirai Skia Plugin,但是报错。重新跑了一份log
          运行路径:/home/tata/mcl-2.1.0/

          https://paste.me/paste/2b8b165a-1b06-4ef4-61f1-94a6bfd93ba5#502792186c5c582d1a7dc45c1d1fd22c318f44e751f48dfd2852c53ad646ab36

          cssxsh 1 Reply Last reply Reply Quote 0
          • cssxsh
            cssxsh @status102 last edited by cssxsh

            @status102
            你的 linux 服务器 缺少OpenGL开发库,linux 下运行 skiko 需要

            你可以用 apt 或者 yml 自己安装一下

            相关指令可以百度或谷歌

            你可以参考使用下面的指令

            sudo apt-get install libgl1-mesa-dev
            
            S 2 Replies Last reply Reply Quote 0
            • S
              status102 @cssxsh last edited by status102

              @cssxsh 已经安装好了,谢谢。现在在对着您的skia插件研究skiko的中文乱码
              PS:是CentOS

              1 Reply Last reply Reply Quote 0
              • S
                status102 @cssxsh last edited by

                @cssxsh 解决了,我那台只内置了一个DejaVuSans字体,不支持中文,自己塞个字体进去得了

                cssxsh 1 Reply Last reply Reply Quote 0
                • cssxsh
                  cssxsh @status102 last edited by

                  @status102
                  其实我的插件会下载一些字体作为默认来着
                  具体看
                  https://github.com/cssxsh/mirai-skia-plugin/blob/2d079404b54a16316d4fdcf1477439ef31199029/src/main/kotlin/xyz/cssxsh/mirai/skia/MiraiSkiaPlugin.kt#L27

                  S 1 Reply Last reply Reply Quote 0
                  • S
                    status102 @cssxsh last edited by

                    @cssxsh 之前有看到,但是以为至少会内置一个基础字体2333

                    1 Reply Last reply Reply Quote 0
                    • 1 / 1
                    • First post
                      Last post
                    Powered by Mamoe Technologies & NodeBB | 友情链接 | 服务监控 | Contact