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

[fbthrift]: fix dependency #30800

Merged
merged 3 commits into from
Apr 17, 2023
Merged

[fbthrift]: fix dependency #30800

merged 3 commits into from
Apr 17, 2023

Conversation

jiayuehua
Copy link
Contributor

No description provided.

@JonLiu1993 JonLiu1993 added the category:port-bug The issue is with a library, which is something the port should already support label Apr 13, 2023
JonLiu1993
JonLiu1993 previously approved these changes Apr 14, 2023
@JonLiu1993
Copy link
Member

@jiayuehua, I tested the usage of fbthrift locally and encountered such an error through fbthrift:x64-windows-static, please take a look:

1> CMake generation started for configuration: 'x64-static-Debug'.
1> Command line: "C:\WINDOWS\system32\cmd.exe" /c "%SYSTEMROOT%\System32\chcp.com 65001 >NUL && "C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2019\ENTERPRISE\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\CMake\bin\cmake.exe"  -G "Visual Studio 16 2019" -A x64  -DCMAKE_CONFIGURATION_TYPES:STRING="Debug" -DCMAKE_INSTALL_PREFIX:PATH="C:\Users\test\source\repos\CMakeProject42\out\install\x64-static-Debug" -DVCPKG_TARGET_TRIPLET:STRING="x64-windows-static" -DCMAKE_TOOLCHAIN_FILE=F:/Feature-test/fb/vcpkg/scripts/buildsystems/vcpkg.cmake "C:\Users\test\source\repos\CMakeProject42" 2>&1"
1> Working directory: C:\Users\test\source\repos\CMakeProject42\out\build\x64-static-Debug
1> [CMake] -- Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.19045.
1> [CMake] -- The C compiler identification is MSVC 19.29.30148.0
1> [CMake] -- The CXX compiler identification is MSVC 19.29.30148.0
1> [CMake] -- Detecting C compiler ABI info
1> [CMake] -- Detecting C compiler ABI info - done
1> [CMake] -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe - skipped
1> [CMake] -- Detecting C compile features
1> [CMake] -- Detecting C compile features - done
1> [CMake] -- Detecting CXX compiler ABI info
1> [CMake] -- Detecting CXX compiler ABI info - done
1> [CMake] -- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe - skipped
1> [CMake] -- Detecting CXX compile features
1> [CMake] -- Detecting CXX compile features - done
1> [CMake] -- Found ZLIB: optimized;F:/Feature-test/fb/vcpkg/installed/x64-windows-static/lib/zlib.lib;debug;F:/Feature-test/fb/vcpkg/installed/x64-windows-static/debug/lib/zlibd.lib (found version "1.2.13") 
1> [CMake] -- Found FBThrift: F:/Feature-test/fb/vcpkg/installed/x64-windows-static
1> [CMake] -- Configuring done
1> [CMake] CMake Error at F:/Feature-test/fb/vcpkg/scripts/buildsystems/vcpkg.cmake:591 (_add_executable):
1> [CMake]   Target "main" links to target "Folly::folly" but the target was not found.
1> [CMake]   Perhaps a find_package() call is missing for an IMPORTED target, or an
1> [CMake]   ALIAS target is missing?
1> [CMake] Call Stack (most recent call first):
1> [CMake]   CMakeProject42/CMakeLists.txt:14 (add_executable)
1> [CMake] CMake Error at F:/Feature-test/fb/vcpkg/scripts/buildsystems/vcpkg.cmake:591 (_add_executable):
1> [CMake]   Target "main" links to target "glog::glog" but the target was not found.
1> [CMake]   Perhaps a find_package() call is missing for an IMPORTED target, or an
1> [CMake]   ALIAS target is missing?
1> [CMake] Call Stack (most recent call first):

CMakeLists:

cmake_minimum_required (VERSION 3.8)
set(CMAKE_CXX_STANDARD 23)

project(test)

add_executable (main "CMakeProject42.cpp" "CMakeProject42.h")

find_package(FBThrift CONFIG REQUIRED)

target_link_libraries(main PRIVATE FBThrift::async FBThrift::thrift FBThrift::transport FBThrift::thriftcpp2)

@jiayuehua
Copy link
Contributor Author

jiayuehua commented Apr 14, 2023

@JonLiu1993 Would you please verify again? Also How to use x64-windows-static triplet on windows in visual studio cmake file? I can only use x64-windows. I have verified on linux.

cmake_minimum_required (VERSION 3.8)
set(CMAKE_CXX_STANDARD 23)
set(VCPKG_OVERLAY_TRIPLETS x64-windows-static) # not work!!!
project(test)

add_executable (main "CMakeProject42.cpp" "CMakeProject42.h")

find_package(FBThrift CONFIG REQUIRED)

target_link_libraries(main PRIVATE FBThrift::async FBThrift::thrift FBThrift::transport FBThrift::thriftcpp2)

@JonLiu1993
Copy link
Member

Tested usage successfully by fbthrift:x64-windows-static:

fbthrift provides CMake targets:

    # this is heuristically generated, and may not be correct
    find_package(FBThrift CONFIG REQUIRED)
    # note: 11 additional targets are not displayed.
    target_link_libraries(main PRIVATE FBThrift::async FBThrift::thrift FBThrift::transport FBThrift::thriftcpp2)

CMakeLists:

cmake_minimum_required (VERSION 3.8)
set(CMAKE_CXX_STANDARD 23)

project(test)

add_executable (main "CMakeProject42.cpp" "CMakeProject42.h")

find_package(FBThrift CONFIG REQUIRED)

target_link_libraries(main PRIVATE FBThrift::async FBThrift::thrift FBThrift::transport FBThrift::thriftcpp2)

CMakeSettings.json:

{
  "configurations": [
    {
      "name": "x64-Debug-static",
      "generator": "Visual Studio 16 2019 Win64",
      "configurationType": "Debug",
      "inheritEnvironments": [ "msvc_x64_x64" ],
      "buildRoot": "${projectDir}\\out\\build\\${name}",
      "installRoot": "${projectDir}\\out\\install\\${name}",
      "cmakeCommandArgs": "-DCMAKE_TOOLCHAIN_FILE=F:/Feature-test/fb/vcpkg/scripts/buildsystems/vcpkg.cmake",
      "buildCommandArgs": "",
      "ctestCommandArgs": "",
      "variables": [
        {
          "name": "CMAKE_TOOLCHAIN_FILE",
          "value": "-DCMAKE_TOOLCHAIN_FILE=F:/Feature-test/fb/vcpkg/scripts/buildsystems/vcpkg.cmake"
        },
        {
          "name": "VCPKG_TARGET_TRIPLET",
          "value": "x64-windows-static"
        }
      ]
    }
  
  ]
}

@jiayuehua ,There is no difference between x64-windows-static and x64-windows CMakeLists, the difference lies in the settings of CMakeSettings.json.

@JonLiu1993 JonLiu1993 added the info:reviewed Pull Request changes follow basic guidelines label Apr 17, 2023
@jiayuehua
Copy link
Contributor Author

thanks JonLiu1993 . Now I know the usage of this triplet.

@BillyONeal BillyONeal merged commit 7947b1c into microsoft:master Apr 17, 2023
@BillyONeal
Copy link
Member

Thanks for the dependency fixing!

@jiayuehua jiayuehua deleted the fbthrift branch April 24, 2023 22:35
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.

3 participants