我正在尝试调试编译问题,但我似乎无法获得GCC(或者可能是make ??)来向我展示它正在执行的实际编译器和链接器命令.这是我看到的输出:
CCLD libvirt_parthelper
libvirt_parthelper-parthelper.o: In function `main':
/root/qemu-build/libvirt-0.9.0/src/storage/parthelper.c:102: undefined reference to `ped_device_get'
/root/qemu-build/libvirt-0.9.0/src/storage/parthelper.c:116: undefined reference to `ped_disk_new'
/root/qemu-build/libvirt-0.9.0/src/storage/parthelper.c:122: undefined reference to `ped_disk_next_partition'
/root/qemu-build/libvirt-0.9.0/src/storage/parthelper.c:172: undefined reference to `ped_disk_next_partition'
/root/qemu-build/libvirt-0.9.0/src/storage/parthelper.c:172: undefined reference to `ped_disk_next_partition'
collect2: ld returned 1 exit status
make[3]: *** [libvirt_parthelper] Error 1
Run Code Online (Sandbox Code Playgroud)
我想看到的应该与此类似:
$ make
gcc -Wall -c -o main.o main.c
gcc -Wall -c -o hello_fn.o hello_fn.c
gcc main.o hello_fn.o -o main
Run Code Online (Sandbox Code Playgroud)
请注意此示例如何显示完整的gcc命令.以上示例仅显示"CCLD libvirt_parthelper"之类的内容.我不确定如何控制这种行为.
我正在开发一个用Linux上的CMake构建的大型C++项目.CMake运行正常,在模块和应用程序树中生成大量的Makefile.运行GNU make会导致链接器错误.如何make在运行之前打印出确切的命令?
-d选项不会打印命令,但是大量信息没有帮助.
-n选项打印所有命令,但不运行它们,所以我不知道确切的问题是什么.从make -n检查stdout,我没有看到任何相关的命令.我怀疑某些命令会根据早期命令的结果而改变,而Makefiles的层次结构使得很难分辨出真正发生的事情.
我在make的手册页中看不到其他任何看起来有用的选项.
如何在命令行中列出cmake默认构建选项?
我需要从源代码构建opencv库,之前我想知道什么是默认的构建设置.
这应该很简单,但我很难搞清楚.通常,在使用make构建项目时,只显示编译器的stderr.如何配置CMake以显示编译器的标准输出?我正在使用GCC,如果这很重要的话.
我正在使用Gradle和CMake从命令行编译Android NDK项目.以前,我使用Ant,ndk-build但我正在尝试将项目完全迁移到Gradle和CMake.
在我,build.gradle我有以下几行来调用CMake:
externalNativeBuild {
cmake {
path "src/main/cpp/CMakeLists.txt"
}
}
Run Code Online (Sandbox Code Playgroud)
现在,我怎样才能强制CMake在它出现之前将所有编译器调用打印到控制台?具体来说,我想看看CMake如何运行编译器和链接器.
我已经尝试了以下,但都无济于事:
1)在我,CMakeLists.txt我已经把以下行:
set(CMAKE_VERBOSE_MAKEFILE on)
Run Code Online (Sandbox Code Playgroud)
没有任何影响.
2)我已经开始构建这样的:
./gradlew build --info
Run Code Online (Sandbox Code Playgroud)
Gradle打印了一些东西,但没有编译器调用.
3)并且像这样:
./gradlew build --debug
Run Code Online (Sandbox Code Playgroud)
Gradle打印了很多东西,但是没有编译器调用.
所以这三次尝试都没有做到我想要的东西让我想知道我怎么能看到CMake如何在我的个人源文件上运行?
我正在尝试让 SSL 与 boost ASIO 一起工作。我在 Windows 上使用 MingW 6.3。
我使用 MingW 构建了 OpenSSL 1.1、1.0 和 0.8,当我尝试将它们链接到项目时,我总是收到不同的错误(取决于缺少的内容)。现在我正在尝试使 OpenSSL 1.1.0g 工作,但即使我使用 CMAKE 手动给出库的路径,我也会遇到这些错误:
如果我使用 OpenSSL 1.1.0g 构建项目,则会出现以下错误:
"C:\Program Files\JetBrains\CLion 2017.2.3\bin\cmake\bin\cmake.exe" --build C:\Users\myuser\Documents\MagesBattleAuthServerCPP\AuthServer\cmake-build-debug --target AuthServer -- -j 2
"C:\Program Files\JetBrains\CLion 2017.2.3\bin\cmake\bin\cmake.exe" -HC:\Users\myuser\Documents\MagesBattleAuthServerCPP\AuthServer -BC:\Users\myuser\Documents\MagesBattleAuthServerCPP\AuthServer\cmake-build-debug --check-build-system CMakeFiles\Makefile.cmake 0
C:/MinGW/bin/mingw32-make.exe -f CMakeFiles\Makefile2 AuthServer
mingw32-make.exe[1]: Entering directory 'C:/Users/myuser/Documents/MagesBattleAuthServerCPP/AuthServer/cmake-build-debug'
"C:\Program Files\JetBrains\CLion 2017.2.3\bin\cmake\bin\cmake.exe" -HC:\Users\myuser\Documents\MagesBattleAuthServerCPP\AuthServer -BC:\Users\myuser\Documents\MagesBattleAuthServerCPP\AuthServer\cmake-build-debug --check-build-system CMakeFiles\Makefile.cmake 0
"C:\Program Files\JetBrains\CLion 2017.2.3\bin\cmake\bin\cmake.exe" -E cmake_progress_start C:\Users\myuser\Documents\MagesBattleAuthServerCPP\AuthServer\cmake-build-debug\CMakeFiles 6
C:/MinGW/bin/mingw32-make.exe -f CMakeFiles\Makefile2 CMakeFiles/AuthServer.dir/all
mingw32-make.exe[2]: Entering directory 'C:/Users/myuser/Documents/MagesBattleAuthServerCPP/AuthServer/cmake-build-debug'
C:/MinGW/bin/mingw32-make.exe -f CMakeFiles\AuthServer.dir\build.make CMakeFiles/AuthServer.dir/depend
mingw32-make.exe[3]: …Run Code Online (Sandbox Code Playgroud) 我的目标是查看有关从命令行g++直接调用by的详细信息cmake。我不在乎make此问题的输出。
根据官方的FAQ和有关相关问题的公认答案,我应该确保例如通过传递命令行标志CMAKE_VERBOSE_MAKEFILE:BOOL=ON来设置生成的内容。当我这样做时,它重新查询了一堆属性,但是没有提供有关调用的更多信息。CMakeCache.txt-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON
但是,cmake用旗帜打电话--verbose=1给我的正是我所需要的。
这两种选择的作用不同?是否--verbose=1已弃用或不鼓励使用?
我正在尝试在ubuntu 17.10上安装(py)caffe
但是当我这样做时,make all我收到以下错误:
./include/caffe/common.hpp(84): error: namespace "std" has no member "isnan"
./include/caffe/common.hpp(85): error: namespace "std" has no member "isinf"
2 errors detected in the compilation of "/tmp/tmpxft_00004921_00000000-19_nesterov_solver.compute_61.cpp1.ii".
Makefile:594: recipe for target '.build_release/cuda/src/caffe/solvers/nesterov_solver.o' failed
Run Code Online (Sandbox Code Playgroud)
或者当我使用cmake时
/home/thijser/caffe/include/caffe/common.hpp(84): error: namespace "std" has no member "isnan"
/home/thijser/caffe/include/caffe/common.hpp(85): error: namespace "std" has no member "isinf"
2 errors detected in the compilation of "/tmp/tmpxft_00004e32_00000000-7_math_functions.cpp1.ii".
CMake Error at cuda_compile_1_generated_math_functions.cu.o.Release.cmake:282 (message):
Error generating file
/home/thijser/caffe/build/src/caffe/CMakeFiles/cuda_compile_1.dir/util/./cuda_compile_1_generated_math_functions.cu.o
Run Code Online (Sandbox Code Playgroud)
请注意,我不仅仅是为了sudo apt-get install caffe,因为这样做也不会安装pycaffe,任何安装pycaffe的解决方案也都有效.我知道std中的isnan可能来自boost或者这在某种程度上涉及c ++版本之间的差异?我不是一个c ++专家,所以我不确定它是如何工作的,我使用gcc4.9,因为nvcc不喜欢更高版本的gcc.我知道caffe适用于其他人的机器和我安装的旧版本的ubuntu,这表明它是一个配置问题.
有谁知道如何解决这个问题?
在cmake上使用详细模式编辑我能够发现它正在执行以下操作
/usr/bin/cmake …Run Code Online (Sandbox Code Playgroud) 我有一个像这样的项目:
|--CMakeLists.txt(1)
|--File1.cpp -W -W-all
|--Folder1
|--CMakeLists.txt(2)
|--File2.cpp -W -W-all -fno-rtti
Run Code Online (Sandbox Code Playgroud)
如上所示,File2.cpp需要使用进行编译,-fno-rtti而其他文件则应使用进行编译rtti。发生这种情况是因为我在项目中同时使用了clang和boost库。我这样写CMakeLists.txt(1):
SET (CMAKE_CXX_FLAGS "-std=c++11 -fexceptions -fno-rtti -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -Wno-long-long" )
Run Code Online (Sandbox Code Playgroud)
并且,CMakeLists.txt(2)我添加了以下内容:
add_definitions( -fno-rtti )
Run Code Online (Sandbox Code Playgroud)
上面没有用。实际上,以下任何一项均不适用于CMakeLists.txt(2)
set_property(SOURCE File2.cpp APPEND_STRING PROPERTY CMAKE_CXX_FLAGS " -fno-rtti ")
set_property(SOURCE File2.cpp APPEND_STRING PROPERTY COMPILE_FLAGS " -fno-rtti ")
ADD_DEFINITIONS(CMAKE_CXX_FLAGS " -fno-rtti ")
ADD_DEFINITIONS(COMPILE_FLAGS " -fno-rtti ")
ADD_DEFINITIONS( -fno-rtti )
Run Code Online (Sandbox Code Playgroud)
我有什么想念的吗?