简体   繁体   English

CMake Boost libboost_filesystem.so添加符号错误:文件格式错误

[英]CMake Boost libboost_filesystem.so error adding symbols: File in wrong format

I'm new to CMake and to Boost! 我是CMake和Boost的新手!

I'm on a mac, so I can't test Boost code on my machine. 我在Mac上,因此无法在计算机上测试Boost代码。 I have a VM with Ubuntu. 我有一个带有Ubuntu的虚拟机。 I am using JetBrains CLion IDE, which uses CMake to build. 我正在使用JetBrains CLion IDE,它使用CMake构建。 I've been unsuccessful with every tutorial I have tried. 我尝试过的每个教程都没有成功。 So, I just decided to make a project that does nothing. 所以,我只是决定做一个什么都不做的项目。 I've added the Boost information to the CMakeLists.txt file: 我已经将Boost信息添加到CMakeLists.txt文件中:

在此处输入图片说明


EDIT 编辑

Since I really didn't understand the CMakeLists.txt configuration, I learned that I was using one wrong configuration and needed to just remove the set(Boost_LIBRARY_DIR /usr/local/arm/lib) command. 由于我真的不了解CMakeLists.txt配置,因此我了解到我使用了一个错误的配置,只需要删除set(Boost_LIBRARY_DIR / usr / local / arm / lib)命令即可。 Here is a new image of the CORRECT CMakeLists.txt file. 这是CORRECT CMakeLists.txt文件的新图像。

在此处输入图片说明

I can't find where Boost_LIBRARIES is getting configured, which might have something to do with my problem. 我找不到在何处配置Boost_LIBRARIES,这可能与我的问题有关。 You can see main does nothing but print out "Hello, World!" 您可以看到main除了打印“ Hello,World!”外什么也没做。

在此处输入图片说明

Here is the error I get when I try to build: 这是我尝试构建时遇到的错误:

在此处输入图片说明

Boost_LIBRARIES is configured when you call find_package(Boost 1.54 ....) 当您调用find_package时配置Boost_LIBRARIES(Boost 1.54 ....)

The line 线

set (Boost_LIBRARY_DIR /usr/local/arm/lib) 设置(Boost_LIBRARY_DIR / usr / local / arm / lib)

has no impact in your code. 对您的代码没有影响。

The mac still uses the intel processor, AFAIK, and so would your Ubuntu VM. Mac仍然使用英特尔处理器AFAIK,因此您的Ubuntu VM也将使用。 From the location of your boost libraries it looks like boost was compiled for arm. 从boost库的位置看来,boost是为arm编译的。 Do you have other boost libraries installed on your system? 您的系统上是否还安装了其他Boost库? Did you install boost yourself? 您安装了增强功能吗?

a 一种

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM