Symbol not found: _libintl_gettext

若如初见. 提交于 2019-12-11 00:52:35

问题


I am trying to create a NodeJS module using C++ and node-gyp. The package depends on GNU's Gettext library. I am currently using Mac OS X Mountain Lion. I have tried installing the package myself via manual efforts, via Homebrew, and even via Fink.

The program works via Terminal.app and the package compiles. I can use the .node module just fine, except until I use a method in the library that uses gettext. I get the following errors in REPL and then REPL exits.

dyld: lazy symbol binding failed: Symbol not found: _libintl_gettext
  Referenced from: /Users/KevinMartin/Dropbox/www/node-locale/build/Release/locale.node
  Expected in: dynamic lookup

dyld: Symbol not found: _libintl_gettext
  Referenced from: /Users/KevinMartin/Dropbox/www/node-locale/build/Release/locale.node
  Expected in: dynamic lookup

Trace/BPT trap: 5

Thanks in advance.


回答1:


This is probably happening because you are not listing libintl as a library to be dynamically linked. You need to add something like:

{
  "targets": [
    {
      "target_name": "...",
      "sources": ["..."],
      "libraries": ["/path/to/gettext/lib/libintl.a"]
    }
}

to your binding.gyp file. libintl isn't being linked in your app, statically or dynamically, that is why you get the symbol error.

Edit:

You can probably also do something like:

{
    "targets": [{
        "target_name": "...",
        "sources": [
            "..."
        ],
        "link_settings": {
             "libraries": ["libintl.8.dylib"]
        }
     }]
}


来源:https://stackoverflow.com/questions/13759044/symbol-not-found-libintl-gettext

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!