flathub / org.freedesktop.Sdk.Extension.ldc

https://flathub.org/apps/details/org.freedesktop.Sdk.Extension.ldc
1 stars 1 forks source link

Can't build dub projects with ldc in 24.08 - "undefined symbol: LLVMInitializeWebAssemblyTarget, version LLVM_18.1" #91

Closed grillo-delmal closed 1 month ago

grillo-delmal commented 1 month ago

Was trying to build a bigger flatpak project and stumbled on this.

Here is a small example file that reproduces the problem

id: test.test.test
runtime: org.freedesktop.Platform
runtime-version: '24.08'
sdk: org.freedesktop.Sdk
sdk-extensions:
  - org.freedesktop.Sdk.Extension.llvm18
  - org.freedesktop.Sdk.Extension.ldc

modules:
  - name: test
    buildsystem: simple
    build-options:
      append-path: /usr/lib/sdk/ldc/bin
    build-commands:
      - dub build
    sources:
      - type: "archive"
        url: "https://code.dlang.org/packages/ping/0.0.5.zip"
        sha256: "8e543b98af571e38cc73868884d55ef60e9c5aa66641e93513474cc401101676"
flatpak-builder --default-branch=localbuild --force-clean --repo=./repo-dir ./build-dir test.test.test.yml

This fails with the following output

Downloading sources
Downloading https://code.dlang.org/packages/ping/0.0.5.zip
...
Initializing build dir
Committing stage init to cache
Starting build of test.test.test
========================================================================
Building module test in /home/grillo/src/tests/ldc-test/.flatpak-builder/build/test-1
========================================================================
Running: dub build
Error Failed to invoke the compiler /usr/lib/sdk/ldc/bin/ldc2 to determine the build platform: /usr/lib/sdk/ldc/bin/ldc2: symbol lookup error: /usr/lib/sdk/ldc/bin/ldc2: undefined symbol: LLVMInitializeWebAssemblyTarget, version LLVM_18.1

Error: module test: Child process exited with code 2
Erick555 commented 1 month ago

was it working before?

you may try adding below in manifest:

  prepend-path: /usr/lib/sdk/llvm18/bin
  prepend-ld-library-path: /usr/lib/sdk/llvm18/lib
grillo-delmal commented 1 month ago

huh! that did the trick ^^ on 23.08 adding this wasn't required, but I'm fine if it works :+1: thank you!

Erick555 commented 1 month ago

@grillo-delmal I think it's because it picked llvm 18 library from GL.default (mesa) extension instead of llvm extension and they aren't compatible. In 23.08 mesa has llvm17 so it could clash only with llvm17 extension. In general without prepend-ld-library-path there is no guarantee you have the right loaded.

grillo-delmal commented 1 month ago

@Erick555 It does make sense :) Thanks for clarifying xD TBH I was just using it the same way as other dlang projects did without giving it much though. I assumed that the paths were being pre-filed by the extensions or something like that, but now that you mention the mesa thing, it does make sense for it not being like that XDD. In general I'm all in on explicitly declaring these things, so no problem on my side :+1: