Dyld 符号未找到错误

发布于 2024-09-19 22:13:03 字数 2381 浏览 8 评论 0原文

这是我的错误。

dyld: Symbol not found: __ZTIN8eqOsirix3ROIE
  Referenced from: /Users/slate/Documents/osirixplugins/CoreDataTrial_EQOsirix/build/Development/rcOsirix.app/Contents/MacOS/rcOsirix
  Expected in: flat namespace
 in /Users/slate/Documents/osirixplugins/CoreDataTrial_EQOsirix/build/Development/rcOsirix.app/Contents/MacOS/rcOsirix
Data Formatters temporarily unavailable, will re-try after a 'continue'. (Not safe to call dlopen at this time.)
(gdb) bt
#0  0x8fe01065 in __dyld_dyld_fatal_error ()
#1  0x8fe04fa5 in __dyld__ZN4dyld4haltEPKc ()
#2  0x8fe0796b in __dyld__ZN4dyld5_mainEPK12macho_headermiPPKcS5_S5_ ()
#3  0x8fe018b1 in __dyld__ZN13dyldbootstrap5startEPK12macho_headeriPPKcl ()
#4  0x8fe01057 in __dyld__dyld_start ()
(gdb) continue
Program received signal:  “EXC_BAD_ACCESS”.
Data Formatters temporarily unavailable, will re-try after a 'continue'. (Not safe to call dlopen at this time.)
(gdb) bt
#0  0x8fe010e3 in __dyld__ZN13dyldbootstrapL30randomizeExecutableLoadAddressEPK12macho_headerPPKcPm ()
#1  0x8fe04fa5 in __dyld__ZN4dyld4haltEPKc ()
#2  0x8fe0796b in __dyld__ZN4dyld5_mainEPK12macho_headermiPPKcS5_S5_ ()
#3  0x8fe018b1 in __dyld__ZN13dyldbootstrap5startEPK12macho_headeriPPKcl ()
#4  0x8fe01057 in __dyld__dyld_start ()
(gdb) 

其中 eqOsirix 是我的主命名空间。不久前我遇到了两个类似的问题(一个两个),但现在这两种解决方案都无法帮助我。

我在更新我的 Mac 后注意到了这个问题,但我认为这是无关的。

不会生成编译错误(或警告)。

什么可能导致这种情况?为什么编译器在链接期间没有捕获任何内容?我已经完成了干净的构建,重置了 XCode 和 Mac...我只是无计可施,谷歌只是为我提供了未包含的第 3 方框架的内容,但这是我的主要命名空间 !!啊啊!


[编辑] 由于@Troubador 指出ROI 不是争夺的一部分,所以我在下面包含了 ROI:

#ifndef EQOSIRIX_ROI_H
#define EQOSIRIX_ROI_H

namespace eqOsirix{

    class ROI : public eq::Object
    {

    public:
        ROI() {};
        virtual ~ROI() {};

        virtual uint32_t getType() {return NONE;};

        virtual void draw() {};

    protected:

        enum ROIType {
            NONE = 0,
            LINE,
            POLY,
            AREA,
            VOLUME
        };

    private:

    };

}


#endif//EQOSIRIX_ROI_H

没什么可搞砸的,而且我认为我拥有所有虚拟资源对于 C++ 定义没问题(而不是 Java 或 ObjC)???

Here's my error.

dyld: Symbol not found: __ZTIN8eqOsirix3ROIE
  Referenced from: /Users/slate/Documents/osirixplugins/CoreDataTrial_EQOsirix/build/Development/rcOsirix.app/Contents/MacOS/rcOsirix
  Expected in: flat namespace
 in /Users/slate/Documents/osirixplugins/CoreDataTrial_EQOsirix/build/Development/rcOsirix.app/Contents/MacOS/rcOsirix
Data Formatters temporarily unavailable, will re-try after a 'continue'. (Not safe to call dlopen at this time.)
(gdb) bt
#0  0x8fe01065 in __dyld_dyld_fatal_error ()
#1  0x8fe04fa5 in __dyld__ZN4dyld4haltEPKc ()
#2  0x8fe0796b in __dyld__ZN4dyld5_mainEPK12macho_headermiPPKcS5_S5_ ()
#3  0x8fe018b1 in __dyld__ZN13dyldbootstrap5startEPK12macho_headeriPPKcl ()
#4  0x8fe01057 in __dyld__dyld_start ()
(gdb) continue
Program received signal:  “EXC_BAD_ACCESS”.
Data Formatters temporarily unavailable, will re-try after a 'continue'. (Not safe to call dlopen at this time.)
(gdb) bt
#0  0x8fe010e3 in __dyld__ZN13dyldbootstrapL30randomizeExecutableLoadAddressEPK12macho_headerPPKcPm ()
#1  0x8fe04fa5 in __dyld__ZN4dyld4haltEPKc ()
#2  0x8fe0796b in __dyld__ZN4dyld5_mainEPK12macho_headermiPPKcS5_S5_ ()
#3  0x8fe018b1 in __dyld__ZN13dyldbootstrap5startEPK12macho_headeriPPKcl ()
#4  0x8fe01057 in __dyld__dyld_start ()
(gdb) 

where eqOsirix is my main namespace. I had two similar problems a while ago (one and two) but neither solution is helping me now.

I noticed the problem after I updated my mac, but I think it's unrelated.

No compile errors are generated (or warnings).

What could cause this? Why isn't the compiler catching anything during linking? I've done clean builds, reset both XCode and the Mac.... I'm just at wit's end and Google just gives me stuff for 3rd party Frameworks not being included but this is my main namespace!! Augh!


[EDIT]
Since @Troubador pointed out that ROI wasn't part of the scramble, I'm including ROI below:

#ifndef EQOSIRIX_ROI_H
#define EQOSIRIX_ROI_H

namespace eqOsirix{

    class ROI : public eq::Object
    {

    public:
        ROI() {};
        virtual ~ROI() {};

        virtual uint32_t getType() {return NONE;};

        virtual void draw() {};

    protected:

        enum ROIType {
            NONE = 0,
            LINE,
            POLY,
            AREA,
            VOLUME
        };

    private:

    };

}


#endif//EQOSIRIX_ROI_H

not much to screw up, and I think I have all the virtuals defined ok for C++ (as opposed to Java or ObjC) ???

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

初相遇 2024-09-26 22:13:04

根据我们对您的问题的讨论,我确信这与您的所有方法都是在类定义中定义的事实有关。这意味着 gcc 没有可以发出 typeinfo 对象符号的“key”函数,即没有可以放置 typeinfo 对象的单个对象文件。因此,gcc 所做的就是将 typeinfo 符号发出到每个对象中需要它的文件,并通知链接器在创建 dylib 时忽略重复项。

我询问可见性属性的原因是,如果即使其中一个重复符号被标记为“隐藏”,那么链接器将隐藏 dylib 中的 typeinfo 符号,并且应用程序的任何其他部分将无法在运行时查找它 -时间。您不会收到似乎符合您报告的行为的编译时错误。

如果您不确定是否使用可见性属性,那么您可能没有使用,因为默认可见性是“默认”,这基本上意味着不隐藏。在构建文件中查找以 -fvisibility 开头的 gcc 选项。还可以使用诸如 __attribute__ ((visibility ("hidden"))) 之类的代码在代码中标记可见性。

我建议在 cpp 文件中移动至少一个成员定义的原因是强制单次发射 typeinfo 对象并测试这是否会产生影响。你没有说你是否尝试过这个,所以很高兴知道。

Based on our discussion on your question I'm sure it has something to do with the fact that all your methods are defined within the class definition. This means that gcc has no "key" function alongside which it can emit the symbol for the typeinfo object i.e. there is no single object file that the typeinfo object can be placed in. What gcc therefore does is to emit the typeinfo symbol into each object file that requires it and inform the linker to ignore duplicates when it creates the dylib.

The reason I asked about the visibility attributes is that if even one of the duplicated symbols is marked as "hidden" then the linker will hide the typeinfo symbol within the dylib and any other part of your application will fail to look it up at run-time. You will not get a compile time error which seems to fit the behaviour you are reporting.

If you are not sure if you are using visibility attributes then you probably are not since the default visiblity is "default" which basically means not hidden. Look for options to gcc that start -fvisibility in your build files. Visiblity can also be marked up in code using things like __attribute__ ((visibility ("hidden"))).

The reason I suggested moving at least one member definition inside a cpp file was to force a single emission of the typeinfo object and test whether this made a difference. You didn't say whether you tried this or not so it would be good to know.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文