skeeto / w64devkit

Portable C and C++ Development Kit for x64 (and x86) Windows
The Unlicense
3.08k stars 214 forks source link

ld.exe unable to find import libraries #159

Open clin1234 opened 2 months ago

clin1234 commented 2 months ago

While building a mixed C and Python wheel, I got the following error:

~ $ pip install -U llama_cpp_python
Requirement already satisfied: llama_cpp_python in c:\users\ךינשגכהד\scoop\apps\python-alpha\current\lib\site-packages (0.2.87)
Collecting llama_cpp_python
  Using cached llama_cpp_python-0.2.88.tar.gz (63.7 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: typing-extensions>=4.5.0 in c:\users\ךינשגכהד\scoop\apps\python-alpha\current\lib\site-packages (from llama_cpp_python) (4.12.2)
Requirement already satisfied: numpy>=1.20.0 in c:\users\ךינשגכהד\scoop\apps\python-alpha\current\lib\site-packages (from llama_cpp_python) (2.2.0.dev0)
Requirement already satisfied: diskcache>=5.6.1 in c:\users\ךינשגכהד\scoop\apps\python-alpha\current\lib\site-packages (from llama_cpp_python) (5.6.3)
Requirement already satisfied: jinja2>=2.11.3 in c:\users\ךינשגכהד\scoop\apps\python-alpha\current\lib\site-packages (from llama_cpp_python) (3.1.4)
Requirement already satisfied: MarkupSafe>=2.0 in c:\users\ךינשגכהד\scoop\apps\python-alpha\current\lib\site-packages (from jinja2>=2.11.3->llama_cpp_python) (2.1.5)
Building wheels for collected packages: llama_cpp_python
  Building wheel for llama_cpp_python (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for llama_cpp_python (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [72 lines of output]
      *** scikit-build-core 0.10.3 using CMake 3.30.2 (wheel)
      *** Configuring CMake...
      loading initial cache file C:\Users\0BAC~1\AppData\Local\Temp\tmpgthsh4tw\build\CMakeInit.txt
      -- Building for: Ninja
      -- The C compiler identification is GNU 14.1.0
      -- The CXX compiler identification is GNU 14.1.0
      -- Detecting C compiler ABI info
      -- Detecting C compiler ABI info - failed
      -- Check for working C compiler: C:/Users/ךינשגכהד/scoop/apps/w64devkit/current/bin/cc.exe
      -- Check for working C compiler: C:/Users/ךינשגכהד/scoop/apps/w64devkit/current/bin/cc.exe - broken
      CMake Error at C:/Users/ךינשגכהד/scoop/apps/mingw-winlibs/14.2.0-12.0.0-r1/share/cmake-3.30/Modules/CMakeTestCCompiler.cmake:67 (message):
        The C compiler

          "C:/Users/ךינשגכהד/scoop/apps/w64devkit/current/bin/cc.exe"

        is not able to compile a simple test program.

        It fails with the following output:

          Change Dir: 'C:/Users/ךינשגכהד/AppData/Local/Temp/tmpgthsh4tw/build/CMakeFiles/CMakeScratch/TryCompile-a4a74x'

          Run Build Command(s): C:\Users\ךינשגכהד\scoop\apps\mingw-winlibs\current\bin\ninja.EXE -v cmTC_a86ce
          [1/2] C:\Users\ךינשגכהד\scoop\apps\w64devkit\current\bin\cc.exe    -o CMakeFiles/cmTC_a86ce.dir/testCCompiler.c.obj -c C:/Users/ךינשגכהד/AppData/Local/Temp/tmpgthsh4tw/build/CMakeFiles/CMakeScratch/TryCompile-a4a74x/testCCompiler.c
          [2/2] C:\WINDOWS\system32\cmd.exe /C "cd . && C:\Users\ךינשגכהד\scoop\apps\w64devkit\current\bin\cc.exe   CMakeFiles/cmTC_a86ce.dir/testCCompiler.c.obj -o cmTC_a86ce.exe -Wl,--out-implib,libcmTC_a86ce.dll.a -Wl,--major-image-version,0,--minor-image-version,0  -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ."
          FAILED: cmTC_a86ce.exe
          C:\WINDOWS\system32\cmd.exe /C "cd . && C:\Users\ךינשגכהד\scoop\apps\w64devkit\current\bin\cc.exe   CMakeFiles/cmTC_a86ce.dir/testCCompiler.c.obj -o cmTC_a86ce.exe -Wl,--out-implib,libcmTC_a86ce.dll.a -Wl,--major-image-version,0,--minor-image-version,0  -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ."
          C:/Users/ךינשגכהד/scoop/apps/w64devkit/current/bin/ld.exe: cannot find C:/Users/ךינשגכהד/scoop/apps/w64devkit/1.23.0/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/lib/../lib/crt2.o: No such file or directory
          C:/Users/ךינשגכהד/scoop/apps/w64devkit/current/bin/ld.exe: cannot find C:/Users/ךינשגכהד/scoop/apps/w64devkit/1.23.0/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/crtbegin.o: No such file or directory
          C:/Users/ךינשגכהד/scoop/apps/w64devkit/current/bin/ld.exe: cannot find -lkernel32: No such file or directory
          C:/Users/ךינשגכהד/scoop/apps/w64devkit/current/bin/ld.exe: cannot find -luser32: No such file or directory
          C:/Users/ךינשגכהד/scoop/apps/w64devkit/current/bin/ld.exe: cannot find -lgdi32: No such file or directory
          C:/Users/ךינשגכהד/scoop/apps/w64devkit/current/bin/ld.exe: cannot find -lwinspool: No such file or directory
          C:/Users/ךינשגכהד/scoop/apps/w64devkit/current/bin/ld.exe: cannot find -lshell32: No such file or directory
          C:/Users/ךינשגכהד/scoop/apps/w64devkit/current/bin/ld.exe: cannot find -lole32: No such file or directory
          C:/Users/ךינשגכהד/scoop/apps/w64devkit/current/bin/ld.exe: cannot find -loleaut32: No such file or directory
          C:/Users/ךינשגכהד/scoop/apps/w64devkit/current/bin/ld.exe: cannot find -luuid: No such file or directory
          C:/Users/ךינשגכהד/scoop/apps/w64devkit/current/bin/ld.exe: cannot find -lcomdlg32: No such file or directory
          C:/Users/ךינשגכהד/scoop/apps/w64devkit/current/bin/ld.exe: cannot find -ladvapi32: No such file or directory
          C:/Users/ךינשגכהד/scoop/apps/w64devkit/current/bin/ld.exe: cannot find -lmingw32: No such file or directory
          C:/Users/ךינשגכהד/scoop/apps/w64devkit/current/bin/ld.exe: cannot find -lgcc: No such file or directory
          C:/Users/ךינשגכהד/scoop/apps/w64devkit/current/bin/ld.exe: cannot find -lmingwex: No such file or directory
          C:/Users/ךינשגכהד/scoop/apps/w64devkit/current/bin/ld.exe: cannot find -lmsvcrt: No such file or directory
          C:/Users/ךינשגכהד/scoop/apps/w64devkit/current/bin/ld.exe: cannot find -lkernel32: No such file or directory
          C:/Users/ךינשגכהד/scoop/apps/w64devkit/current/bin/ld.exe: cannot find -lpthread: No such file or directory
          C:/Users/ךינשגכהד/scoop/apps/w64devkit/current/bin/ld.exe: cannot find -ladvapi32: No such file or directory
          C:/Users/ךינשגכהד/scoop/apps/w64devkit/current/bin/ld.exe: cannot find -lshell32: No such file or directory
          C:/Users/ךינשגכהד/scoop/apps/w64devkit/current/bin/ld.exe: cannot find -luser32: No such file or directory
          C:/Users/ךינשגכהד/scoop/apps/w64devkit/current/bin/ld.exe: cannot find -lkernel32: No such file or directory
          C:/Users/ךינשגכהד/scoop/apps/w64devkit/current/bin/ld.exe: cannot find -lmingw32: No such file or directory
          C:/Users/ךינשגכהד/scoop/apps/w64devkit/current/bin/ld.exe: cannot find -lgcc: No such file or directory
          C:/Users/ךינשגכהד/scoop/apps/w64devkit/current/bin/ld.exe: cannot find -lmingwex: No such file or directory
          C:/Users/ךינשגכהד/scoop/apps/w64devkit/current/bin/ld.exe: cannot find -lmsvcrt: No such file or directory

          C:/Users/ךינשגכהד/scoop/apps/w64devkit/current/bin/ld.exe: cannot find -lkernel32: No such file or directory

          C:/Users/ךינשגכהד/scoop/apps/w64devkit/current/bin/ld.exe: cannot find C:/Users/ךינשגכהד/scoop/apps/w64devkit/1.23.0/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/crtend.o: No such file or directory

          collect2.exe: error: ld returned 1 exit status
          ninja: build stopped: subcommand failed.

        CMake will not be able to correctly generate this project.
      Call Stack (most recent call first):
        CMakeLists.txt:3 (project)

      -- Configuring incomplete, errors occurred!

      *** CMake configuration failed
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for llama_cpp_python
Failed to build llama_cpp_python
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (llama_cpp_python)
skeeto commented 2 months ago

I suspect it's your installation path. Your user name, ךינשגכהד, gets mangled passing through the Win32 narrow API used by Binutils, and then ld cannot find its sysroot housing the import libraries. Try moving w64devkit to a path that has only has ASCII characters, e.g. out from your profile directory. A subst drive is insufficient because it's still constrained by the real path.

Sorry, I wish this worked correctly but we're still stuck paying for poor decisions made decades ago.

clin1234 commented 2 months ago

If it helps: Screenshot 2024-07-27 121703