zed icon indicating copy to clipboard operation
zed copied to clipboard

Bundled library libX11.so.6 causes wrong vulkan features detection

Open inferrna opened this issue 10 months ago • 3 comments

Summary

Continuation of https://github.com/zed-industries/zed/issues/28683

I found that my own build version 1.84.1-pre is working fine REMOTE_SERVER_TARGET=x86_64-unknown-linux-gnu AWS_LC_FIPS_SYS_CC=gcc-11 cargo build --release --target "x86_64-unknown-linux-gnu" --package zed --package cli

then I noticed a difference in linked libraries and built my version with env variables from the bundle-linux script export CC=$(which clang) export ZED_BUNDLE=true export RUSTFLAGS="${RUSTFLAGS:-} -C link-args=-Wl,--disable-new-dtags,-rpath,\$ORIGIN/../lib" and I have got not-working build. then I replaced export RUSTFLAGS="${RUSTFLAGS:-} -C link-args=-Wl,--disable-new-dtags,-rpath,\$ORIGIN/../lib" with export RUSTFLAGS="${RUSTFLAGS:-} -C link-args=-Wl,--disable-new-dtags and have got the working build. Then I tried to replace libs in bundled lib directory with symlinks to my system libs. And with this not-working build became working. So then I tried libs one by one and found that it was libX11.so.6

this is working

lrwxrwxrwx 1 inferno inferno  26 Apr 26 13:32 libbsd.so.0 -> ../lib_bundled/libbsd.so.0
lrwxrwxrwx 1 inferno inferno  22 Apr 26 14:01 libX11.so.6 -> /usr/lib64/libX11.so.6
lrwxrwxrwx 1 inferno inferno  30 Apr 26 13:56 libX11-xcb.so.1 -> ../lib_bundled/libX11-xcb.so.1
lrwxrwxrwx 1 inferno inferno  26 Apr 26 13:56 libXau.so.6 -> ../lib_bundled/libXau.so.6
lrwxrwxrwx 1 inferno inferno  26 Apr 26 13:56 libxcb.so.1 -> ../lib_bundled/libxcb.so.1
lrwxrwxrwx 1 inferno inferno  30 Apr 26 13:56 libxcb-xkb.so.1 -> ../lib_bundled/libxcb-xkb.so.1
lrwxrwxrwx 1 inferno inferno  28 Apr 26 13:56 libXdmcp.so.6 -> ../lib_bundled/libXdmcp.so.6
lrwxrwxrwx 1 inferno inferno  32 Apr 26 13:57 libxkbcommon.so.0 -> ../lib_bundled/libxkbcommon.so.0
lrwxrwxrwx 1 inferno inferno  36 Apr 26 13:57 libxkbcommon-x11.so.0 -> ../lib_bundled/libxkbcommon-x11.so.0

and this is not

lrwxrwxrwx 1 inferno inferno  26 Apr 26 13:32 libbsd.so.0 -> ../lib_bundled/libbsd.so.0
lrwxrwxrwx 1 inferno inferno  22 Apr 26 14:01 libX11.so.6 -> ../lib_bundled/libX11.so.6
lrwxrwxrwx 1 inferno inferno  30 Apr 26 13:56 libX11-xcb.so.1 -> ../lib_bundled/libX11-xcb.so.1
lrwxrwxrwx 1 inferno inferno  26 Apr 26 13:56 libXau.so.6 -> ../lib_bundled/libXau.so.6
lrwxrwxrwx 1 inferno inferno  26 Apr 26 13:56 libxcb.so.1 -> ../lib_bundled/libxcb.so.1
lrwxrwxrwx 1 inferno inferno  30 Apr 26 13:56 libxcb-xkb.so.1 -> ../lib_bundled/libxcb-xkb.so.1
lrwxrwxrwx 1 inferno inferno  28 Apr 26 13:56 libXdmcp.so.6 -> ../lib_bundled/libXdmcp.so.6
lrwxrwxrwx 1 inferno inferno  32 Apr 26 13:57 libxkbcommon.so.0 -> ../lib_bundled/libxkbcommon.so.0
lrwxrwxrwx 1 inferno inferno  36 Apr 26 13:57 libxkbcommon-x11.so.0 -> ../lib_bundled/libxkbcommon-x11.so.0

Zed Version and System Specs

Zed System Specs (from CLI): Zed: v0.184.1 (Zed Preview) OS: Linux Wayland clear-linux-os 43250 Memory: 47 GiB Architecture: x86_64 GPU:

vulkaninfo --summary output

==========
VULKANINFO
==========

Vulkan Instance Version: 1.4.312


Instance Extensions: count = 24
-------------------------------
VK_EXT_acquire_drm_display             : extension revision 1
VK_EXT_acquire_xlib_display            : extension revision 1
VK_EXT_debug_report                    : extension revision 10
VK_EXT_debug_utils                     : extension revision 2
VK_EXT_direct_mode_display             : extension revision 1
VK_EXT_display_surface_counter         : extension revision 1
VK_EXT_headless_surface                : extension revision 1
VK_EXT_surface_maintenance1            : extension revision 1
VK_EXT_swapchain_colorspace            : extension revision 5
VK_KHR_device_group_creation           : extension revision 1
VK_KHR_display                         : extension revision 23
VK_KHR_external_fence_capabilities     : extension revision 1
VK_KHR_external_memory_capabilities    : extension revision 1
VK_KHR_external_semaphore_capabilities : extension revision 1
VK_KHR_get_display_properties2         : extension revision 1
VK_KHR_get_physical_device_properties2 : extension revision 2
VK_KHR_get_surface_capabilities2       : extension revision 1
VK_KHR_portability_enumeration         : extension revision 1
VK_KHR_surface                         : extension revision 25
VK_KHR_surface_protected_capabilities  : extension revision 1
VK_KHR_wayland_surface                 : extension revision 6
VK_KHR_xcb_surface                     : extension revision 6
VK_KHR_xlib_surface                    : extension revision 6
VK_LUNARG_direct_driver_loading        : extension revision 1

Instance Layers: count = 7
--------------------------
VK_LAYER_INTEL_nullhw             INTEL NULL HW                1.1.73   version 1
VK_LAYER_MESA_device_select       Linux device selection layer 1.4.303  version 1
VK_LAYER_MESA_overlay             Mesa Overlay layer           1.4.303  version 1
VK_LAYER_VALVE_steam_fossilize_32 Steam Pipeline Caching Layer 1.3.207  version 1
VK_LAYER_VALVE_steam_fossilize_64 Steam Pipeline Caching Layer 1.3.207  version 1
VK_LAYER_VALVE_steam_overlay_32   Steam Overlay Layer          1.3.207  version 1
VK_LAYER_VALVE_steam_overlay_64   Steam Overlay Layer          1.3.207  version 1

Devices:
========
GPU0:
	apiVersion         = 1.4.311
	driverVersion      = 25.0.99
	vendorID           = 0x1002
	deviceID           = 0x67ff
	deviceType         = PHYSICAL_DEVICE_TYPE_DISCRETE_GPU
	deviceName         = AMD Radeon RX 560 Series (RADV POLARIS11)
	driverID           = DRIVER_ID_MESA_RADV
	driverName         = radv
	driverInfo         = Mesa 25.1.0-devel
	conformanceVersion = 1.4.0.0
	deviceUUID         = 00000000-0500-0000-0000-000000000000
	driverUUID         = 414d442d-4d45-5341-2d44-525600000000

If applicable, attach your ~/Library/Logs/Zed/Zed.log file to this issue.

Zed.log

inferrna avatar Apr 26 '25 10:04 inferrna

Hey, thanks for really looking into this. This is great information to know. Not sure how libX11 is interfering with Vulkan feature detection, but it seems like the solution is to provide a way to force using the system X11 version, or default to using it on Linux, as long as that doesn't cause additional problems.

probably-neb avatar Apr 28 '25 14:04 probably-neb

Script to update all except lib

#!/bin/bash
TMP_DIR=$(mktemp -d)
cd $TMP_DIR
echo "Work in ${TMP_DIR}"
curl -L -H "Accept: application/vnd.github+json" -H "Authorization: Bearer your_secret_github_token" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/zed-industries/zed/releases > ${TMP_DIR}/releases.json

LAST_VER=`jq 'map(select(.prerelease == false)) | first.name ' ${TMP_DIR}/releases.json | tr -d v\"`
CURRENT_VER=$(~/.local/zed.app/bin/zed --version|awk '{print $2}')
if [[ $LAST_VER != $CURRENT_VER ]]; then
    echo "Versions differs: found last ${LAST_VER} vs old ${CURRENT_VER}"
    URL=`jq 'map(select(.prerelease == false)) | first.assets | map(select(.name=="zed-linux-x86_64.tar.gz"))[0].browser_download_url ' /tmp/zed_releases.json | tr -d \"`
    wget $URL -O - | tar -C ~/.local/ -xzvf - zed.app/libexec/zed-editor zed.app/bin/zed zed.app/share/
fi

inferrna avatar May 07 '25 10:05 inferrna

I'm having the same issue when I try to build Zed from the source code with using the provided Nix environment, but if I disable nix via direnv revoke, then install the deps via ./scripts/linux everything builds and runs successfully.

I noticed that my system library version is libX11 1.8.10, so I have tried to use it in nix environment like that:

diff --git a/nix/build.nix b/nix/build.nix
index 21ff060afb..b9d7996a74 100644
--- a/nix/build.nix
+++ b/nix/build.nix
@@ -140,7 +140,7 @@ let
           libxkbcommon
           wayland
           gpu-lib
-          xorg.libX11
+          (xorg.libX11.overrideAttrs { version = "1.8.10"; })
           xorg.libxcb
         ]
         ++ lib.optionals stdenv'.hostPlatform.isDarwin [

Unfortunately, this doesn't resolve the issue.

EDIT: I have resolved the issue and it's just related to nix dev shell. Details: https://github.com/zed-industries/zed/issues/26980

hron avatar May 14 '25 09:05 hron

Hi there! 👋 We're working to clean up our issue tracker by closing older bugs that might not be relevant anymore. If you are able to reproduce this issue in the latest version of Zed, please let us know by commenting on this issue, and it will be kept open. If you can't reproduce it, feel free to close the issue yourself. Otherwise, it will close automatically in 14 days. Thanks for your help!

github-actions[bot] avatar Nov 19 '25 11:11 github-actions[bot]