Hi,

It seems that the following build dependency is missing:

diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake 
b/cpp/cmake_modules/ThirdpartyToolchain.cmake
index aa01b7528c..c62bd41c5f 100644
--- a/cpp/cmake_modules/ThirdpartyToolchain.cmake
+++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake
@@ -1379,6 +1379,7 @@ macro(build_gflags)
   add_dependencies(toolchain gflags_ep)
 
   add_thirdparty_lib(gflags::gflags_static STATIC ${GFLAGS_STATIC_LIB})
+  add_dependencies(gflags::gflags_static gflags_ep)
   set(GFLAGS_LIBRARY gflags::gflags_static)
   set_target_properties(${GFLAGS_LIBRARY}
                         PROPERTIES INTERFACE_COMPILE_DEFINITIONS 
"GFLAGS_IS_A_DLL=0"


Could you try the change with clean build directory?


Thanks,
-- 
kou

In <628FE2E400C207D600390001_0_60716@msllnjpmsgsv06>
  "Re:cpp build issue with gflags" on Thu, 26 May 2022 20:28:20 -0000,
  "Arkadiy Vertleyb (BLOOMBERG/ 120 PARK)" <[email protected]> wrote:

> This issue gets resolved if I run the second step twice.
> 
> From: [email protected] At: 05/26/22 15:12:39 UTC-4:00To:  
> [email protected]
> Subject: cpp build issue with gflags
> 
> Hi all,
> 
> Trying to build cpp Arrow with MSVC 2019, as per 
> https://arrow.apache.org/docs/developers/cpp/windows.html.
> 
> The first step - 
> 
> cmake .. -G "Visual Studio 16 2019" -A x64 -DARROW_BUILD_TESTS=ON
> 
> says it can't find gflags and will build them from source:
> 
> -- Building gflags from source
> -- Added static library dependency gflags::gflags_static: 
> C:/Users/avertleyb/git/arrow/cpp/build/gflags_ep-prefix/src/gflags_ep/lib/gflags_static.lib
> 
> The second step - 
> 
> cmake --build . --config Release
> 
> right away complains about this library:
> 
> LINK : fatal error LNK1181: cannot open input file 
> 'C:\Users\avertleyb\git\arrow\cpp\build\gflags_ep-prefix\src\gflags_ep\lib\gflags_static.lib'
>  
> [C:\Users\avertleyb\git\arrow\cpp\build\src\arrow\arrow_bundled_dependencies.vcxproj]
> C:\Program Files (x86)\Microsoft Visual 
> Studio\2019\Professional\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(241,5):
>  error MSB8066: Custom build for 
> 'C:\Users\avertleyb\git\arrow\cpp\build\CMakeFiles\b033194e6d32d6a2595cc88c82
> 72e4b2\arrow_bundled_dependencies.lib.rule;C:\Users\avertleyb\git\arrow\cpp\build\CMakeFiles\672df30e18a621ddf9c15292835268fd\arrow_bundled_dependencies.rule'
>  exited with code 1181. [C:\Users\avertleyb\git\arrow\cpp\build\src\arrow\arro
> w_bundled_dependencies.vcxproj]
> 
> However it proceeds with the build, and when the build ends, the library is 
> there:
> 
> C:\Users\avertleyb\git\arrow\cpp\build>dir 
> C:\Users\avertleyb\git\arrow\cpp\build\gflags_ep-prefix\src\gflags_ep\lib\gflags_static.lib
>  Volume in drive C is Windows
>  Volume Serial Number is 3E24-1FC6
> 
>  Directory of 
> C:\Users\avertleyb\git\arrow\cpp\build\gflags_ep-prefix\src\gflags_ep\lib
> 
> 05/26/2022  02:40 PM           672,310 gflags_static.lib
>                1 File(s)        672,310 bytes
>                0 Dir(s)  288,920,072,192 bytes free
> 
> So what is wrong?  Any help is greatly appreciated.
> 
> Thanks,
> Arkadiy
> 
> 

Reply via email to