I tried to build Qv2ray with CMake and Visual Studio on Windows and got the error:
CMake Error at cmake/backend.cmake:9 (message):
gRPC Not Found
Call Stack (most recent call first):
CMakeLists.txt:257 (include)
Check backend.cmake:
find_program(GRPC_CPP_PLUGIN grpc_cpp_plugin)
find_package(gRPC CONFIG QUIET)
# Debian, for example, cannot find gRPC in a proper way.
# This is used as a fallback searching method
if(NOT gRPC_FOUND)
if(WIN32)
message(FATAL_ERROR "gRPC Not Found")
else()
......
I've built gRPC and installed it to C:\gRPC. How can I let CMake find it?
If I add
SET(gRPC_DIR "C:/gRPC/lib/cmake/grpc")
before find_package, I got this error:
-- Could NOT find absl (missing: absl_DIR)
CMake Error at cmake/backend.cmake:9 (message):
gRPC Not Found
Call Stack (most recent call first):
CMakeLists.txt:257 (include)
If I also set absl_DIR, I got another error:
Performing C SOURCE FILE Test UV_LINT_NO_UNUSED_PARAMETER failed with the following output:
Change Dir: C:/v2ray/qv2ray/build/CMakeFiles/CMakeScratch/TryCompile-ixqh17
Run Build Command(s):C:/ninja/ninja.exe cmTC_cc832 && [1/2] Building C object CMakeFiles\cmTC_cc832.dir\src.c.obj
FAILED: CMakeFiles/cmTC_cc832.dir/src.c.obj
"C:\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\bin\Hostx64\x64\cl.exe" /nologo -DUV_LINT_NO_UNUSED_PARAMETER /DWIN32 /D_WINDOWS /W3 /MDd /Zi /Ob0 /Od /RTC1 -Wno-unused-parameter /showIncludes /FoCMakeFiles\cmTC_cc832.dir\src.c.obj /FdCMakeFiles\cmTC_cc832.dir\ /FS -c C:\v2ray\qv2ray\build\CMakeFiles\CMakeScratch\TryCompile-ixqh17\src.c
cl : Command line error D8021 : invalid numeric argument '/Wno-unused-parameter'
ninja: build stopped: subcommand failed.
Source file was:
int main(void) { return 0; }
Performing C SOURCE FILE Test UV_LINT_STRICT_PROTOTYPES failed with the following output:
Change Dir: C:/v2ray/qv2ray/build/CMakeFiles/CMakeScratch/TryCompile-ckl2px
Run Build Command(s):C:/ninja/ninja.exe cmTC_54f78 && [1/2] Building C object CMakeFiles\cmTC_54f78.dir\src.c.obj
FAILED: CMakeFiles/cmTC_54f78.dir/src.c.obj
"C:\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\bin\Hostx64\x64\cl.exe" /nologo -DUV_LINT_STRICT_PROTOTYPES /DWIN32 /D_WINDOWS /W3 /MDd /Zi /Ob0 /Od /RTC1 -Wstrict-prototypes /showIncludes /FoCMakeFiles\cmTC_54f78.dir\src.c.obj /FdCMakeFiles\cmTC_54f78.dir\ /FS -c C:\v2ray\qv2ray\build\CMakeFiles\CMakeScratch\TryCompile-ckl2px\src.c
cl : Command line error D8021 : invalid numeric argument '/Wstrict-prototypes'
ninja: build stopped: subcommand failed.
Source file was:
int main(void) { return 0; }
Performing C SOURCE FILE Test UV_LINT_EXTRA failed with the following output:
Change Dir: C:/v2ray/qv2ray/build/CMakeFiles/CMakeScratch/TryCompile-oz29mu
Run Build Command(s):C:/ninja/ninja.exe cmTC_c075b && [1/2] Building C object CMakeFiles\cmTC_c075b.dir\src.c.obj
FAILED: CMakeFiles/cmTC_c075b.dir/src.c.obj
"C:\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\bin\Hostx64\x64\cl.exe" /nologo -DUV_LINT_EXTRA /DWIN32 /D_WINDOWS /W3 /MDd /Zi /Ob0 /Od /RTC1 -Wextra /showIncludes /FoCMakeFiles\cmTC_c075b.dir\src.c.obj /FdCMakeFiles\cmTC_c075b.dir\ /FS -c C:\v2ray\qv2ray\build\CMakeFiles\CMakeScratch\TryCompile-oz29mu\src.c
cl : Command line error D8021 : invalid numeric argument '/Wextra'
ninja: build stopped: subcommand failed.
Source file was:
int main(void) { return 0; }
Performing C SOURCE FILE Test CMAKE_HAVE_LIBC_PTHREAD failed with the following output:
Change Dir: C:/v2ray/qv2ray/build/CMakeFiles/CMakeScratch/TryCompile-d5iufb
Run Build Command(s):C:/ninja/ninja.exe cmTC_b1e72 && [1/2] Building C object CMakeFiles\cmTC_b1e72.dir\src.c.obj
FAILED: CMakeFiles/cmTC_b1e72.dir/src.c.obj
"C:\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\bin\Hostx64\x64\cl.exe" /nologo -DCMAKE_HAVE_LIBC_PTHREAD /DWIN32 /D_WINDOWS /W3 /MDd /Zi /Ob0 /Od /RTC1 /showIncludes /FoCMakeFiles\cmTC_b1e72.dir\src.c.obj /FdCMakeFiles\cmTC_b1e72.dir\ /FS -c C:\v2ray\qv2ray\build\CMakeFiles\CMakeScratch\TryCompile-d5iufb\src.c
C:\v2ray\qv2ray\build\CMakeFiles\CMakeScratch\TryCompile-d5iufb\src.c(1): fatal error C1083: Cannot open include file: 'pthread.h': No such file or directory
ninja: build stopped: subcommand failed.
Source file was:
#include <pthread.h>
static void* test_func(void* data)
{
return data;
}
int main(void)
{
pthread_t thread;
pthread_create(&thread, NULL, test_func, NULL);
pthread_detach(thread);
pthread_cancel(thread);
pthread_join(thread, NULL);
pthread_atfork(NULL, NULL, NULL);
pthread_exit(NULL);
return 0;
}
Determining if the function pthread_create exists in the pthreads failed with the following output:
Change Dir: C:/v2ray/qv2ray/build/CMakeFiles/CMakeScratch/TryCompile-cyjamz
Run Build Command(s):C:/ninja/ninja.exe cmTC_863f5 && [1/2] Building C object CMakeFiles\cmTC_863f5.dir\CheckFunctionExists.c.obj
[2/2] Linking C executable cmTC_863f5.exe
FAILED: cmTC_863f5.exe
cmd.exe /C "cd . && C:\CMake\bin\cmake.exe -E vs_link_exe --intdir=CMakeFiles\cmTC_863f5.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100220~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100220~1.0\x64\mt.exe --manifests -- "C:\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\bin\Hostx64\x64\link.exe" /nologo CMakeFiles\cmTC_863f5.dir\CheckFunctionExists.c.obj /out:cmTC_863f5.exe /implib:cmTC_863f5.lib /pdb:cmTC_863f5.pdb /version:0.0 /machine:x64 /debug /INCREMENTAL /subsystem:console pthreads.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cd ."
LINK Pass 1: command "C:\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\bin\Hostx64\x64\link.exe /nologo CMakeFiles\cmTC_863f5.dir\CheckFunctionExists.c.obj /out:cmTC_863f5.exe /implib:cmTC_863f5.lib /pdb:cmTC_863f5.pdb /version:0.0 /machine:x64 /debug /INCREMENTAL /subsystem:console pthreads.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:CMakeFiles\cmTC_863f5.dir/intermediate.manifest CMakeFiles\cmTC_863f5.dir/manifest.res" failed (exit code 1104) with the following output:
LINK : fatal error LNK1104: cannot open file 'pthreads.lib'
ninja: build stopped: subcommand failed.
Determining if the function pthread_create exists in the pthread failed with the following output:
Change Dir: C:/v2ray/qv2ray/build/CMakeFiles/CMakeScratch/TryCompile-ymkre8
Run Build Command(s):C:/ninja/ninja.exe cmTC_2ac36 && [1/2] Building C object CMakeFiles\cmTC_2ac36.dir\CheckFunctionExists.c.obj
[2/2] Linking C executable cmTC_2ac36.exe
FAILED: cmTC_2ac36.exe
cmd.exe /C "cd . && C:\CMake\bin\cmake.exe -E vs_link_exe --intdir=CMakeFiles\cmTC_2ac36.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100220~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100220~1.0\x64\mt.exe --manifests -- "C:\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\bin\Hostx64\x64\link.exe" /nologo CMakeFiles\cmTC_2ac36.dir\CheckFunctionExists.c.obj /out:cmTC_2ac36.exe /implib:cmTC_2ac36.lib /pdb:cmTC_2ac36.pdb /version:0.0 /machine:x64 /debug /INCREMENTAL /subsystem:console pthread.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cd ."
LINK Pass 1: command "C:\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\bin\Hostx64\x64\link.exe /nologo CMakeFiles\cmTC_2ac36.dir\CheckFunctionExists.c.obj /out:cmTC_2ac36.exe /implib:cmTC_2ac36.lib /pdb:cmTC_2ac36.pdb /version:0.0 /machine:x64 /debug /INCREMENTAL /subsystem:console pthread.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:CMakeFiles\cmTC_2ac36.dir/intermediate.manifest CMakeFiles\cmTC_2ac36.dir/manifest.res" failed (exit code 1104) with the following output:
LINK : fatal error LNK1104: cannot open file 'pthread.lib'
ninja: build stopped: subcommand failed.
I downloaded pthread-win32, copied pthreadVC2.lib to pthread.lib and added the following line to CMakeLists.txt,
set (CMAKE_EXE_LINKER_FLAGS "/LIBPATH:\"C:\\pthreads-w32-2-9-1-release\\Pre-built.2\\lib\\x64\\\"")
then rebuilt but still got the error:
Performing C SOURCE FILE Test UV_LINT_NO_UNUSED_PARAMETER failed with the following output:
Change Dir: C:/v2ray/qv2ray/build/CMakeFiles/CMakeScratch/TryCompile-wqbrhl
Run Build Command(s):C:/ninja/ninja.exe cmTC_7b6af && [1/2] Building C object CMakeFiles\cmTC_7b6af.dir\src.c.obj
FAILED: CMakeFiles/cmTC_7b6af.dir/src.c.obj
"C:\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\bin\Hostx64\x64\cl.exe" /nologo -DUV_LINT_NO_UNUSED_PARAMETER /DWIN32 /D_WINDOWS /W3 /MDd /Zi /Ob0 /Od /RTC1 -Wno-unused-parameter /showIncludes /FoCMakeFiles\cmTC_7b6af.dir\src.c.obj /FdCMakeFiles\cmTC_7b6af.dir\ /FS -c C:\v2ray\qv2ray\build\CMakeFiles\CMakeScratch\TryCompile-wqbrhl\src.c
cl : Command line error D8021 : invalid numeric argument '/Wno-unused-parameter'
ninja: build stopped: subcommand failed.
Source file was:
int main(void) { return 0; }
Performing C SOURCE FILE Test UV_LINT_STRICT_PROTOTYPES failed with the following output:
Change Dir: C:/v2ray/qv2ray/build/CMakeFiles/CMakeScratch/TryCompile-e8xc9e
Run Build Command(s):C:/ninja/ninja.exe cmTC_f19a7 && [1/2] Building C object CMakeFiles\cmTC_f19a7.dir\src.c.obj
FAILED: CMakeFiles/cmTC_f19a7.dir/src.c.obj
"C:\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\bin\Hostx64\x64\cl.exe" /nologo -DUV_LINT_STRICT_PROTOTYPES /DWIN32 /D_WINDOWS /W3 /MDd /Zi /Ob0 /Od /RTC1 -Wstrict-prototypes /showIncludes /FoCMakeFiles\cmTC_f19a7.dir\src.c.obj /FdCMakeFiles\cmTC_f19a7.dir\ /FS -c C:\v2ray\qv2ray\build\CMakeFiles\CMakeScratch\TryCompile-e8xc9e\src.c
cl : Command line error D8021 : invalid numeric argument '/Wstrict-prototypes'
ninja: build stopped: subcommand failed.
Source file was:
int main(void) { return 0; }
Performing C SOURCE FILE Test UV_LINT_EXTRA failed with the following output:
Change Dir: C:/v2ray/qv2ray/build/CMakeFiles/CMakeScratch/TryCompile-0dci1s
Run Build Command(s):C:/ninja/ninja.exe cmTC_33837 && [1/2] Building C object CMakeFiles\cmTC_33837.dir\src.c.obj
FAILED: CMakeFiles/cmTC_33837.dir/src.c.obj
"C:\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\bin\Hostx64\x64\cl.exe" /nologo -DUV_LINT_EXTRA /DWIN32 /D_WINDOWS /W3 /MDd /Zi /Ob0 /Od /RTC1 -Wextra /showIncludes /FoCMakeFiles\cmTC_33837.dir\src.c.obj /FdCMakeFiles\cmTC_33837.dir\ /FS -c C:\v2ray\qv2ray\build\CMakeFiles\CMakeScratch\TryCompile-0dci1s\src.c
cl : Command line error D8021 : invalid numeric argument '/Wextra'
ninja: build stopped: subcommand failed.
Source file was:
int main(void) { return 0; }
Performing C SOURCE FILE Test CMAKE_HAVE_LIBC_PTHREAD failed with the following output:
Change Dir: C:/v2ray/qv2ray/build/CMakeFiles/CMakeScratch/TryCompile-fxbu04
Run Build Command(s):C:/ninja/ninja.exe cmTC_79d11 && [1/2] Building C object CMakeFiles\cmTC_79d11.dir\src.c.obj
FAILED: CMakeFiles/cmTC_79d11.dir/src.c.obj
"C:\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\bin\Hostx64\x64\cl.exe" /nologo -DCMAKE_HAVE_LIBC_PTHREAD /DWIN32 /D_WINDOWS /W3 /MDd /Zi /Ob0 /Od /RTC1 /showIncludes /FoCMakeFiles\cmTC_79d11.dir\src.c.obj /FdCMakeFiles\cmTC_79d11.dir\ /FS -c C:\v2ray\qv2ray\build\CMakeFiles\CMakeScratch\TryCompile-fxbu04\src.c
C:\v2ray\qv2ray\build\CMakeFiles\CMakeScratch\TryCompile-fxbu04\src.c(1): fatal error C1083: Cannot open include file: 'pthread.h': No such file or directory
ninja: build stopped: subcommand failed.
Source file was:
#include <pthread.h>
static void* test_func(void* data)
{
return data;
}
int main(void)
{
pthread_t thread;
pthread_create(&thread, NULL, test_func, NULL);
pthread_detach(thread);
pthread_cancel(thread);
pthread_join(thread, NULL);
pthread_atfork(NULL, NULL, NULL);
pthread_exit(NULL);
return 0;
}
Determining if the function pthread_create exists in the pthreads failed with the following output:
Change Dir: C:/v2ray/qv2ray/build/CMakeFiles/CMakeScratch/TryCompile-nnzju3
Run Build Command(s):C:/ninja/ninja.exe cmTC_1b1f1 && [1/2] Building C object CMakeFiles\cmTC_1b1f1.dir\CheckFunctionExists.c.obj
[2/2] Linking C executable cmTC_1b1f1.exe
FAILED: cmTC_1b1f1.exe
cmd.exe /C "cd . && C:\CMake\bin\cmake.exe -E vs_link_exe --intdir=CMakeFiles\cmTC_1b1f1.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100220~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100220~1.0\x64\mt.exe --manifests -- "C:\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\bin\Hostx64\x64\link.exe" /nologo CMakeFiles\cmTC_1b1f1.dir\CheckFunctionExists.c.obj /out:cmTC_1b1f1.exe /implib:cmTC_1b1f1.lib /pdb:cmTC_1b1f1.pdb /version:0.0 /LIBPATH:"C:\pthreads-w32-2-9-1-release\Pre-built.2\lib\x64\" /debug /INCREMENTAL /subsystem:console pthreads.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cd ."
LINK: command "C:\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\bin\Hostx64\x64\link.exe /nologo CMakeFiles\cmTC_1b1f1.dir\CheckFunctionExists.c.obj /out:cmTC_1b1f1.exe /implib:cmTC_1b1f1.lib /pdb:cmTC_1b1f1.pdb /version:0.0 /LIBPATH:C:\pthreads-w32-2-9-1-release\Pre-built.2\lib\x64" /debug /INCREMENTAL /subsystem:console pthreads.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:cmTC_1b1f1.exe.manifest" failed (exit code 1120) with the following output:
CheckFunctionExists.c.obj : error LNK2019: unresolved external symbol pthread_create referenced in function main
cmTC_1b1f1.exe : fatal error LNK1120: 1 unresolved externals
ninja: build stopped: subcommand failed.
Determining if the function pthread_create exists in the pthread failed with the following output:
Change Dir: C:/v2ray/qv2ray/build/CMakeFiles/CMakeScratch/TryCompile-4uqkdk
Run Build Command(s):C:/ninja/ninja.exe cmTC_12c03 && [1/2] Building C object CMakeFiles\cmTC_12c03.dir\CheckFunctionExists.c.obj
[2/2] Linking C executable cmTC_12c03.exe
FAILED: cmTC_12c03.exe
cmd.exe /C "cd . && C:\CMake\bin\cmake.exe -E vs_link_exe --intdir=CMakeFiles\cmTC_12c03.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100220~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100220~1.0\x64\mt.exe --manifests -- "C:\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\bin\Hostx64\x64\link.exe" /nologo CMakeFiles\cmTC_12c03.dir\CheckFunctionExists.c.obj /out:cmTC_12c03.exe /implib:cmTC_12c03.lib /pdb:cmTC_12c03.pdb /version:0.0 /LIBPATH:"C:\pthreads-w32-2-9-1-release\Pre-built.2\lib\x64\" /debug /INCREMENTAL /subsystem:console pthread.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cd ."
LINK: command "C:\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\bin\Hostx64\x64\link.exe /nologo CMakeFiles\cmTC_12c03.dir\CheckFunctionExists.c.obj /out:cmTC_12c03.exe /implib:cmTC_12c03.lib /pdb:cmTC_12c03.pdb /version:0.0 /LIBPATH:C:\pthreads-w32-2-9-1-release\Pre-built.2\lib\x64" /debug /INCREMENTAL /subsystem:console pthread.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:cmTC_12c03.exe.manifest" failed (exit code 1120) with the following output:
CheckFunctionExists.c.obj : error LNK2019: unresolved external symbol pthread_create referenced in function main
cmTC_12c03.exe : fatal error LNK1120: 1 unresolved externals
ninja: build stopped: subcommand failed.
The error messages in cmake build window are:
-- Found CURL: C:\curl-7.87.0-win64-mingw\lib (found version "7.87.0")
-- Found Protobuf: C:\protobuf-21.12\lib (found version "3.21.12")
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - not found
-- Found Threads: TRUE
CMake Error at cmake/backend.cmake:16 (message):
gRPC Not Found
Call Stack (most recent call first):
CMakeLists.txt:257 (include)
-- Configuring incomplete, errors occurred!
See also "C:/v2ray/qv2ray/build/CMakeFiles/CMakeOutput.log".
See also "C:/v2ray/qv2ray/build/CMakeFiles/CMakeError.log".
Probably, absl_DIR and pthread are both required by gRPC. But I don't think this is the correct way to let CMake find gRPC since I can run the executables in C:\gRPC\bin\ without problem so gRPC should be able to find the components it depends automatically. What is the correct way to let CMake find gRPC?
Related
As a bit of background, I have a project that I have been developing with Visual Studio and VCPKG manifest mode for some time, it contains one static library project and one unit test project. Everything has been working correctly. I'm now trying to migrate this solution to use CMake, this is my first time using CMake.
With CMake the VCPKG dependencies install correctly, and both the static library and unit tests compile, however it fails on the linking step with a large number of linker errors all related to the GoogleTest library. Here is the first, as an example:
CppSlippiTest.obj : error LNK2019: unresolved external symbol "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl testing::internal::FormatMatcherDescription(bool,char const *,class std::vector<char const*,class std::allocator<char const *> > const &,class std::vector<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > const &)" (?FormatMatcherDescription#internal#testing##YA?AV$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##_NPEBDAEBV?$vector#PEBDV$allocator#PEBD#std###4#AEBV?$vector#V?$basic_string#DU?$char_traits#D#std##V$allocator#D#2##std##V?$allocator#V?$basic_string#DU$char_traits#D#std##V?$allocator#D#2##std###2##4##Z) referenced in function "private: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl cpp_slippi::MatchOptionalMatcherP2<class testing::internal::Eq2Matcher,class std::optional<unsigned char> >::gmock_Impl<class std::optional<unsigned char> const &>::FormatDescription(bool)const " (?FormatDescription#$gmock_Impl#AEBV?$optional#E#std###$MatchOptionalMatcherP2#VEq2Matcher#internal#testing##V?$optional#E#std###cpp_slippi##AEBA?AV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##_N#Z) [C:\Users\Derek\Projects\CppSlippi\build\Test.vcxproj]
There are 36 more of these.
Here is my CMakeLists.txt, slightly abridged for clarity:
cmake_minimum_required(VERSION 3.12...3.24)
# Must be before project()
set(VCPKG_TARGET_TRIPLET x64-windows-static)
project(CppSlippi
VERSION 1.0
DESCRIPTION "Slippi replay file parsing library for C++."
LANGUAGES CXX)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(GTest CONFIG REQUIRED)
find_package(nlohmann_json CONFIG REQUIRED)
add_library(CppSlippi STATIC
CppSlippi/src/CppSlippi.cpp
CppSlippi/src/CppSlippi.h
...)
target_include_directories(CppSlippi PUBLIC CppSlippi/src)
target_compile_features(CppSlippi PUBLIC cxx_std_20)
target_compile_options(CppSlippi PUBLIC /MTd)
set_target_properties(CppSlippi PROPERTIES CXX_EXTENSIONS OFF)
target_link_libraries(CppSlippi PUBLIC nlohmann_json::nlohmann_json)
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
include(CTest)
include(GoogleTest)
endif()
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING)
add_executable(Test
Test/src/CppSlippiTest.cpp
...)
target_include_directories(Test PUBLIC Test/src)
target_compile_features(Test PUBLIC cxx_std_20)
target_compile_options(Test PRIVATE /bigobj /MTd)
set_target_properties(Test PROPERTIES CXX_EXTENSIONS OFF)
target_link_libraries(Test PUBLIC
CppSlippi
nlohmann_json::nlohmann_json
GTest::gtest_main)
gtest_discover_tests(Test)
endif()
Here is my VCPKG manifest:
{
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg/master/scripts/vcpkg.schema.json",
"name": "cpp-slippi",
"version": "1.0.0",
"description": "C++ Slippi replay parser.",
"builtin-baseline": "68b7fec22eb5fd9c0236b1e42b3c0deb8e771b37",
"dependencies": [
"gtest",
"nlohmann-json"
],
"supports": "windows"
}
And to build this I am running:
cmake --build build --target Test
I turned on --verbose to get more information, and this is the link command that CMake is running:
Link:
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\bin\HostX64\x64\link.exe /ERRORREPO
RT:QUEUE /OUT:"C:\Users\Derek\Projects\CppSlippi\build\Debug\Test.exe" /INCREMENTAL /ILK:"Test.dir\Debug\Test.ilk" /N
OLOGO /NATVIS:"C:\Users\Derek\Projects\CppSlippi\build\vcpkg_installed\x64-windows-static\share\nlohmann_json\nlohman
n_json.natvis" Debug\CppSlippi.lib "vcpkg_installed\x64-windows-static\debug\lib\manual-link\gtest_main.lib" "vcpkg_i
nstalled\x64-windows-static\debug\lib\gtest.lib" kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib
oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifes
t:embed /DEBUG /PDB:"C:/Users/Derek/Projects/CppSlippi/build/Debug/Test.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE
/NXCOMPAT /IMPLIB:"C:/Users/Derek/Projects/CppSlippi/build/Debug/Test.lib" /MACHINE:X64 /machine:x64 Test.dir\Debug
\CppSlippiTest.obj ...
Note the presence of gtest_main.lib and gtest.lib, these are the libraries that I believe should include the missing functions. I have checked that these files are present at the locations shown.
I know that in Visual Studio using the GoogleTest main requires adding an AdditionalDependency manually, but from all the instructions I can find this should not be necessary in CMake and the .lib is already in the command line. I did try using target_link_directories anyways, but this did not help.
At this point I am baffled and searching on Google and Stack Overflow has failed to turn up any help.
You link only one of 4 GoogleTest libraries to your app
target_link_libraries(Test PUBLIC
CppSlippi
nlohmann_json::nlohmann_json
GTest::gtest_main)
Depending on the application needs, it should be linked to at least one more library
target_link_libraries(Test PUBLIC
CppSlippi
nlohmann_json::nlohmann_json
GTest::gtest_main
GTest::gtest)
Or
target_link_libraries(Test PUBLIC
CppSlippi
nlohmann_json::nlohmann_json
GTest::gmock_main
GTest::gmock
GTest::gtest)
i am trying to build vlc-qt from source with the QT5.12.3 (need this specific version)
I tried to use with ninja and mingw makefiles and i get those error and i tried with more then 10 other vlc sdk versions
Source:
vlc-qt 1.1.1 and 1.2.0 - https://github.com/bibiparrot/vlc-qt
vlc 3.0.16 - http://download.videolan.org/pub/videolan/vlc/last/win64/
qt 5.12.3 - https://download.qt.io/official_releases/qt/5.12/5.12.3/
Errors with MinGW: full log (https://pastebin.com/raw/9U9Z9BTt)
C:\vlc-qt\build>cmake .. -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Debug ^ -DCMAKE_INSTALL_PREFIX="C:\vlc-qt\build" ^ -DQt5Core_DIR="C:\Qt\Qt5.12.3\5.12.3\msvc2017_64\lib\cmake\Qt5Core" -DQt5Quick_DIR="C:\Qt\Qt5.12.3\5.12.3\msvc2017_64\lib\cmake\Qt5Quick" -DQt5Widgets_DIR="C:\Qt\Qt5.12.3\5.12.3\msvc2017_64\lib\cmake\Qt5Widgets" -DQt5QuickTest_DIR="C:\Qt\Qt5.12.3\5.12.3\msvc2017_64\lib\cmake\Qt5QuickTest" -DQt5Test_DIR="C:\Qt\Qt5.12.3\lib\cmake\Qt5Test" -DLIBVLC_LIBRARY="C:\vlc-3.0.16\sdk\lib\libvlc.lib" ^ -DLIBVLCCORE_LIBRARY="C:\vlc-3.0.16\sdk\lib\libvlccore.lib" ^ -DLIBVLC_INCLUDE_DIR="C:\vlc-3.0.16\sdk\include"
-- Building VLC-Qt 1.2.0
-- Git revision: 7616e81
-- The C compiler identification is GNU 8.3.0
-- The CXX compiler identification is GNU 8.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Strawberry/c/bin/gcc.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Strawberry/c/bin/g++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Build statically: OFF
-- Using Qt 5.12.3
-- Installing to system QML import path: OFF
-- Found LibVLC include-dir path: C:/vlc-3.0.16/sdk/include
-- Found LibVLC library path:C:/vlc-3.0.16/sdk/lib/libvlc.lib
-- Found LibVLCcore library path:C:/vlc-3.0.16/sdk/lib/libvlccore.lib
-- Configuring done
-- Generating done
-- Build files have been written to: C:/vlc-qt/build
C:\vlc-qt\build>mingw32-make
"C:\Program Files\CMake\bin\cmake.exe" -SC:\vlc-qt -BC:\vlc-qt\build --check-build-system CMakeFiles\Makefile.cmake 0
"C:\Program Files\CMake\bin\cmake.exe" -E cmake_progress_start C:\vlc-qt\build\CMakeFiles C:\vlc-qt\build\\CMakeFiles\progress.marks
mingw32-make -f CMakeFiles\Makefile2 all
mingw32-make[1]: Entering directory 'C:/vlc-qt/build'
mingw32-make -f src\core\CMakeFiles\Core_autogen.dir\build.make src/core/CMakeFiles/Core_autogen.dir/depend
mingw32-make[2]: Entering directory 'C:/vlc-qt/build'
"C:\Program Files\CMake\bin\cmake.exe" -E cmake_depends "MinGW Makefiles" C:\vlc-qt C:\vlc-qt\src\core C:\vlc-qt\build C:\vlc-qt\build\src\core C:\vlc-qt\build\src\core\CMakeFiles\Core_autogen.dir\DependInfo.cmake --color=
Scanning dependencies of target Core_autogen
mingw32-make[2]: Leaving directory 'C:/vlc-qt/build'
mingw32-make -f src\core\CMakeFiles\Core_autogen.dir\build.make src/core/CMakeFiles/Core_autogen.dir/build
mingw32-make[2]: Entering directory 'C:/vlc-qt/build'
[ 1%] Automatic MOC and UIC for target Core
cd /d C:\vlc-qt\build\src\core && "C:\Program Files\CMake\bin\cmake.exe" -E cmake_autogen C:/vlc-qt/build/src/core/CMakeFiles/Core_autogen.dir/AutogenInfo.json Debug
mingw32-make[2]: Leaving directory 'C:/vlc-qt/build'
[ 1%] Built target Core_autogen
mingw32-make -f src\core\CMakeFiles\Core.dir\build.make src/core/CMakeFiles/Core.dir/depend
mingw32-make[2]: Entering directory 'C:/vlc-qt/build'
[ 2%] Generating VLCQtCore.obj
cd /d C:\vlc-qt\src\core && C:\Strawberry\c\bin\windres.exe -i C:/vlc-qt/build/src/core/VLCQtCore.rc -o C:/vlc-qt/build/src/core/VLCQtCore.obj
"C:\Program Files\CMake\bin\cmake.exe" -E cmake_depends "MinGW Makefiles" C:\vlc-qt C:\vlc-qt\src\core C:\vlc-qt\build C:\vlc-qt\build\src\core C:\vlc-qt\build\src\core\CMakeFiles\Core.dir\DependInfo.cmake --color=
Scanning dependencies of target Core
mingw32-make[2]: Leaving directory 'C:/vlc-qt/build'
mingw32-make -f src\core\CMakeFiles\Core.dir\build.make src/core/CMakeFiles/Core.dir/build
mingw32-make[2]: Entering directory 'C:/vlc-qt/build'
[ 3%] Building CXX object src/core/CMakeFiles/Core.dir/Core_autogen/mocs_compilation.cpp.obj
cd /d C:\vlc-qt\build\src\core && C:\Strawberry\c\bin\g++.exe -DCore_EXPORTS -DQT_CORE_LIB -DQT_SHARED -DVLCQT_CORE_LIBRARY -D_REENTRANT #CMakeFiles/Core.dir/includes_CXX.rsp -g -Wall -Wextra -std=gnu++11 -o CMakeFiles\Core.dir\Core_autogen\mocs_compilation.cpp.obj -c C:\vlc-qt\build\src\core\Core_autogen\mocs_compilation.cpp
[ 4%] Building CXX object src/core/CMakeFiles/Core.dir/AbstractVideoFrame.cpp.obj
cd /d C:\vlc-qt\build\src\core && C:\Strawberry\c\bin\g++.exe -DCore_EXPORTS -DQT_CORE_LIB -DQT_SHARED -DVLCQT_CORE_LIBRARY -D_REENTRANT #CMakeFiles/Core.dir/includes_CXX.rsp -g -Wall -Wextra -std=gnu++11 -o CMakeFiles\Core.dir\AbstractVideoFrame.cpp.obj -c C:\vlc-qt\src\core\AbstractVideoFrame.cpp
[ 5%] Building CXX object src/core/CMakeFiles/Core.dir/AbstractVideoStream.cpp.obj
cd /d C:\vlc-qt\build\src\core && C:\Strawberry\c\bin\g++.exe -DCore_EXPORTS -DQT_CORE_LIB -DQT_SHARED -DVLCQT_CORE_LIBRARY -D_REENTRANT #CMakeFiles/Core.dir/includes_CXX.rsp -g -Wall -Wextra -std=gnu++11 -o CMakeFiles\Core.dir\AbstractVideoStream.cpp.obj -c C:\vlc-qt\src\core\AbstractVideoStream.cpp
[ 6%] Building CXX object src/core/CMakeFiles/Core.dir/Audio.cpp.obj
cd /d C:\vlc-qt\build\src\core && C:\Strawberry\c\bin\g++.exe -DCore_EXPORTS -DQT_CORE_LIB -DQT_SHARED -DVLCQT_CORE_LIBRARY -D_REENTRANT #CMakeFiles/Core.dir/includes_CXX.rsp -g -Wall -Wextra -std=gnu++11 -o CMakeFiles\Core.dir\Audio.cpp.obj -c C:\vlc-qt\src\core\Audio.cpp
[ 7%] Building CXX object src/core/CMakeFiles/Core.dir/Common.cpp.obj
cd /d C:\vlc-qt\build\src\core && C:\Strawberry\c\bin\g++.exe -DCore_EXPORTS -DQT_CORE_LIB -DQT_SHARED -DVLCQT_CORE_LIBRARY -D_REENTRANT #CMakeFiles/Core.dir/includes_CXX.rsp -g -Wall -Wextra -std=gnu++11 -o CMakeFiles\Core.dir\Common.cpp.obj -c C:\vlc-qt\src\core\Common.cpp
[ 9%] Building CXX object src/core/CMakeFiles/Core.dir/Enums.cpp.obj
cd /d C:\vlc-qt\build\src\core && C:\Strawberry\c\bin\g++.exe -DCore_EXPORTS -DQT_CORE_LIB -DQT_SHARED -DVLCQT_CORE_LIBRARY -D_REENTRANT #CMakeFiles/Core.dir/includes_CXX.rsp -g -Wall -Wextra -std=gnu++11 -o CMakeFiles\Core.dir\Enums.cpp.obj -c C:\vlc-qt\src\core\Enums.cpp
[ 10%] Building CXX object src/core/CMakeFiles/Core.dir/Error.cpp.obj
cd /d C:\vlc-qt\build\src\core && C:\Strawberry\c\bin\g++.exe -DCore_EXPORTS -DQT_CORE_LIB -DQT_SHARED -DVLCQT_CORE_LIBRARY -D_REENTRANT #CMakeFiles/Core.dir/includes_CXX.rsp -g -Wall -Wextra -std=gnu++11 -o CMakeFiles\Core.dir\Error.cpp.obj -c C:\vlc-qt\src\core\Error.cpp
[ 11%] Building CXX object src/core/CMakeFiles/Core.dir/Instance.cpp.obj
cd /d C:\vlc-qt\build\src\core && C:\Strawberry\c\bin\g++.exe -DCore_EXPORTS -DQT_CORE_LIB -DQT_SHARED -DVLCQT_CORE_LIBRARY -D_REENTRANT #CMakeFiles/Core.dir/includes_CXX.rsp -g -Wall -Wextra -std=gnu++11 -o CMakeFiles\Core.dir\Instance.cpp.obj -c C:\vlc-qt\src\core\Instance.cpp
[ 12%] Building CXX object src/core/CMakeFiles/Core.dir/Media.cpp.obj
cd /d C:\vlc-qt\build\src\core && C:\Strawberry\c\bin\g++.exe -DCore_EXPORTS -DQT_CORE_LIB -DQT_SHARED -DVLCQT_CORE_LIBRARY -D_REENTRANT #CMakeFiles/Core.dir/includes_CXX.rsp -g -Wall -Wextra -std=gnu++11 -o CMakeFiles\Core.dir\Media.cpp.obj -c C:\vlc-qt\src\core\Media.cpp
C:\vlc-qt\src\core\Media.cpp: In static member function 'static void VlcMedia::libvlc_callback(const libvlc_event_t*, void*)':
C:\vlc-qt\src\core\Media.cpp:363:74: warning: 'void VlcMedia::parsedChanged(int)' is deprecated [-Wdeprecated-declarations]
emit core->parsedChanged(event->u.media_parsed_changed.new_status);
^
In file included from C:\vlc-qt\src\core\Media.cpp:26:
C:/vlc-qt/src/core/Media.h:321:28: note: declared here
Q_DECL_DEPRECATED void parsedChanged(int status);
^~~~~~~~~~~~~
[ 13%] Building CXX object src/core/CMakeFiles/Core.dir/MediaList.cpp.obj
cd /d C:\vlc-qt\build\src\core && C:\Strawberry\c\bin\g++.exe -DCore_EXPORTS -DQT_CORE_LIB -DQT_SHARED -DVLCQT_CORE_LIBRARY -D_REENTRANT #CMakeFiles/Core.dir/includes_CXX.rsp -g -Wall -Wextra -std=gnu++11 -o CMakeFiles\Core.dir\MediaList.cpp.obj -c C:\vlc-qt\src\core\MediaList.cpp
[ 14%] Building CXX object src/core/CMakeFiles/Core.dir/MediaListPlayer.cpp.obj
cd /d C:\vlc-qt\build\src\core && C:\Strawberry\c\bin\g++.exe -DCore_EXPORTS -DQT_CORE_LIB -DQT_SHARED -DVLCQT_CORE_LIBRARY -D_REENTRANT #CMakeFiles/Core.dir/includes_CXX.rsp -g -Wall -Wextra -std=gnu++11 -o CMakeFiles\Core.dir\MediaListPlayer.cpp.obj -c C:\vlc-qt\src\core\MediaListPlayer.cpp
[ 15%] Building CXX object src/core/CMakeFiles/Core.dir/MediaPlayer.cpp.obj
cd /d C:\vlc-qt\build\src\core && C:\Strawberry\c\bin\g++.exe -DCore_EXPORTS -DQT_CORE_LIB -DQT_SHARED -DVLCQT_CORE_LIBRARY -D_REENTRANT #CMakeFiles/Core.dir/includes_CXX.rsp -g -Wall -Wextra -std=gnu++11 -o CMakeFiles\Core.dir\MediaPlayer.cpp.obj -c C:\vlc-qt\src\core\MediaPlayer.cpp
[ 17%] Building CXX object src/core/CMakeFiles/Core.dir/MetaManager.cpp.obj
cd /d C:\vlc-qt\build\src\core && C:\Strawberry\c\bin\g++.exe -DCore_EXPORTS -DQT_CORE_LIB -DQT_SHARED -DVLCQT_CORE_LIBRARY -D_REENTRANT #CMakeFiles/Core.dir/includes_CXX.rsp -g -Wall -Wextra -std=gnu++11 -o CMakeFiles\Core.dir\MetaManager.cpp.obj -c C:\vlc-qt\src\core\MetaManager.cpp
[ 18%] Building CXX object src/core/CMakeFiles/Core.dir/ModuleDescription.cpp.obj
cd /d C:\vlc-qt\build\src\core && C:\Strawberry\c\bin\g++.exe -DCore_EXPORTS -DQT_CORE_LIB -DQT_SHARED -DVLCQT_CORE_LIBRARY -D_REENTRANT #CMakeFiles/Core.dir/includes_CXX.rsp -g -Wall -Wextra -std=gnu++11 -o CMakeFiles\Core.dir\ModuleDescription.cpp.obj -c C:\vlc-qt\src\core\ModuleDescription.cpp
[ 19%] Building CXX object src/core/CMakeFiles/Core.dir/TrackModel.cpp.obj
cd /d C:\vlc-qt\build\src\core && C:\Strawberry\c\bin\g++.exe -DCore_EXPORTS -DQT_CORE_LIB -DQT_SHARED -DVLCQT_CORE_LIBRARY -D_REENTRANT #CMakeFiles/Core.dir/includes_CXX.rsp -g -Wall -Wextra -std=gnu++11 -o CMakeFiles\Core.dir\TrackModel.cpp.obj -c C:\vlc-qt\src\core\TrackModel.cpp
C:\vlc-qt\src\core\TrackModel.cpp: In copy constructor 'VlcTrackModel::VlcTrackModel(const VlcTrackModel&)':
C:\vlc-qt\src\core\TrackModel.cpp:29:1: warning: base class 'class QAbstractListModel' should be explicitly initialized in the copy constructor [-Wextra]
VlcTrackModel::VlcTrackModel(const VlcTrackModel &other)
^~~~~~~~~~~~~
[ 20%] Building CXX object src/core/CMakeFiles/Core.dir/Video.cpp.obj
cd /d C:\vlc-qt\build\src\core && C:\Strawberry\c\bin\g++.exe -DCore_EXPORTS -DQT_CORE_LIB -DQT_SHARED -DVLCQT_CORE_LIBRARY -D_REENTRANT #CMakeFiles/Core.dir/includes_CXX.rsp -g -Wall -Wextra -std=gnu++11 -o CMakeFiles\Core.dir\Video.cpp.obj -c C:\vlc-qt\src\core\Video.cpp
[ 21%] Building CXX object src/core/CMakeFiles/Core.dir/VideoStream.cpp.obj
cd /d C:\vlc-qt\build\src\core && C:\Strawberry\c\bin\g++.exe -DCore_EXPORTS -DQT_CORE_LIB -DQT_SHARED -DVLCQT_CORE_LIBRARY -D_REENTRANT #CMakeFiles/Core.dir/includes_CXX.rsp -g -Wall -Wextra -std=gnu++11 -o CMakeFiles\Core.dir\VideoStream.cpp.obj -c C:\vlc-qt\src\core\VideoStream.cpp
[ 22%] Building CXX object src/core/CMakeFiles/Core.dir/YUVVideoFrame.cpp.obj
cd /d C:\vlc-qt\build\src\core && C:\Strawberry\c\bin\g++.exe -DCore_EXPORTS -DQT_CORE_LIB -DQT_SHARED -DVLCQT_CORE_LIBRARY -D_REENTRANT #CMakeFiles/Core.dir/includes_CXX.rsp -g -Wall -Wextra -std=gnu++11 -o CMakeFiles\Core.dir\YUVVideoFrame.cpp.obj -c C:\vlc-qt\src\core\YUVVideoFrame.cpp
[ 23%] Building CXX object src/core/CMakeFiles/Core.dir/VideoFrame.cpp.obj
cd /d C:\vlc-qt\build\src\core && C:\Strawberry\c\bin\g++.exe -DCore_EXPORTS -DQT_CORE_LIB -DQT_SHARED -DVLCQT_CORE_LIBRARY -D_REENTRANT #CMakeFiles/Core.dir/includes_CXX.rsp -g -Wall -Wextra -std=gnu++11 -Wno-deprecated -o CMakeFiles\Core.dir\VideoFrame.cpp.obj -c C:\vlc-qt\src\core\VideoFrame.cpp
[ 25%] Building CXX object src/core/CMakeFiles/Core.dir/VideoMemoryStream.cpp.obj
cd /d C:\vlc-qt\build\src\core && C:\Strawberry\c\bin\g++.exe -DCore_EXPORTS -DQT_CORE_LIB -DQT_SHARED -DVLCQT_CORE_LIBRARY -D_REENTRANT #CMakeFiles/Core.dir/includes_CXX.rsp -g -Wall -Wextra -std=gnu++11 -Wno-deprecated -o CMakeFiles\Core.dir\VideoMemoryStream.cpp.obj -c C:\vlc-qt\src\core\VideoMemoryStream.cpp
C:\vlc-qt\src\core\VideoMemoryStream.cpp:27:56: warning: 'VlcVideoMemoryStream' is deprecated [-Wdeprecated-declaration
]
static inline VlcVideoMemoryStream *p_this(void *opaque) { return static_cast<VlcVideoMemoryStream *>(opaque); }
^
In file included from C:\vlc-qt\src\core\VideoMemoryStream.cpp:25:
C:/vlc-qt/src/core/VideoMemoryStream.h:55:43: note: declared here
class Q_DECL_DEPRECATED VLCQT_CORE_EXPORT VlcVideoMemoryStream
^~~~~~~~~~~~~~~~~~~~
C:\vlc-qt\src\core\VideoMemoryStream.cpp: In function 'VlcVideoMemoryStream* p_this(void*)':
C:\vlc-qt\src\core\VideoMemoryStream.cpp:27:100: warning: 'VlcVideoMemoryStream' is deprecated [-Wdeprecated-declarations]
static inline VlcVideoMemoryStream *p_this(void *opaque) { return static_cast<VlcVideoMemoryStream *>(opaque); }
^
In file included from C:\vlc-qt\src\core\VideoMemoryStream.cpp:25:
C:/vlc-qt/src/core/VideoMemoryStream.h:55:43: note: declared here
class Q_DECL_DEPRECATED VLCQT_CORE_EXPORT VlcVideoMemoryStream
^~~~~~~~~~~~~~~~~~~~
C:\vlc-qt\src\core\VideoMemoryStream.cpp: At global scope:
C:\vlc-qt\src\core\VideoMemoryStream.cpp:28:57: warning: 'VlcVideoMemoryStream' is deprecated [-Wdeprecated-declaration
]
static inline VlcVideoMemoryStream *p_this(void **opaque) { return static_cast<VlcVideoMemoryStream *>(*opaque); }
^
In file included from C:\vlc-qt\src\core\VideoMemoryStream.cpp:25:
C:/vlc-qt/src/core/VideoMemoryStream.h:55:43: note: declared here
class Q_DECL_DEPRECATED VLCQT_CORE_EXPORT VlcVideoMemoryStream
^~~~~~~~~~~~~~~~~~~~
C:\vlc-qt\src\core\VideoMemoryStream.cpp: In function 'VlcVideoMemoryStream* p_this(void**)':
C:\vlc-qt\src\core\VideoMemoryStream.cpp:28:101: warning: 'VlcVideoMemoryStream' is deprecated [-Wdeprecated-declarations]
static inline VlcVideoMemoryStream *p_this(void **opaque) { return static_cast<VlcVideoMemoryStream *>(*opaque); }
^
In file included from C:\vlc-qt\src\core\VideoMemoryStream.cpp:25:
C:/vlc-qt/src/core/VideoMemoryStream.h:55:43: note: declared here
class Q_DECL_DEPRECATED VLCQT_CORE_EXPORT VlcVideoMemoryStream
^~~~~~~~~~~~~~~~~~~~
[ 26%] Building CXX object src/core/CMakeFiles/Core.dir/Equalizer.cpp.obj
cd /d C:\vlc-qt\build\src\core && C:\Strawberry\c\bin\g++.exe -DCore_EXPORTS -DQT_CORE_LIB -DQT_SHARED -DVLCQT_CORE_LIBRARY -D_REENTRANT #CMakeFiles/Core.dir/includes_CXX.rsp -g -Wall -Wextra -std=gnu++11 -o CMakeFiles\Core.dir\Equalizer.cpp.obj -c C:\vlc-qt\src\core\Equalizer.cpp
[ 27%] Building C object src/core/CMakeFiles/Core.dir/compat/asprintf.c.obj
cd /d C:\vlc-qt\build\src\core && C:\Strawberry\c\bin\gcc.exe -DCore_EXPORTS -DQT_CORE_LIB -DQT_SHARED -DVLCQT_CORE_LIBRARY -D_REENTRANT #CMakeFiles/Core.dir/includes_C.rsp -g -Wall -Wextra -o CMakeFiles\Core.dir\compat\asprintf.c.obj -c C:\vlc-qt\src\core\compat\asprintf.c
[ 28%] Building C object src/core/CMakeFiles/Core.dir/compat/vasprintf.c.obj
cd /d C:\vlc-qt\build\src\core && C:\Strawberry\c\bin\gcc.exe -DCore_EXPORTS -DQT_CORE_LIB -DQT_SHARED -DVLCQT_CORE_LIBRARY -D_REENTRANT #CMakeFiles/Core.dir/includes_C.rsp -g -Wall -Wextra -o CMakeFiles\Core.dir\compat\vasprintf.c.obj -c C:\vlc-qt\src\core\compat\vasprintf.c
[ 29%] Linking CXX shared library libVLCQtCored.dll
cd /d C:\vlc-qt\build\src\core && "C:\Program Files\CMake\bin\cmake.exe" -E cmake_link_script CMakeFiles\Core.dir\link.txt --verbose=1
"C:\Program Files\CMake\bin\cmake.exe" -E rm -f CMakeFiles\Core.dir/objects.a
Errors with ninja: full log (https://pastebin.com/raw/Fxidf7hi)
C:\vlc-qt\build>cmake .. -GNinja -DCMAKE_BUILD_TYPE=Debug ^ -DCMAKE_INSTALL_PREFIX="C:\vlc-qt\build" ^ -DQt5Core_DIR="C:\Qt\Qt5.12.3\5.12.3\msvc2017_64\lib\cmake\Qt5Core" -DQt5Quick_DIR="C:\Qt\Qt5.12.3\5.12.3\msvc2017_64\lib\cmake\Qt5Quick" -DQt5Widgets_DIR="C:\Qt\Qt5.12.3\5.12.3\msvc2017_64\lib\cmake\Qt5Widgets" -DQt5QuickTest_DIR="C:\Qt\Qt5.12.3\5.12.3\msvc2017_64\lib\cmake\Qt5QuickTest" -DQt5Test_DIR="C:\Qt\Qt5.12.3\lib\cmake\Qt5Test" -DLIBVLC_LIBRARY="C:\vlc-3.0.16\sdk\lib\libvlc.lib" ^ -DLIBVLCCORE_LIBRARY="C:\vlc-3.0.16\sdk\lib\libvlccore.lib" ^ -DLIBVLC_INCLUDE_DIR="C:\vlc-3.0.16\sdk\include"
-- Building VLC-Qt 1.2.0
-- Git revision: 7616e81
-- The C compiler identification is GNU 8.3.0
-- The CXX compiler identification is GNU 8.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Strawberry/c/bin/gcc.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Strawberry/c/bin/c++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Build statically: OFF
-- Using Qt 5.12.3
-- Installing to system QML import path: OFF
-- Found LibVLC include-dir path: C:/vlc-3.0.16/sdk/include
-- Found LibVLC library path:C:/vlc-3.0.16/sdk/lib/libvlc.lib
-- Found LibVLCcore library path:C:/vlc-3.0.16/sdk/lib/libvlccore.lib
-- Configuring done
-- Generating done
-- Build files have been written to: C:/vlc-qt/build
C:\vlc-qt\build>ninja
[10/88] Building CXX object src/core/CMakeFiles/Core.dir/TrackModel.cpp.obj
../src/core/TrackModel.cpp: In copy constructor 'VlcTrackModel::VlcTrackModel(const VlcTrackModel&)':
../src/core/TrackModel.cpp:29:1: warning: base class 'class QAbstractListModel' should be explicitly initialized in the copy constructor [-Wextra]
VlcTrackModel::VlcTrackModel(const VlcTrackModel &other)
^~~~~~~~~~~~~
[17/88] Building CXX object src/core/CMakeFiles/Core.dir/Media.cpp.obj
../src/core/Media.cpp: In static member function 'static void VlcMedia::libvlc_callback(const libvlc_event_t*, void*)':
../src/core/Media.cpp:363:74: warning: 'void VlcMedia::parsedChanged(int)' is deprecated [-Wdeprecated-declarations]
emit core->parsedChanged(event->u.media_parsed_changed.new_status);
^
In file included from ../src/core/Media.cpp:26:
../src/core/Media.h:321:28: note: declared here
Q_DECL_DEPRECATED void parsedChanged(int status);
^~~~~~~~~~~~~
[25/88] Building CXX object src/core/CMakeFiles/Core.dir/VideoMemoryStream.cpp.obj
../src/core/VideoMemoryStream.cpp:27:56: warning: 'VlcVideoMemoryStream' is deprecated [-Wdeprecated-declarations]
static inline VlcVideoMemoryStream *p_this(void *opaque) { return static_cast<VlcVideoMemoryStream *>(opaque); }
^
In file included from ../src/core/VideoMemoryStream.cpp:25:
../src/core/VideoMemoryStream.h:55:43: note: declared here
class Q_DECL_DEPRECATED VLCQT_CORE_EXPORT VlcVideoMemoryStream
^~~~~~~~~~~~~~~~~~~~
../src/core/VideoMemoryStream.cpp: In function 'VlcVideoMemoryStream* p_this(void*)':
../src/core/VideoMemoryStream.cpp:27:100: warning: 'VlcVideoMemoryStream' is deprecated [-Wdeprecated-declarations]
static inline VlcVideoMemoryStream *p_this(void *opaque) { return static_cast<VlcVideoMemoryStream *>(opaque); }
^
In file included from ../src/core/VideoMemoryStream.cpp:25:
../src/core/VideoMemoryStream.h:55:43: note: declared here
class Q_DECL_DEPRECATED VLCQT_CORE_EXPORT VlcVideoMemoryStream
^~~~~~~~~~~~~~~~~~~~
../src/core/VideoMemoryStream.cpp: At global scope:
../src/core/VideoMemoryStream.cpp:28:57: warning: 'VlcVideoMemoryStream' is deprecated [-Wdeprecated-declarations]
static inline VlcVideoMemoryStream *p_this(void **opaque) { return static_cast<VlcVideoMemoryStream *>(*opaque); }
^
In file included from ../src/core/VideoMemoryStream.cpp:25:
../src/core/VideoMemoryStream.h:55:43: note: declared here
class Q_DECL_DEPRECATED VLCQT_CORE_EXPORT VlcVideoMemoryStream
^~~~~~~~~~~~~~~~~~~~
../src/core/VideoMemoryStream.cpp: In function 'VlcVideoMemoryStream* p_this(void**)':
../src/core/VideoMemoryStream.cpp:28:101: warning: 'VlcVideoMemoryStream' is deprecated [-Wdeprecated-declarations]
static inline VlcVideoMemoryStream *p_this(void **opaque) { return static_cast<VlcVideoMemoryStream *>(*opaque); }
^
In file included from ../src/core/VideoMemoryStream.cpp:25:
../src/core/VideoMemoryStream.h:55:43: note: declared here
class Q_DECL_DEPRECATED VLCQT_CORE_EXPORT VlcVideoMemoryStream
^~~~~~~~~~~~~~~~~~~~
[26/88] Linking CXX shared library src\core\libVLCQtCored.dll
FAILED: src/core/libVLCQtCored.dll src/core/libVLCQtCored.dll.a
cmd.exe /C "cd . && C:\Strawberry\c\bin\c++.exe -g -Wall -Wextra -static-libgcc -static-libstdc++ -shared -o src\core\libVLCQtCored.dll -Wl,--out-implib,src\core\libVLCQtCored.dll.a -Wl,--major-image-version,1,--minor-image-version,2 src/core/VLCQtCore.obj src/core/CMakeFiles/Core.dir/Core_autogen/mocs_compilation.cpp.obj src/core/CMakeFiles/Core.dir/AbstractVideoFrame.cpp.obj src/core/CMakeFiles/Core.dir/AbstractVideoStream.cpp.obj src/core/CMakeFiles/Core.dir/Audio.cpp.obj src/core/CMakeFiles/Core.dir/Common.cpp.obj src/core/CMakeFiles/Core.dir/Enums.cpp.obj src/core/CMakeFiles/Core.dir/Error.cpp.obj src/core/CMakeFiles/Core.dir/Instance.cpp.obj src/core/CMakeFiles/Core.dir/Media.cpp.obj src/core/CMakeFiles/Core.dir/MediaList.cpp.obj src/core/CMakeFiles/Core.dir/MediaListPlayer.cpp.obj src/core/CMakeFiles/Core.dir/MediaPlayer.cpp.obj src/core/CMakeFiles/Core.dir/MetaManager.cpp.obj src/core/CMakeFiles/Core.dir/ModuleDescription.cpp.obj src/core/CMakeFiles/Core.dir/TrackModel.cpp.obj src/core/CMakeFiles/Core.dir/Video.cpp.obj src/core/CMakeFiles/Core.dir/VideoStream.cpp.obj src/core/CMakeFiles/Core.dir/YUVVideoFrame.cpp.obj src/core/CMakeFiles/Core.dir/VideoFrame.cpp.obj src/core/CMakeFiles/Core.dir/VideoMemoryStream.cpp.obj src/core/CMakeFiles/Core.dir/Equalizer.cpp.obj src/core/CMakeFiles/Core.dir/compat/asprintf.c.obj src/core/CMakeFiles/Core.dir/compat/vasprintf.c.obj C:/Qt/Qt5.12.3/5.12.3/msvc2017_64/lib/Qt5Cored.lib C:/vlc-3.0.16/sdk/lib/libvlc.lib C:/vlc-3.0.16/sdk/lib/libvlccore.lib -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ."
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/core/CMakeFiles/Core.dir/Core_autogen/mocs_compilation.cpp.obj: in function `VlcAudio::metaObject() const':
C:\vlc-qt\build/src/core/Core_autogen/EWIEGA46WW/moc_Audio.cpp:153: undefined reference to `__imp__ZNK11QObjectData17dynamicMetaObjectEv'
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/core/CMakeFiles/Core.dir/Core_autogen/mocs_compilation.cpp.obj: in function `VlcAudio::qt_metacast(char const*)':
C:\vlc-qt\build/src/core/Core_autogen/EWIEGA46WW/moc_Audio.cpp:161: undefined reference to `__imp__ZN7QObject11qt_metacastEPKc'
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/core/CMakeFiles/Core.dir/Core_autogen/mocs_compilation.cpp.obj: in function `VlcAudio::qt_metacall(QMetaObject::Call, int, void**)':
C:\vlc-qt\build/src/core/Core_autogen/EWIEGA46WW/moc_Audio.cpp:166: undefined reference to `__imp__ZN7QObject11qt_metacallEN11QMetaObject4CallEiPPv'
Ok, thanks to #vre i figure it out.
The solution :
Download vlc-qt and vlc 3.0.16 and extract.
Open cmake-gui choose your visual studio and check "Specify native compilers".
Set compilers to the correct MSVC like in the image
Add entries.. or just click "Configure" and fill it like in the image
After you fill all the entries and there no errors click "Generate"
Click "Open Project" to open it via Visual Studio and Build ..
My team and I are building gRPC using CMake. We have been building gRPC v1.26 (and v1.23 too) just fine with CMake 3.15.6, but since CMake 3.16.x is not building anymore.
This is the log of the tools we are using:
[29/32 0.2/sec] Performing configure step for 'grpc'
loading initial cache file C:/TCSoftware/build-frontend-Qt5132_MSVC17_cmake-Debug/_deps/grpc_src-build/grpc/tmp/grpc-cache-Debug.cmake
-- The C compiler identification is MSVC 19.16.27034.0
-- The CXX compiler identification is MSVC 19.16.27034.0
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Protobuf: C:/TCSoftware/build-frontend-Qt5132_MSVC17_cmake-Debug/install/external/lib/libprotobufd.lib (found version "3.8.0")
-- Found OpenSSL: optimized;C:/Program Files/OpenSSL-Win64/lib/VC/libcrypto64MD.lib;debug;C:/Program Files/OpenSSL-Win64/lib/VC/libcrypto64MDd.lib (found version "1.1.1d")
-- Found ZLIB: C:/TCSoftware/build-frontend-Qt5132_MSVC17_cmake-Debug/install/external/lib/zlibd.lib (found version "1.2.11")
-- Configuring done
-- Generating done
-- Build files have been written to: C:/TCSoftware/build-frontend-Qt5132_MSVC17_cmake-Debug/_deps/grpc_src-build/grpc/src/grpc-build
After configure step, something fails in the build step. However as it can be seen the building process does not stop.
[30/32 0.1/sec] Performing build step for 'grpc'
FAILED: C:/TCSoftware/build-frontend-Qt5132_MSVC17_cmake-Debug/_deps/grpc_src-build/grpc/src/grpc-stamp/grpc-build
cmd.exe /C "cd /D C:\TCSoftware\build-frontend-Qt5132_MSVC17_cmake-Debug\_deps\grpc_src-build\grpc\src\grpc-build && "C:\Program Files\CMake\bin\cmake.exe" --build . && "C:\Program Files\CMake\bin\cmake.exe" -E touch C:/TCSoftware/build-frontend-Qt5132_MSVC17_cmake-Debug/_deps/grpc_src-build/grpc/src/grpc-stamp/grpc-build"
[1/1580 1.3/sec] Building CXX object CMakeFiles\grpc_cronet.dir\src\core\lib\iomgr\udp_server.cc.obj
[2/1580 2.5/sec] Building CXX object CMakeFiles\grpc_cronet.dir\src\core\lib\iomgr\timer_heap.cc.obj
[3/1580 3.3/sec] Building CXX object CMakeFiles\grpc_cronet.dir\src\core\lib\iomgr\timer.cc.obj
It builds a lot of objects until it starts showing strange warnings as follows, but it still keeps building.
[975/1580 5.8/sec] Linking CXX static library gpr.lib
[976/1580 5.8/sec] Linking C static library address_sorting.lib
[977/1580 5.8/sec] Building CXX object CMakeFiles\grpc.dir\src\core\lib\backoff\backoff.cc.obj
...
[982/1580 5.8/sec] Building CXX object CMakeFiles\grpc_ruby_plugin.dir\src\compiler\ruby_plugin.cc.obj
C:\TCSoftware\build-frontend-Qt5132_MSVC17_cmake-Debug\install\external\include\google/protobuf/stubs/logging.h(102): warning C4251: 'google::protobuf::internal::LogMessage::message_': class 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>' needs to have dll-interface to be used by clients of class 'google::protobuf::internal::LogMessage'
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include\xstring(4373): note: see declaration of 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>'
C:\TCSoftware\build-frontend-Qt5132_MSVC17_cmake-Debug\install\external\include\google/protobuf/arena_impl.h(251): warning C4251: 'google::protobuf::internal::ArenaImpl::lifecycle_id_generator_': struct 'std::atomic<__int64>' needs to have dll-interface to be used by clients of class 'google::protobuf::internal::ArenaImpl'
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include\xxatomic(162): note: see declaration of 'std::atomic<__int64>'
More warnings are shown as follows:
[1531/1580 5.5/sec] Building CXX object CMakeFiles\grpc_print_google_default_creds_token.dir\test\core\security\print_google_default_creds_token.cc.obj
[1532/1580 5.5/sec] Linking CXX static library grpc++.lib
server_posix.cc.obj : warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library
rpc_method.cc.obj : warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library
create_channel_posix.cc.obj : warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library
[1533/1580 5.5/sec] Linking CXX static library grpc_plugin_support.lib
[1534/1580 5.5/sec] Building CXX object CMakeFiles\grpc_create_jwt.dir\test\core\security\create_jwt.cc.obj
[1535/1580 5.5/sec] Linking CXX static library grpc++_unsecure.lib
server_posix.cc.obj : warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library
rpc_method.cc.obj : warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library
create_channel_posix.cc.obj : warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library
[1536/1580 5.5/sec] Building CXX object CMakeFiles\grpc_create_jwt.dir\test\core\util\cmdline.cc.obj
[1537/1580 5.5/sec] Linking CXX executable grpc_ruby_plugin.exe
FAILED: grpc_ruby_plugin.exe
cmd.exe /C "cd . && "C:\Program Files\CMake\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\grpc_ruby_plugin.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100177~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100177~1.0\x64\mt.exe --manifests -- C:\PROGRA~2\MICROS~1\2017\COMMUN~1\VC\Tools\MSVC\1416~1.270\bin\Hostx64\x64\link.exe /nologo CMakeFiles\grpc_ruby_plugin.dir\src\compiler\ruby_plugin.cc.obj /out:grpc_ruby_plugin.exe /implib:grpc_ruby_plugin.lib /pdb:grpc_ruby_plugin.pdb /version:0.0 /machine:x64 /debug /INCREMENTAL /subsystem:console C:\TCSoftware\build-frontend-Qt5132_MSVC17_cmake-Debug\install\external\lib\libprotocd.lib C:\TCSoftware\build-frontend-Qt5132_MSVC17_cmake-Debug\install\external\lib\libprotobufd.lib grpc_plugin_support.lib C:\TCSoftware\build-frontend-Qt5132_MSVC17_cmake-Debug\install\external\lib\libprotocd.lib C:\TCSoftware\build-frontend-Qt5132_MSVC17_cmake-Debug\install\external\lib\libprotobufd.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cd ."
LINK Pass 1: command "C:\PROGRA~2\MICROS~1\2017\COMMUN~1\VC\Tools\MSVC\1416~1.270\bin\Hostx64\x64\link.exe /nologo CMakeFiles\grpc_ruby_plugin.dir\src\compiler\ruby_plugin.cc.obj /out:grpc_ruby_plugin.exe /implib:grpc_ruby_plugin.lib /pdb:grpc_ruby_plugin.pdb /version:0.0 /machine:x64 /debug /INCREMENTAL /subsystem:console C:\TCSoftware\build-frontend-Qt5132_MSVC17_cmake-Debug\install\external\lib\libprotocd.lib C:\TCSoftware\build-frontend-Qt5132_MSVC17_cmake-Debug\install\external\lib\libprotobufd.lib grpc_plugin_support.lib C:\TCSoftware\build-frontend-Qt5132_MSVC17_cmake-Debug\install\external\lib\libprotocd.lib C:\TCSoftware\build-frontend-Qt5132_MSVC17_cmake-Debug\install\external\lib\libprotobufd.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:CMakeFiles\grpc_ruby_plugin.dir/intermediate.manifest CMakeFiles\grpc_ruby_plugin.dir/manifest.res" failed (exit code 1120) with the following output:
ruby_plugin.cc.obj : warning LNK4217: locally defined symbol ?name#FileDescriptor#protobuf#google##QEBAAEBV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##XZ (public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const & __cdecl google::protobuf::FileDescriptor::name(void)const ) imported in function "bool __cdecl grpc_ruby_generator::ServicesFilename(class google::protobuf::FileDescriptor const *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *)" (?ServicesFilename#grpc_ruby_generator##YA_NPEBVFileDescriptor#protobuf#google##PEAV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std###Z)
grpc_plugin_support.lib(ruby_generator.cc.obj) : warning LNK4049: locally defined symbol ?name#FileDescriptor#protobuf#google##QEBAAEBV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##XZ (public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const & __cdecl google::protobuf::FileDescriptor::name(void)const ) imported
ruby_plugin.cc.obj : warning LNK4217: locally defined symbol ??0CodedOutputStream#io#protobuf#google##QEAA#PEAVZeroCopyOutputStream#123##Z (public: __cdecl google::protobuf::io::CodedOutputStream::CodedOutputStream(class google::protobuf::io::ZeroCopyOutputStream *)) imported in function "public: virtual bool __cdecl RubyGrpcGenerator::Generate(class google::protobuf::FileDescriptor const *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class google::protobuf::compiler::GeneratorContext *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *)const " (?Generate#RubyGrpcGenerator##UEBA_NPEBVFileDescriptor#protobuf#google##AEBV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##PEAVGeneratorContext#compiler#34#PEAV56##Z)
Build stops after a lot of the above warnings with the following log:
ruby_plugin.cc.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public:
__cdecl google::protobuf::compiler::CodeGenerator::CodeGenerator(void)" (__imp_??0CodeGenerator#compiler#protobuf#google##QEAA#XZ) referenced in function "public: __cdecl RubyGrpcGenerator::RubyGrpcGenerator(void)" (??0RubyGrpcGenerator##QEAA#XZ)
ruby_plugin.cc.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) int __cdecl google::protobuf::compiler::PluginMain(int,char * * const,class google::protobuf::compiler::CodeGenerator const *)" (__imp_?PluginMain#compiler#protobuf#google##YAHHQEAPEADPEBVCodeGenerator#123##Z) referenced in function "int __cdecl grpc::protobuf::compiler::PluginMain(int,char * * const,class google::protobuf::compiler::CodeGenerator const *)" (?PluginMain#compiler#protobuf#grpc##YAHHQEAPEADPEBVCodeGenerator#12google###Z)
grpc_plugin_support.lib(ruby_generator.cc.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const & __cdecl google::protobuf::Descriptor::name(void)const " (__imp_?name#Descriptor#protobuf#google##QEBAAEBV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##XZ) referenced in function "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl grpc_ruby_generator::RubyTypeOf(class google::protobuf::Descriptor const *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?RubyTypeOf#grpc_ruby_generator##YA?AV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##PEBVDescriptor#protobuf#google##AEBV23##Z)
The only thing changed between working build and not working one is: removing build folder, uninstall CMake 3.15.x, reboot, install CMake 3.16.0, build grpc all over again.
Anyone faced something like this? Thank you
I'm trying to compile cpputest with mingw-w64 but can't make it work and I can't find any resources on how to do that. So hopefully this question will help others in the future.
I would like to compile cpputest using mingw-w64, preferably without installing MSYS2 or other packages.
I have mingw-w64 i686-8.1.0-posix-dwarf-rt_v6-rev0 installed. I've cloned cpputest from here.
I tried following Compiling Google test with Mingw-w64 and Compiling and using CppUTest 3.8 under MSYS2/MinGW32 by calling CMake with:
cmake ^
-G "MinGW Makefiles" ^
-D CMAKE_C_COMPILER=gcc.exe ^
-D CMAKE_CXX_COMPILER=g++.exe ^
-D CMAKE_MAKE_PROGRAM=mingw32-make.exe ^
-D C++11=ON ^
.
Which yields:
-------------------------------------------------------
CppUTest Version 3.8
Current compiler options:
CC: C:/mingw-w64/i686-8.1.0-posix-dwarf-rt_v6-rev0/mingw32/bin/gcc.exe
CXX: C:/mingw-w64/i686-8.1.0-posix-dwarf-rt_v6-rev0/mingw32/bin/g++.exe
CppUTest CFLAGS: -include "C:/git/tdd/cpputest/include/CppUTest/MemoryLeakDetectorMallocMacros.h" -Wall -Wextra -pedantic -Wshadow -Wswitch-default -Wswitch-enum -Wconversion -Wsign-conversion -Wno-padded -Wno-long-long -Wstrict-prototypes
CppUTest CXXFLAGS: -include "C:/git/tdd/cpputest/include/CppUTest/MemoryLeakDetectorNewMacros.h" -include "C:/git/tdd/cpputest/include/CppUTest/MemoryLeakDetectorMallocMacros.h" -Wall -Wextra -pedantic -Wshadow -Wswitch-default -Wswitch-enum -Wconversion -Wsign-conversion -Wno-padded -Wno-long-long -Woverloaded-virtual -Wno-old-style-cast -Wno-c++14-compat
CppUTest LDFLAGS:
Features configured in CppUTest:
Memory Leak Detection: ON
Compiling Extensions: ON
Support Long Long: OFF
Use CppUTest flags: ON
Using Standard C library: ON
Using Standard C++ library: ON
Using C++11 library: ON
Generating map file: OFF
Compiling with coverage: OFF
Compile and run self-tests ON
Run self-tests separately OFF
-------------------------------------------------------
Running make fails with:
>mingw32-make.exe
Scanning dependencies of target CppUTest
[ 1%] Building CXX object src/CppUTest/CMakeFiles/CppUTest.dir/CommandLineArguments.cpp.obj
In file included from C:/git/tdd/cpputest/include/CppUTest/Utest.h:34,
from C:/git/tdd/cpputest/include/CppUTest/TestHarness.h:39,
from C:\git\tdd\cpputest\src\CppUTest\CommandLineArguments.cpp:29:
C:/git/tdd/cpputest/include/CppUTest/SimpleString.h:183:31: error: 'nullptr_t' does not name a type
SimpleString StringFrom(const nullptr_t value);
^~~~~~~~~
C:/git/tdd/cpputest/include/CppUTest/SimpleString.h:183:31: note: 'nullptr_t' is defined in header '<cstddef>'; did you forget to '#include <cstddef>'?
C:/git/tdd/cpputest/include/CppUTest/SimpleString.h:42:1:
+#include <cstddef>
C:/git/tdd/cpputest/include/CppUTest/SimpleString.h:183:31:
SimpleString StringFrom(const nullptr_t value);
^~~~~~~~~
mingw32-make.exe[2]: *** [src\CppUTest\CMakeFiles\CppUTest.dir\build.make:63: src/CppUTest/CMakeFiles/CppUTest.dir/CommandLineArguments.cpp.obj] Error 1
mingw32-make.exe[1]: *** [CMakeFiles\Makefile2:886: src/CppUTest/CMakeFiles/CppUTest.dir/all] Error 2
mingw32-make.exe: *** [Makefile:140: all] Error 2
I tried the obvious solution of adding cstddef to SimpleString.h:
--- a/include/CppUTest/SimpleString.h
+++ b/include/CppUTest/SimpleString.h
## -180,6 +180,9 ## SimpleString BracketsFormattedHexString(SimpleString hexString);
* Specifically nullptr_t is not officially supported
*/
#if __cplusplus > 199711L && !defined __arm__
+
+#include <cstddef>
+
SimpleString StringFrom(const nullptr_t value);
#endif
But that still fails with the same error.
So I tried following Build error with CMake and MSYS2 mingw-w64 by installing MSYS2 and then mingw-w64, CMake and Ninja. That gives:
-------------------------------------------------------
CppUTest Version 3.8
Current compiler options:
CC: C:/msys64/mingw64/bin/cc.exe
CXX: C:/msys64/mingw64/bin/c++.exe
CppUTest CFLAGS: -include "C:/git/tdd/cpputest/include/CppUTest/MemoryLeakDetectorMallocMacros.h" -Wall -Wextra -pedantic -Wshadow -Wswitch-default -Wswitch-enum -Wconversion -Wsign-conversion -Wno-padded -Wno-long-long -Wstrict-prototypes
CppUTest CXXFLAGS: -include "C:/git/tdd/cpputest/include/CppUTest/MemoryLeakDetectorNewMacros.h" -include "C:/git/tdd/cpputest/include/CppUTest/MemoryLeakDetectorMallocMacros.h" -Wall -Wextra -pedantic -Wshadow -Wswitch-default -Wswitch-enum -Wconversion -Wsign-conversion -Wno-padded -Wno-long-long -Woverloaded-virtual -Wno-old-style-cast
CppUTest LDFLAGS:
Features configured in CppUTest:
Memory Leak Detection: ON
Compiling Extensions: ON
Support Long Long: OFF
Use CppUTest flags: ON
Using Standard C library: ON
Using Standard C++ library: ON
Using C++11 library: OFF
Generating map file: OFF
Compiling with coverage: OFF
Compile and run self-tests ON
Run self-tests separately OFF
-------------------------------------------------------
Compiling with cmake -G Ninja . && ninja fails with:
include/CppUTest/SimpleString.h:183:31:
SimpleString StringFrom(const nullptr_t value);
^~~~~~~~~
[10/98] Building CXX object src/CppUTest/CMakeFiles/CppUTest.dir/TestMemoryAllocator.cpp.obj
FAILED: src/CppUTest/CMakeFiles/CppUTest.dir/TestMemoryAllocator.cpp.obj
C:\msys64\mingw64\bin\c++.exe -DCPPUTEST_HAVE_STRDUP=1 -DHAVE_CONFIG_H -D_TIMESPEC_DEFINED=1 -I. -Iinclude -Isrc/CppUTest/../../include -include "C:/git/tdd/cpputest/include/CppUTest/MemoryLeakDetectorNewMacros.h" -include "C:/git/tdd/cpputest/include/CppUTest/MemoryLeakDetectorMallocMacros.h" -Wall -Wextra -pedantic -Wshadow -Wswitch-default -Wswitch-enum -Wconversion -Wsign-conversion -Wno-padded -Wno-long-long -Woverloaded-virtual -Wno-old-style-cast -O2 -g -DNDEBUG -MD -MT src/CppUTest/CMakeFiles/CppUTest.dir/TestMemoryAllocator.cpp.obj -MF src\CppUTest\CMakeFiles\CppUTest.dir\TestMemoryAllocator.cpp.obj.d -o src/CppUTest/CMakeFiles/CppUTest.dir/TestMemoryAllocator.cpp.obj -c src/CppUTest/TestMemoryAllocator.cpp
In file included from include/CppUTest/Utest.h:34,
from include/CppUTest/TestHarness.h:39,
from src/CppUTest/TestMemoryAllocator.cpp:28:
include/CppUTest/SimpleString.h:183:31: error: 'nullptr_t' does not name a type
SimpleString StringFrom(const nullptr_t value);
^~~~~~~~~
include/CppUTest/SimpleString.h:183:31: note: 'nullptr_t' is defined in header '<cstddef>'; did you forget to '#include <cstddef>'?
include/CppUTest/SimpleString.h:42:1:
+#include <cstddef>
include/CppUTest/SimpleString.h:183:31:
SimpleString StringFrom(const nullptr_t value);
^~~~~~~~~
ninja: build stopped: subcommand failed.
Thanks!!
Turns out this was a bug in CppUtest.
## -562,7 +562,7 ## SimpleString BracketsFormattedHexString(SimpleString hexString)
* Specifically nullptr_t is not officially supported
*/
#if __cplusplus > 199711L && !defined __arm__
- SimpleString StringFrom(const nullptr_t value)
+ SimpleString StringFrom(const std::nullptr_t value)
{
(void) value;
return "(null)";
It's fixed since Dec. 5th, 2019.
https://github.com/leonardopsantos/cpputest/commit/cb8c457dda6741ede7009103db99967b5f27c969
I am trying to build trilinos in fedora25 guest (virtualbox). Followed procedure described here:
http://iltabiai.github.io/peridynamics/fedora/tips/2016/04/20/Peridigm141-Fedora23.html
I had to adapt the build script from above link so that it could find Netcdf and HDF5 on my system.
trilinos builds with these errors in CMakeError.log :
Performing C++ SOURCE FILE Test FINITE_VALUE_HAVE_GLOBAL_ISNAN failed with the following output:
Change Dir: /home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/gmake" "cmTC_44df3/fast"
/usr/bin/gmake -f CMakeFiles/cmTC_44df3.dir/build.make CMakeFiles/cmTC_44df3.dir/build
gmake[1]: Entering directory '/home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp'
Building CXX object CMakeFiles/cmTC_44df3.dir/src.cxx.o
/usr/lib64/mpich/bin/mpicxx -O2 -ansi -pedantic -ftrapv -Wall -Wno-long-long -std=c++11 -DFINITE_VALUE_HAVE_GLOBAL_ISNAN -o CMakeFiles/cmTC_44df3.dir/src.cxx.o -c /home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp/src.cxx
/home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp/src.cxx: In function ‘int main()’:
/home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp/src.cxx:6:10: error: ‘isnan’ was not declared in this scope
isnan(x);
^
/home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp/src.cxx:6:10: note: suggested alternative:
In file included from /home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp/src.cxx:2:0:
/usr/include/c++/6.3.1/cmath:662:5: note: ‘std::isnan’
isnan(_Tp __x)
^~~~~
CMakeFiles/cmTC_44df3.dir/build.make:65: recipe for target 'CMakeFiles/cmTC_44df3.dir/src.cxx.o' failed
gmake[1]: *** [CMakeFiles/cmTC_44df3.dir/src.cxx.o] Error 1
gmake[1]: Leaving directory '/home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_44df3/fast' failed
gmake: *** [cmTC_44df3/fast] Error 2
Source file was:
#include <cmath>
int main()
{
double x = 1.0;
isnan(x);
return 0;
}
Performing C++ SOURCE FILE Test FINITE_VALUE_HAVE_GLOBAL_ISINF failed with the following output:
Change Dir: /home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/gmake" "cmTC_4cb6e/fast"
/usr/bin/gmake -f CMakeFiles/cmTC_4cb6e.dir/build.make CMakeFiles/cmTC_4cb6e.dir/build
gmake[1]: Entering directory '/home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp'
Building CXX object CMakeFiles/cmTC_4cb6e.dir/src.cxx.o
/usr/lib64/mpich/bin/mpicxx -O2 -ansi -pedantic -ftrapv -Wall -Wno-long-long -std=c++11 -DFINITE_VALUE_HAVE_GLOBAL_ISINF -o CMakeFiles/cmTC_4cb6e.dir/src.cxx.o -c /home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp/src.cxx
/home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp/src.cxx: In function ‘int main()’:
/home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp/src.cxx:6:10: error: ‘isinf’ was not declared in this scope
isinf(x);
^
/home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp/src.cxx:6:10: note: suggested alternative:
In file included from /home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp/src.cxx:2:0:
/usr/include/c++/6.3.1/cmath:635:5: note: ‘std::isinf’
isinf(_Tp __x)
^~~~~
CMakeFiles/cmTC_4cb6e.dir/build.make:65: recipe for target 'CMakeFiles/cmTC_4cb6e.dir/src.cxx.o' failed
gmake[1]: *** [CMakeFiles/cmTC_4cb6e.dir/src.cxx.o] Error 1
gmake[1]: Leaving directory '/home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_4cb6e/fast' failed
gmake: *** [cmTC_4cb6e/fast] Error 2
Source file was:
#include <cmath>
int main()
{
double x = 1.0;
isinf(x);
return 0;
}
Determining if the pthread_create exist failed with the following output:
Change Dir: /home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/gmake" "cmTC_78ecb/fast"
/usr/bin/gmake -f CMakeFiles/cmTC_78ecb.dir/build.make CMakeFiles/cmTC_78ecb.dir/build
gmake[1]: Entering directory '/home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_78ecb.dir/CheckSymbolExists.c.o
/usr/lib64/mpich/bin/mpicc -o CMakeFiles/cmTC_78ecb.dir/CheckSymbolExists.c.o -c /home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c
Linking C executable cmTC_78ecb
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_78ecb.dir/link.txt --verbose=1
/usr/lib64/mpich/bin/mpicc -rdynamic CMakeFiles/cmTC_78ecb.dir/CheckSymbolExists.c.o -o cmTC_78ecb
/usr/bin/ld: CMakeFiles/cmTC_78ecb.dir/CheckSymbolExists.c.o: undefined reference to symbol 'pthread_create##GLIBC_2.2.5'
/usr/lib64/libpthread.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
CMakeFiles/cmTC_78ecb.dir/build.make:97: recipe for target 'cmTC_78ecb' failed
gmake[1]: *** [cmTC_78ecb] Error 1
gmake[1]: Leaving directory '/home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_78ecb/fast' failed
gmake: *** [cmTC_78ecb/fast] Error 2
File /home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:
/* */
#include <pthread.h>
int main(int argc, char** argv)
{
(void)argv;
#ifndef pthread_create
return ((int*)(&pthread_create))[argc];
#else
(void)argc;
return 0;
#endif
}
Determining if the function pthread_create exists in the pthreads failed with the following output:
Change Dir: /home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/gmake" "cmTC_5fb6c/fast"
/usr/bin/gmake -f CMakeFiles/cmTC_5fb6c.dir/build.make CMakeFiles/cmTC_5fb6c.dir/build
gmake[1]: Entering directory '/home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_5fb6c.dir/CheckFunctionExists.c.o
/usr/lib64/mpich/bin/mpicc -DCHECK_FUNCTION_EXISTS=pthread_create -o CMakeFiles/cmTC_5fb6c.dir/CheckFunctionExists.c.o -c /usr/share/cmake/Modules/CheckFunctionExists.c
Linking C executable cmTC_5fb6c
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_5fb6c.dir/link.txt --verbose=1
/usr/lib64/mpich/bin/mpicc -DCHECK_FUNCTION_EXISTS=pthread_create -rdynamic CMakeFiles/cmTC_5fb6c.dir/CheckFunctionExists.c.o -o cmTC_5fb6c -lpthreads
/usr/bin/ld: cannot find -lpthreads
collect2: error: ld returned 1 exit status
CMakeFiles/cmTC_5fb6c.dir/build.make:97: recipe for target 'cmTC_5fb6c' failed
gmake[1]: *** [cmTC_5fb6c] Error 1
gmake[1]: Leaving directory '/home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_5fb6c/fast' failed
gmake: *** [cmTC_5fb6c/fast] Error 2
Performing C++ SOURCE FILE Test HAVE_TEUCHOS_LAPACKLARND failed with the following output:
Change Dir: /home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/gmake" "cmTC_93b6d/fast"
/usr/bin/gmake -f CMakeFiles/cmTC_93b6d.dir/build.make CMakeFiles/cmTC_93b6d.dir/build
gmake[1]: Entering directory '/home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp'
Building CXX object CMakeFiles/cmTC_93b6d.dir/src.cxx.o
/usr/lib64/mpich/bin/mpicxx -O2 -ansi -pedantic -ftrapv -Wall -Wno-long-long -std=c++11 -DHAVE_TEUCHOS_LAPACKLARND -o CMakeFiles/cmTC_93b6d.dir/src.cxx.o -c /home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp/src.cxx
/home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp/src.cxx: In function ‘int main()’:
/home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp/src.cxx:12:38: error: narrowing conversion of ‘0.0’ from ‘double’ to ‘int’ inside { } [-Wnarrowing]
int seed[4] = { 0.0, 0.0, 0.0, 1.0 };
^
/home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp/src.cxx:12:38: error: narrowing conversion of ‘0.0’ from ‘double’ to ‘int’ inside { } [-Wnarrowing]
/home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp/src.cxx:12:38: error: narrowing conversion of ‘0.0’ from ‘double’ to ‘int’ inside { } [-Wnarrowing]
/home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp/src.cxx:12:38: error: narrowing conversion of ‘1.0e+0’ from ‘double’ to ‘int’ inside { } [-Wnarrowing]
CMakeFiles/cmTC_93b6d.dir/build.make:65: recipe for target 'CMakeFiles/cmTC_93b6d.dir/src.cxx.o' failed
gmake[1]: *** [CMakeFiles/cmTC_93b6d.dir/src.cxx.o] Error 1
gmake[1]: Leaving directory '/home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_93b6d/fast' failed
gmake: *** [cmTC_93b6d/fast] Error 2
Return value: 1
Source file was:
#define F77_BLAS_MANGLE(name,NAME) name ## _
#define DLARND_F77 F77_BLAS_MANGLE(dlarnd,DLARND)
extern "C" { double DLARND_F77(const int* idist, int* seed); }
int main()
{
const int idist = 1;
int seed[4] = { 0.0, 0.0, 0.0, 1.0 };
double val = DLARND_F77(&idist, seed);
return (val < 0.0 ? 1 : 0);
}
Performing C++ SOURCE FILE Test HAVE_CXX_PRAGMA_WEAK failed with the following output:
Change Dir: /home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/gmake" "cmTC_21bab/fast"
/usr/bin/gmake -f CMakeFiles/cmTC_21bab.dir/build.make CMakeFiles/cmTC_21bab.dir/build
gmake[1]: Entering directory '/home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp'
Building CXX object CMakeFiles/cmTC_21bab.dir/src.cxx.o
/usr/lib64/mpich/bin/mpicxx -O2 -ansi -pedantic -ftrapv -Wall -Wno-long-long -std=c++11 -DHAVE_CXX_PRAGMA_WEAK -o CMakeFiles/cmTC_21bab.dir/src.cxx.o -c /home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp/src.cxx
/home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp/src.cxx: In function ‘int main()’:
/home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp/src.cxx:14:22: warning: the address of ‘void A::theFunction()’ will never be NULL [-Waddress]
if (A::theFunction != NULL) {
^
Linking CXX executable cmTC_21bab
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_21bab.dir/link.txt --verbose=1
/usr/lib64/mpich/bin/mpicxx -O2 -ansi -pedantic -ftrapv -Wall -Wno-long-long -std=c++11 -DHAVE_CXX_PRAGMA_WEAK -rdynamic CMakeFiles/cmTC_21bab.dir/src.cxx.o -o cmTC_21bab
CMakeFiles/cmTC_21bab.dir/src.cxx.o: In function `main':
src.cxx:(.text.startup+0x25): undefined reference to `A::theFunction()'
collect2: error: ld returned 1 exit status
CMakeFiles/cmTC_21bab.dir/build.make:97: recipe for target 'cmTC_21bab' failed
gmake[1]: *** [cmTC_21bab] Error 1
gmake[1]: Leaving directory '/home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_21bab/fast' failed
gmake: *** [cmTC_21bab/fast] Error 2
Source file was:
#include <iostream>
namespace A {
// theFunction never gets defined, because we
// don't link with a library that defines it.
// That's OK, because it's weak linkage.
#pragma weak theFunction
extern void theFunction ();
}
int main() {
std::cout << "Hi! I am main." << std::endl;
if (A::theFunction != NULL) {
// Should never be called, since we don't link
// with a library that defines A::theFunction.
A::theFunction ();
}
return 0;
}
how can these errors be eliminated?