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

[7-zip] Only build Windows sources for Windows #41721

Merged
merged 2 commits into from
Oct 24, 2024

Conversation

DanAlbert
Copy link
Contributor

I've got no idea why these were here (it was in the initial PR without any explanation) and can't make any sense of the upstream makefiles, but it seems like the things in the Windows directory ought to only be built for Windows. This fixes compilation errors with NDK r28.

@MonicaLiu0311 MonicaLiu0311 changed the title 7-zip: Only build Windows sources for Windows. [7-zip] Only build Windows sources for Windows Oct 23, 2024
@MonicaLiu0311
Copy link
Contributor

Please get failure logs here on x64-widnows:

[265/266] C:\Windows\system32\cmd.exe /C "C:\Windows\system32\cmd.exe /C "D:\downloads\tools\cmake-3.30.1-windows\cmake-3.30.1-windows-i386\bin\cmake.exe -E __create_def D:\b\7zip\x64-windows-dbg\CMakeFiles\7zip.dir\.\exports.def D:\b\7zip\x64-windows-dbg\CMakeFiles\7zip.dir\.\exports.def.objs && cd D:\b\7zip\x64-windows-dbg" && D:\downloads\tools\cmake-3.30.1-windows\cmake-3.30.1-windows-i386\bin\cmake.exe -E vs_link_dll --intdir=CMakeFiles\7zip.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\mt.exe --manifests  -- C:\PROGRA~1\MICROS~1\2022\ENTERP~1\VC\Tools\MSVC\1441~1.341\bin\Hostx64\x64\link.exe  @CMakeFiles\7zip.rsp  /out:7zip.dll /implib:7zip.lib /pdb:7zip.pdb /dll /version:0.0 /machine:x64 /nologo    /debug /INCREMENTAL  /DEF:CMakeFiles\7zip.dir\.\exports.def && cd ."
FAILED: 7zip.dll 7zip.lib 
C:\Windows\system32\cmd.exe /C "C:\Windows\system32\cmd.exe /C "D:\downloads\tools\cmake-3.30.1-windows\cmake-3.30.1-windows-i386\bin\cmake.exe -E __create_def D:\b\7zip\x64-windows-dbg\CMakeFiles\7zip.dir\.\exports.def D:\b\7zip\x64-windows-dbg\CMakeFiles\7zip.dir\.\exports.def.objs && cd D:\b\7zip\x64-windows-dbg" && D:\downloads\tools\cmake-3.30.1-windows\cmake-3.30.1-windows-i386\bin\cmake.exe -E vs_link_dll --intdir=CMakeFiles\7zip.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\mt.exe --manifests  -- C:\PROGRA~1\MICROS~1\2022\ENTERP~1\VC\Tools\MSVC\1441~1.341\bin\Hostx64\x64\link.exe  @CMakeFiles\7zip.rsp  /out:7zip.dll /implib:7zip.lib /pdb:7zip.pdb /dll /version:0.0 /machine:x64 /nologo    /debug /INCREMENTAL  /DEF:CMakeFiles\7zip.dir\.\exports.def && cd ."
LINK Pass 1: command "C:\PROGRA~1\MICROS~1\2022\ENTERP~1\VC\Tools\MSVC\1441~1.341\bin\Hostx64\x64\link.exe @CMakeFiles\7zip.rsp /out:7zip.dll /implib:7zip.lib /pdb:7zip.pdb /dll /version:0.0 /machine:x64 /nologo /debug /INCREMENTAL /DEF:CMakeFiles\7zip.dir\.\exports.def /MANIFEST /MANIFESTFILE:CMakeFiles\7zip.dir/intermediate.manifest CMakeFiles\7zip.dir/manifest.res" failed (exit code 1120) with the following output:
   Creating library 7zip.lib and object 7zip.exp
InOutTempBuffer.cpp.obj : error LNK2019: unresolved external symbol "long __cdecl GetLastError_noZero_HRESULT(void)" (?GetLastError_noZero_HRESULT@@YAJXZ) referenced in function "public: long __cdecl CInOutTempBuffer::Write_HRESULT(void const *,unsigned int)" (?Write_HRESULT@CInOutTempBuffer@@QEAAJPEBXI@Z)
InOutTempBuffer.cpp.obj : error LNK2019: unresolved external symbol "public: bool __cdecl NWindows::NFile::NIO::CFileBase::Close(void)" (?Close@CFileBase@NIO@NFile@NWindows@@QEAA_NXZ) referenced in function "public: long __cdecl CInOutTempBuffer::WriteToStream(struct ISequentialOutStream *)" (?WriteToStream@CInOutTempBuffer@@QEAAJPEAUISequentialOutStream@@@Z)
InOutTempBuffer.cpp.obj : error LNK2019: unresolved external symbol "public: bool __cdecl NWindows::NFile::NIO::CInFile::Open(wchar_t const *)" (?Open@CInFile@NIO@NFile@NWindows@@QEAA_NPEB_W@Z) referenced in function "public: long __cdecl CInOutTempBuffer::WriteToStream(struct ISequentialOutStream *)" (?WriteToStream@CInOutTempBuffer@@QEAAJPEAUISequentialOutStream@@@Z)

@MonicaLiu0311 MonicaLiu0311 added the category:port-bug The issue is with a library, which is something the port should already support label Oct 23, 2024
@MonicaLiu0311 MonicaLiu0311 marked this pull request as draft October 23, 2024 02:40
@DanAlbert
Copy link
Contributor Author

@microsoft-github-policy-service agree

@DanAlbert
Copy link
Contributor Author

DanAlbert commented Oct 23, 2024

Please get failure logs here on x64-widnows:

[265/266] C:\Windows\system32\cmd.exe /C "C:\Windows\system32\cmd.exe /C "D:\downloads\tools\cmake-3.30.1-windows\cmake-3.30.1-windows-i386\bin\cmake.exe -E __create_def D:\b\7zip\x64-windows-dbg\CMakeFiles\7zip.dir\.\exports.def D:\b\7zip\x64-windows-dbg\CMakeFiles\7zip.dir\.\exports.def.objs && cd D:\b\7zip\x64-windows-dbg" && D:\downloads\tools\cmake-3.30.1-windows\cmake-3.30.1-windows-i386\bin\cmake.exe -E vs_link_dll --intdir=CMakeFiles\7zip.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\mt.exe --manifests  -- C:\PROGRA~1\MICROS~1\2022\ENTERP~1\VC\Tools\MSVC\1441~1.341\bin\Hostx64\x64\link.exe  @CMakeFiles\7zip.rsp  /out:7zip.dll /implib:7zip.lib /pdb:7zip.pdb /dll /version:0.0 /machine:x64 /nologo    /debug /INCREMENTAL  /DEF:CMakeFiles\7zip.dir\.\exports.def && cd ."
FAILED: 7zip.dll 7zip.lib 
C:\Windows\system32\cmd.exe /C "C:\Windows\system32\cmd.exe /C "D:\downloads\tools\cmake-3.30.1-windows\cmake-3.30.1-windows-i386\bin\cmake.exe -E __create_def D:\b\7zip\x64-windows-dbg\CMakeFiles\7zip.dir\.\exports.def D:\b\7zip\x64-windows-dbg\CMakeFiles\7zip.dir\.\exports.def.objs && cd D:\b\7zip\x64-windows-dbg" && D:\downloads\tools\cmake-3.30.1-windows\cmake-3.30.1-windows-i386\bin\cmake.exe -E vs_link_dll --intdir=CMakeFiles\7zip.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\mt.exe --manifests  -- C:\PROGRA~1\MICROS~1\2022\ENTERP~1\VC\Tools\MSVC\1441~1.341\bin\Hostx64\x64\link.exe  @CMakeFiles\7zip.rsp  /out:7zip.dll /implib:7zip.lib /pdb:7zip.pdb /dll /version:0.0 /machine:x64 /nologo    /debug /INCREMENTAL  /DEF:CMakeFiles\7zip.dir\.\exports.def && cd ."
LINK Pass 1: command "C:\PROGRA~1\MICROS~1\2022\ENTERP~1\VC\Tools\MSVC\1441~1.341\bin\Hostx64\x64\link.exe @CMakeFiles\7zip.rsp /out:7zip.dll /implib:7zip.lib /pdb:7zip.pdb /dll /version:0.0 /machine:x64 /nologo /debug /INCREMENTAL /DEF:CMakeFiles\7zip.dir\.\exports.def /MANIFEST /MANIFESTFILE:CMakeFiles\7zip.dir/intermediate.manifest CMakeFiles\7zip.dir/manifest.res" failed (exit code 1120) with the following output:
   Creating library 7zip.lib and object 7zip.exp
InOutTempBuffer.cpp.obj : error LNK2019: unresolved external symbol "long __cdecl GetLastError_noZero_HRESULT(void)" (?GetLastError_noZero_HRESULT@@YAJXZ) referenced in function "public: long __cdecl CInOutTempBuffer::Write_HRESULT(void const *,unsigned int)" (?Write_HRESULT@CInOutTempBuffer@@QEAAJPEBXI@Z)
InOutTempBuffer.cpp.obj : error LNK2019: unresolved external symbol "public: bool __cdecl NWindows::NFile::NIO::CFileBase::Close(void)" (?Close@CFileBase@NIO@NFile@NWindows@@QEAA_NXZ) referenced in function "public: long __cdecl CInOutTempBuffer::WriteToStream(struct ISequentialOutStream *)" (?WriteToStream@CInOutTempBuffer@@QEAAJPEAUISequentialOutStream@@@Z)
InOutTempBuffer.cpp.obj : error LNK2019: unresolved external symbol "public: bool __cdecl NWindows::NFile::NIO::CInFile::Open(wchar_t const *)" (?Open@CInFile@NIO@NFile@NWindows@@QEAA_NPEB_W@Z) referenced in function "public: long __cdecl CInOutTempBuffer::WriteToStream(struct ISequentialOutStream *)" (?WriteToStream@CInOutTempBuffer@@QEAAJPEAUISequentialOutStream@@@Z)

Uh, I copied from the rest of the file but I think the rest of the file is wrong. VCPKG_CMAKE_SYSTEM_NAME is not set in that file (tested with message(FATAL_ERROR "VCPKG_CMAKE_SYSTEM_NAME=${VCPKG_CMAKE_SYSTEM_NAME}"), so everything guarded by VCPKG_TARGET_IS_WINDOWS is effectively commented out. I'm guessing that definition is only provided for portfile.cmake, whereas this is actually a custom CMakeLists.txt for the port... I've fixed my changes in the PR but I left the rest of the file as-is. I've got no idea what any of that is supposed to do so I don't really want to be adding all those currently unused source files to a port that doesn't appear to need them.

@dg0yt
Copy link
Contributor

dg0yt commented Oct 23, 2024

Note that in vcpkg, there are two CMake worlds: script mode and project mode. They have different set of variables.
https://learn.microsoft.com/en-us/vcpkg/contributing/maintainer-guide#portfiles-are-run-in-script-mode

@DanAlbert
Copy link
Contributor Author

D:\a\_work\1\s\ports\7zip\vcpkg.json: note: if 7zip@24.08 is already published, update this file with a new version or port-version, commit it, then add the new version by running:
  vcpkg x-add-version 7zip
  git add versions
  git commit -m "Update version database"
note: if 7zip@24.08 is not yet published, overwrite the previous git tree by running:
  vcpkg x-add-version 7zip --overwrite-version
  git add versions
  git commit -m "Update version database"

But it's still 7-zip 24.08. What am I supposed to do here? How does vcpkg handle the "build" version without updating the package version?

@DanAlbert
Copy link
Contributor Author

https://learn.microsoft.com/en-us/vcpkg/reference/vcpkg-json#version explains that I can do basically whatever I want with that field, but what's the convention?

@dg0yt
Copy link
Contributor

dg0yt commented Oct 23, 2024

You need to increment port-version in ports/7zip/vcpkg.json. But the field is not present when it is zero. And now you have to restore versions/ first. Don't expect too much convenience.

@DanAlbert
Copy link
Contributor Author

Gotcha, thanks!

I've got no idea why these were here (it was in the initial PR without
any explanation) and can't make any sense of the upstream makefiles, but
it seems like the things in the Windows directory ought to only be built
for Windows. This fixes compilation errors with NDK r28.
@MonicaLiu0311 MonicaLiu0311 added the info:reviewed Pull Request changes follow basic guidelines label Oct 24, 2024
@data-queue data-queue merged commit 41626fd into microsoft:master Oct 24, 2024
16 checks passed
dg0yt added a commit to dg0yt/vcpkg that referenced this pull request Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:port-bug The issue is with a library, which is something the port should already support info:reviewed Pull Request changes follow basic guidelines
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants