mirrexagon / nixpkgs-esp-dev

Nix flake and overlay for ESP8266 and ESP32 development.
Creative Commons Zero v1.0 Universal
144 stars 72 forks source link

Missing rpath on libclang dependency #69

Open lfdominguez opened 1 month ago

lfdominguez commented 1 month ago

Hi, I'm trying to compile my rust + esp32 project and used this to install the idf framework, but every time that cargo tried to compile esp-idf-sys show me the message about /nix/store/<hash>-esp-clang-esp-idf-v5.3/lib/libclang.so.16.0.1 could found first the zlib dependency and then the libLLVM one, need to do a workaround on the tools.nix installPhase:

      libPath = lib.makeLibraryPath [
        stdenv.cc.cc.lib 
        zlib
        libxml2
      ];

installPhase:

      if [[ -f $out/lib/libclang.so.16.0.1 ]]; then
          echo "Patching Clang"

          patchelf \
            --set-rpath "${libPath}:$out/lib/" \
            $out/lib/libclang.so.16.0.1

          patchelf \
            --set-rpath "${libPath}" \
            $out/lib/libLLVM-16.so
        fi