简体   繁体   English

切换到 clang 后链接共享库失败,添加符号时出错:无法识别文件格式

[英]linking a shared library fails after switching to clang with error adding symbols: file format not recognized

The library is built from source but links against some stuff built with gcc (such as opencv).该库是从源代码构建的,但链接到一些用 gcc 构建的东西(例如 opencv)。

The library is a .a file and I am on linux.该库是一个 .a 文件,我在 linux 上。

Any ideas on what could be going wrong?关于可能出什么问题的任何想法? This was building fine with gcc.这在 gcc 中构建得很好。

I built clang-14, lld and clang++ from source.我从源代码构建了 clang-14、lld 和 clang++。 I installed clang-14 but can't seem to install clang++.我安装了 clang-14 但似乎无法安装 clang++。

The linker used is ld 9.0 (I'm not sure how to make my cmake project use lld).使用的链接器是 ld 9.0(我不确定如何让我的 cmake 项目使用 lld)。

gcc and clang are not compatible. gcc 和 clang 不兼容。 Rebuild your library using clang.使用 clang 重建你的图书馆。

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

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