Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stuck on Detecting C ABI #120

Closed
philmb3487 opened this issue Apr 10, 2024 · 9 comments
Closed

Stuck on Detecting C ABI #120

philmb3487 opened this issue Apr 10, 2024 · 9 comments

Comments

@philmb3487
Copy link

Whenever I use this project on my Gentoo install I get stuck waiting at this line:

-- The C compiler identification is MSVC 19.39.33523.0
-- The CXX compiler identification is MSVC 19.39.33523.0
-- Detecting C compiler ABI info

The wine version is the same as my testing Ubuntu environment, where this works: 7.0.2 and it also does the same thing on 9.
Is this a known issue and what can I do about this?

@mstorsjo
Copy link
Owner

This sounds like the issue described at https://github.com/mstorsjo/msvc-wine?tab=readme-ov-file#fatal-error-c1902-program-database-manager-mismatch-please-check-your-installation and #6; if you install winbind, this should usually work, if you have the latest versions of all scripts (since #65).

Otherwise, if you have a new enough CMake (3.25 iirc), you can configure with -DCMAKE_MSVC_DEBUG_INFORMATION_FORMAT=Embedded which also should make the issue go away, without dealing with winbind and the mspdbsrv.exe background process.

@philmb3487
Copy link
Author

philmb3487 commented Apr 10, 2024

I do have winbind (well samba with winbindd if I understand right) installed, do I have to start a systemd unit or something?

With the embedded format thing enabled, I get the following:

$ cmake --preset=msvc-wine -B build -DCMAKE_MSVC_DEBUG_INFORMATION_FORMAT=Embedded
Preset CMake variables:

  CMAKE_BUILD_TYPE="RelWithDebInfo"
  CMAKE_CROSSCOMPILING_EMULATOR="env;WINEDEBUG=-all;wine64"
  CMAKE_CXX_COMPILER="/opt/msvc/bin/x64/cl.exe"
  CMAKE_C_COMPILER="/opt/msvc/bin/x64/cl.exe"
  CMAKE_RC_COMPILER="/opt/msvc/bin/x64/rc.exe"
  CMAKE_SYSTEM_NAME="Windows"
  CMAKE_SYSTEM_VERSION="10"

-- The C compiler identification is MSVC 19.39.33523.0
-- The CXX compiler identification is MSVC 19.39.33523.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: /opt/msvc/bin/x64/cl.exe
-- Check for working C compiler: /opt/msvc/bin/x64/cl.exe - broken
CMake Error at /usr/share/cmake/Modules/CMakeTestCCompiler.cmake:67 (message):
  The C compiler

    "/opt/msvc/bin/x64/cl.exe"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: '/data/modix/modixslicer/deps/build/CMakeFiles/CMakeScratch/TryCompile-zdODBv'
    
    Run Build Command(s): /usr/bin/ninja -v cmTC_6f2a0
    [1/2] /opt/msvc/bin/x64/cl.exe  /nologo   /DWIN32 /D_WINDOWS  /Ob0 /Od /RTC1 -MDd -Z7 /showIncludes /FoCMakeFiles/cmTC_6f2a0.dir/testCCompiler.c.obj /FdCMakeFiles/cmTC_6f2a0.dir/ /FS -c /data/modix/modixslicer/deps/build/CMakeFiles/CMakeScratch/TryCompile-zdODBv/testCCompiler.c
    [2/2] : && /usr/bin/cmake -E vs_link_exe --intdir=CMakeFiles/cmTC_6f2a0.dir --rc=/opt/msvc/bin/x64/rc.exe --mt=/opt/msvc/bin/x64/mt --manifests  -- /opt/msvc/bin/x64/link /nologo CMakeFiles/cmTC_6f2a0.dir/testCCompiler.c.obj  /out:cmTC_6f2a0.exe /implib:cmTC_6f2a0.lib /pdb:cmTC_6f2a0.pdb /version:0.0 /machine:x64  /debug /INCREMENTAL /subsystem:console  kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && :
    FAILED: cmTC_6f2a0.exe 
    : && /usr/bin/cmake -E vs_link_exe --intdir=CMakeFiles/cmTC_6f2a0.dir --rc=/opt/msvc/bin/x64/rc.exe --mt=/opt/msvc/bin/x64/mt --manifests  -- /opt/msvc/bin/x64/link /nologo CMakeFiles/cmTC_6f2a0.dir/testCCompiler.c.obj  /out:cmTC_6f2a0.exe /implib:cmTC_6f2a0.lib /pdb:cmTC_6f2a0.pdb /version:0.0 /machine:x64  /debug /INCREMENTAL /subsystem:console  kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && :
    MT: command "/opt/msvc/bin/x64/mt /nologo /manifest CMakeFiles/cmTC_6f2a0.dir/intermediate.manifest /out:CMakeFiles/cmTC_6f2a0.dir/embed.manifest /notify_update" failed (exit code 0x1) with the following output:
    ninja: build stopped: subcommand failed.
    
    

  

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


-- Configuring incomplete, errors occurred!

Cmake is version 3.29, wine is version 7.0.2

@mstorsjo
Copy link
Owner

I do have winbind (well samba with winbindd if I understand right) installed, do I have to start a systemd unit or something?

Sorry, no idea...

If you're interested in digging into this, try looking at either the cmake log, to see exactly what command it tried to execute - but maybe it isn't printed until the command completes? Or just try strace. Anyway, with the problematic command known, try executing it manually outside of cmake, to see what it does... There's been a lot of fixes in this area thanks to @huangqinjin.

With the embedded format thing enabled, I get the following:

$ cmake --preset=msvc-wine -B build -DCMAKE_MSVC_DEBUG_INFORMATION_FORMAT=Embedded
Preset CMake variables:

  CMAKE_BUILD_TYPE="RelWithDebInfo"
  CMAKE_CROSSCOMPILING_EMULATOR="env;WINEDEBUG=-all;wine64"
  CMAKE_CXX_COMPILER="/opt/msvc/bin/x64/cl.exe"
  CMAKE_C_COMPILER="/opt/msvc/bin/x64/cl.exe"
  CMAKE_RC_COMPILER="/opt/msvc/bin/x64/rc.exe"
  CMAKE_SYSTEM_NAME="Windows"
  CMAKE_SYSTEM_VERSION="10"

-- The C compiler identification is MSVC 19.39.33523.0
-- The CXX compiler identification is MSVC 19.39.33523.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: /opt/msvc/bin/x64/cl.exe
-- Check for working C compiler: /opt/msvc/bin/x64/cl.exe - broken
CMake Error at /usr/share/cmake/Modules/CMakeTestCCompiler.cmake:67 (message):
  The C compiler

    "/opt/msvc/bin/x64/cl.exe"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: '/data/modix/modixslicer/deps/build/CMakeFiles/CMakeScratch/TryCompile-zdODBv'
    
    Run Build Command(s): /usr/bin/ninja -v cmTC_6f2a0
    [1/2] /opt/msvc/bin/x64/cl.exe  /nologo   /DWIN32 /D_WINDOWS  /Ob0 /Od /RTC1 -MDd -Z7 /showIncludes /FoCMakeFiles/cmTC_6f2a0.dir/testCCompiler.c.obj /FdCMakeFiles/cmTC_6f2a0.dir/ /FS -c /data/modix/modixslicer/deps/build/CMakeFiles/CMakeScratch/TryCompile-zdODBv/testCCompiler.c
    [2/2] : && /usr/bin/cmake -E vs_link_exe --intdir=CMakeFiles/cmTC_6f2a0.dir --rc=/opt/msvc/bin/x64/rc.exe --mt=/opt/msvc/bin/x64/mt --manifests  -- /opt/msvc/bin/x64/link /nologo CMakeFiles/cmTC_6f2a0.dir/testCCompiler.c.obj  /out:cmTC_6f2a0.exe /implib:cmTC_6f2a0.lib /pdb:cmTC_6f2a0.pdb /version:0.0 /machine:x64  /debug /INCREMENTAL /subsystem:console  kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && :
    FAILED: cmTC_6f2a0.exe 
    : && /usr/bin/cmake -E vs_link_exe --intdir=CMakeFiles/cmTC_6f2a0.dir --rc=/opt/msvc/bin/x64/rc.exe --mt=/opt/msvc/bin/x64/mt --manifests  -- /opt/msvc/bin/x64/link /nologo CMakeFiles/cmTC_6f2a0.dir/testCCompiler.c.obj  /out:cmTC_6f2a0.exe /implib:cmTC_6f2a0.lib /pdb:cmTC_6f2a0.pdb /version:0.0 /machine:x64  /debug /INCREMENTAL /subsystem:console  kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && :
    MT: command "/opt/msvc/bin/x64/mt /nologo /manifest CMakeFiles/cmTC_6f2a0.dir/intermediate.manifest /out:CMakeFiles/cmTC_6f2a0.dir/embed.manifest /notify_update" failed (exit code 0x1) with the following output:
    ninja: build stopped: subcommand failed.
    
    

  

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


-- Configuring incomplete, errors occurred!

Ok, so then it does proceed further, but gets stuck on an issue around mt.exe. This is also supposed to work, since #63. You may be able to sidestep it by passing -DCMAKE_EXE_LINKER_FLAGS=/MANIFEST:NO and -DCMAKE_SHARED_LINKER_FLAGS=/MANIFEST:NO to CMake.

@philmb3487
Copy link
Author

Ohhh I had a build folder already configured, changing the name to something new fixed the issue, but I still need to set the linker flags to /MANIFEST:NO otherwise it does not work.

here is a toolchain file that works:

 set(CMAKE_SYSTEM_NAME Windows)
 set(CMAKE_SYSTEM_PROCESSOR AMD64)
 
 set(CMAKE_C_COMPILER     /opt/msvc/bin/x64/cl.exe)
 set(CMAKE_CXX_COMPILER   /opt/msvc/bin/x64/cl.exe)
 set(CMAKE_RC_COMPILER    /opt/msvc/bin/x64/rc.exe)
 
 set(CMAKE_HOST_WIN32 true)
 set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT Embedded)
 
 set(CMAKE_EXE_LINKER_FLAGS /MANIFEST:NO)
 set(CMAKE_SHARED_LINKER_FLAGS /MANIFEST:NO)

Now I'm getting a file path issue, should I open a new bug report for this?

LINK : fatal error LNK1104: cannot open file 'z:\opt\msvc\kits\10\lib\10.0.22621.0\ucrt\x64\ucrtd.lib'

@mstorsjo
Copy link
Owner

Now I'm getting a file path issue, should I open a new bug report for this?

LINK : fatal error LNK1104: cannot open file 'z:\opt\msvc\kits\10\lib\10.0.22621.0\ucrt\x64\ucrtd.lib'

Sure, that sounds like a different issue as well, so perhaps good to make a separate issue. But it's odd, as if I understand you correctly, this works for you on Ubuntu, but fails on Gentoo? So it sounds like there's something differing in the environment between these two distros, that makes all these details fail in this way.

@huangqinjin
Copy link
Contributor

The stuck issue and mt issue are typical issues of missing msvctricks.exe. Please check if it is in /opt/msvc/bin.

@philmb3487
Copy link
Author

msvctricks.exe.

where should i copy it from?

@philmb3487
Copy link
Author

The stuck issue and mt issue are typical issues of missing msvctricks.exe. Please check if it is in /opt/msvc/bin.

Yes I think that fixed it. I had to build it manually like cl.exe /EHsc /O2 msvctricks.cpp and then copy it there.
I don't understand the install.sh script. it seems to check for wine, which I have, and then it decides to not build msvctricks.

@huangqinjin
Copy link
Contributor

huangqinjin commented Apr 11, 2024

Did you install wine before running install.h, there should not be problems if yes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants