VCV Rack 2, some progress, but stuck

I am packaging VCV Rack 2 as Flatpak. VCV Rack is audio synthesizer.

When building the package, it show an error.

/usr/lib/gcc/x86_64-unknown-linux-gnu/11.2.0/../../../../x86_64-unknown-linux-gnu/bin/ld: cannot find dep/lib/libGLEW.a: No such file or directory
/usr/lib/gcc/x86_64-unknown-linux-gnu/11.2.0/../../../../x86_64-unknown-linux-gnu/bin/ld: cannot find dep/lib/libglfw3.a: No such file or directory
/usr/lib/gcc/x86_64-unknown-linux-gnu/11.2.0/../../../../x86_64-unknown-linux-gnu/bin/ld: cannot find dep/lib/libjansson.a: No such file or directory
/usr/lib/gcc/x86_64-unknown-linux-gnu/11.2.0/../../../../x86_64-unknown-linux-gnu/bin/ld: cannot find dep/lib/libcurl.a: No such file or directory
/usr/lib/gcc/x86_64-unknown-linux-gnu/11.2.0/../../../../x86_64-unknown-linux-gnu/bin/ld: cannot find dep/lib/libssl.a: No such file or directory
/usr/lib/gcc/x86_64-unknown-linux-gnu/11.2.0/../../../../x86_64-unknown-linux-gnu/bin/ld: cannot find dep/lib/libcrypto.a: No such file or directory
/usr/lib/gcc/x86_64-unknown-linux-gnu/11.2.0/../../../../x86_64-unknown-linux-gnu/bin/ld: cannot find dep/lib/libarchive.a: No such file or directory
/usr/lib/gcc/x86_64-unknown-linux-gnu/11.2.0/../../../../x86_64-unknown-linux-gnu/bin/ld: cannot find dep/lib/libzstd.a: No such file or directory
/usr/lib/gcc/x86_64-unknown-linux-gnu/11.2.0/../../../../x86_64-unknown-linux-gnu/bin/ld: cannot find dep/lib/libspeexdsp.a: No such file or directory
/usr/lib/gcc/x86_64-unknown-linux-gnu/11.2.0/../../../../x86_64-unknown-linux-gnu/bin/ld: cannot find dep/lib/libsamplerate.a: No such file or directory
/usr/lib/gcc/x86_64-unknown-linux-gnu/11.2.0/../../../../x86_64-unknown-linux-gnu/bin/ld: cannot find dep/lib/librtmidi.a: No such file or directory
/usr/lib/gcc/x86_64-unknown-linux-gnu/11.2.0/../../../../x86_64-unknown-linux-gnu/bin/ld: cannot find dep/lib/librtaudio.a: No such file or directory

I suspect that it is looking for static libs in dep/lib because it use internal dependencies and install itself there. work around it by skipping dependencies install and install it in build-commands.

Edit: I partially solve this by editing the Makefile to point LDFLAGS to /app/lib.
Other issue is that Rack is looking for static library, which mean that using share-modules would not work.


/usr/lib/gcc/x86_64-unknown-linux-gnu/11.2.0/../../../../x86_64-unknown-linux-gnu/bin/ld: cannot find /app/lib/libcurl.a: No such fi
le or directory
/usr/lib/gcc/x86_64-unknown-linux-gnu/11.2.0/../../../../x86_64-unknown-linux-gnu/bin/ld: cannot find /app/lib/libssl.a: No such fil
e or directory
/usr/lib/gcc/x86_64-unknown-linux-gnu/11.2.0/../../../../x86_64-unknown-linux-gnu/bin/ld: cannot find /app/lib/libcrypto.a: No such
file or directory
/usr/lib/gcc/x86_64-unknown-linux-gnu/11.2.0/../../../../x86_64-unknown-linux-gnu/bin/ld: cannot find /app/lib/libarchive.a: No such
file or directory
/usr/lib/gcc/x86_64-unknown-linux-gnu/11.2.0/../../../../x86_64-unknown-linux-gnu/bin/ld: cannot find /app/lib/libzstd.a: No such fi
le or directory

Edit: solve it by manually installing other dependencies as separate submodule with static libs.

1 Like

I’ve played around with this & was able to build the application with the shared runtime libraries. The static libraries are a requirement in the Makefile, I simply replaced these parts. I don’t know if the application actually runs because I haven’t added the install part for the application.

I used the AUR PKGBUILD as a reference.

app-id: com.vcvrack.Rack
runtime: org.kde.Platform
sdk: org.kde.Sdk
runtime-version: 5.15-21.08
base: io.qt.qtwebengine.BaseApp
base-version: 5.15-21.08
rename-icon: rack
command: rack
finish-args:
  - --share=ipc
  - --socket=wayland
  - --device=dri
  - --share=network
  - --filesystem=home
cleanup:
  - /include
  - /lib/cmake
  - /lib/pkgconfig
  - /share/doc
  - /share/man
  - /etc
  - '*.la'
  - '*.a'

modules:
  - shared-modules/glew/glew.json
  - shared-modules/glu/glu-9.json
  - shared-modules/linux-audio/jack2.json

  - name: glfw
    buildsystem: cmake-ninja
    config-opts:
      - -DGLFW_USE_WAYLAND:BOOL=ON
      - -DBUILD_SHARED_LIBS:BOOL=ON
      - -DGLFW_BUILD_EXAMPLES:BOOL=OFF
      - -DGLFW_BUILD_TESTS:BOOL=OFF
      - -DGLFW_BUILD_DOCS:BOOL=OFF
    cleanup:
      - '*.a'
    sources:
      - type: archive
        url: https://github.com/glfw/glfw/releases/download/3.3.6/glfw-3.3.6.zip
        sha256: 45537305d44c0a9f3612d4ec4a48414547cf854bff3ed613078f7ec648a12781
        x-checker-data:
          type: anitya
          project-id: 1180
          stable-only: true
          url-template: https://github.com/glfw/glfw/releases/download/$version/glfw-$version.zip

  - name: jansson
    buildsystem: cmake-ninja
    config-opts:
      - -DJANSSON_BUILD_DOCS=OFF
      - -DJANSSON_BUILD_SHARED_LIBS=ON
    cleanup:
      - '*.a'
    sources:
      - type: git
        url: https://github.com/akheron/jansson
        tag: v2.14
        commit: 684e18c927e89615c2d501737e90018f4930d6c5
        x-checker-data:
          type: git
          tag-pattern: ^(v[\d.]+)$

  - name: speexdsp-SpeexDSP
    build-options:
      cflags: -fPIC
      ldflags: -fpic
    sources:
      - type: archive
        url: https://vcvrack.com/downloads/dep/speexdsp-SpeexDSP-1.2rc3.tgz
        sha256: c8dded1454747f65956f981c95e7f89a06abdaa2a53e8aeaa66bab2a3d59cebd

  - name: rtmidi
    buildsystem: cmake
    build-options:
      cflags: -fPIC
      ldflags: -fpic
    sources:
      - type: git
        url: https://github.com/VCVRack/rtmidi.git
        commit: 2c5b0778e38b5030afc80c8e9d7adc9b58ef650e
  - name: rtaudio
    buildsystem: cmake
    build-options:
      cflags: -fPIC
      ldflags: -fpic
    config-opts:
      - -DRTAUDIO_BUILD_SHARED_LIBS=ON
      - -DRTAUDIO_BUILD_TESTING=OFF
      - -DRTAUDIO_API_ALSA=ON
      - -DRTAUDIO_API_JACK=ON
      - -DRTAUDIO_API_PULSE=ON
      - -DRTAUDIO_API_OSS=OFF
      - -DCMAKE_POSITION_INDEPENDENT_CODE=ON
    sources:
      - type: git
        url: https://github.com/VCVRack/rtaudio.git
        commit: ece277bd839603648c80c8a5f145678e13bc23f3

  - name: Rack2
    buildsystem: simple
    build-commands:
      - make dep
      - make -j$FLATPAK_BUILDER_N_JOBS
    sources:
      - type: git
        url: https://github.com/VCVRack/Rack
        commit: 30665d62801c2ced7260a37a2d0214edfe6528a9
        tag: v2.1.0
      - type: patch
        path: Makefile.patch

#nanovg/example/stb_image_write.h

    # Don't know why using post-install on ParaView fail.
  #- name: install-icon
    #buildsystem: simple
    #build-commands:
      #- install -Dm644 pvIcon.svg ${FLATPAK_DEST}/share/icons/hicolor/scalable/apps/${FLATPAK_ID}.svg
      #- desktop-file-edit --set-icon=${FLATPAK_ID} ${FLATPAK_DEST}/share/applications/${FLATPAK_ID}.desktop
    #sources:
      #- type: file
        #path: pvIcon.svg

Makefile.patch

--- a/Makefile	2022-03-17 19:52:16.059899377 +0100
+++ b/Makefile	2022-03-17 19:52:43.270836203 +0100
@@ -34,13 +34,11 @@
 	FLAGS += -fno-gnu-unique
 
 	LDFLAGS += -Wl,--whole-archive
-	LDFLAGS += -static-libstdc++ -static-libgcc
-	LDFLAGS += dep/lib/libGLEW.a dep/lib/libglfw3.a dep/lib/libjansson.a dep/lib/libcurl.a dep/lib/libssl.a dep/lib/libcrypto.a dep/lib/libarchive.a dep/lib/libzstd.a dep/lib/libspeexdsp.a dep/lib/libsamplerate.a dep/lib/librtmidi.a dep/lib/librtaudio.a
 	LDFLAGS += -Wl,--no-whole-archive
+	LDFLAGS += -shared  -lGLEW -lglfw -ljansson -lcurl -lssl -lcrypto -larchive -lzstd -lspeexdsp -lsamplerate -lrtmidi -lrtaudio
 	LDFLAGS += -lpthread -lGL -ldl -lX11 -lasound -ljack -lpulse -lpulse-simple
 
 	STANDALONE_TARGET := Rack
-	STANDALONE_LDFLAGS += -static-libstdc++ -static-libgcc
 	STANDALONE_LDFLAGS += -Wl,-rpath=.
 endif

@@ -98,7 +96,7 @@
 all: $(TARGET) $(STANDALONE_TARGET)
 
 dep:
-	$(MAKE) -C dep
+	$(MAKE) -C dep includes
 
 cleandep:
 	$(MAKE) -C dep clean
 
--- a/dep/Makefile	2022-03-17 19:53:56.280716252 +0100
+++ b/dep/Makefile	2022-03-17 19:54:50.244605321 +0100
@@ -262,3 +262,5 @@
 clean:
 	git clean -fdx
 	git submodule foreach git clean -fdx
+
+includes: $(nanovg) $(nanosvg) $(osdialog) $(oui-blendish) $(fuzzysearchdatabase) $(ghcfilesystem) $(pffft)
 
1 Like

Amazing! I wonder if the upstream dev would like this patch. They wrote in their website that they don’t want direct contribution.