【问题标题】:Visual Studio 2017 ARM cross compiling linker crashVisual Studio 2017 ARM 交叉编译链接器崩溃
【发布时间】:2018-08-19 00:39:11
【问题描述】:

所以我一直在为我的树莓派做一个项目。但为了方便起见,我想使用 Visual Studio 2017 构建它。它是基于插件的,因此插件实现一个接口并导出一个函数,该函数将一个实例返回到实现类。我遇到的问题是编译器崩溃,只有在我尝试导出所述函数时才会发生这种情况。

extern "C" Plugin __declspec(dllexport) *CreatePlugin(Data *r);

这是插件必须实现的函数的声明,以返回其“插件”接口的实现。

MSVC 编译器给了我以下错误信息:

1>   Bibliothek "build\Debug\Raspberry\libSMH.so" und Objekt "build\Debug\Raspberry\libSMH.exp" werden erstellt.
1>
1>LINK : fatal error LNK1000: Internal error during IMAGE::BuildImage
1>
1>  Version 14.15.26726.0
1>
1>  ExceptionCode            = C0000005
1>  ExceptionFlags           = 00000000
1>  ExceptionAddress         = 0F20CC4E (0F200000) "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.15.26726\bin\HostX86\arm\VCRUNTIME140.dll"
1>  NumberParameters         = 00000002
1>  ExceptionInformation[ 0] = 00000001
1>  ExceptionInformation[ 1] = FEE90000
1>
1>CONTEXT:
1>  Eax    = 00FE5678  Esp    = 006FEE34
1>  Ebx    = 00FE55F8  Ebp    = 006FEE60
1>  Ecx    = 00000080  Esi    = 00FE55F8
1>  Edx    = 00000080  Edi    = FEE90000
1>  Eip    = 0F20CC4E  EFlags = 00010247
1>  SegCs  = 00000023  SegDs  = 0000002B
1>  SegSs  = 0000002B  SegEs  = 0000002B
1>  SegFs  = 00000053  SegGs  = 0000002B
1>  Dr0    = 00000000  Dr3    = 00000000
1>  Dr1    = 00000000  Dr6    = 00000000
1>  Dr2    = 00000000  Dr7    = 00000000

如果我从上面的函数声明中删除 __declspec(dllexport),则不会发生这种情况。

有没有人有交叉编译 ARM 共享库的经验,并且可能知道如何解决这个问题?

【问题讨论】:

    标签: c++ visual-studio visual-c++ arm cross-compiling


    【解决方案1】:

    ARM 什么?

    如果您正在为 ARM Windows 构建,它在 raspberry pi 上的 Win10 IoT 和 windows phone 上运行良好。我没有使用__declspec(dllexport),但是我使用了一个模块定义文件来控制我的导出。设置是配置属性/链接器/输入/模块定义文件。请参阅this article 了解更多信息。

    如果您正在为 ARM Linux 或 Android 或其他一些操作系统构建,我怀疑 VC++ 编译器是否支持该目标。改用 clang,它是 VS2017 的一个可选组件。

    【讨论】:

      猜你喜欢
      • 2021-02-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-10-10
      • 2017-06-11
      相关资源
      最近更新 更多