Symbol not found: _libintl_gettext
Asked Answered
M

1

2

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.

Maieutic answered 7/12, 2012 at 7:53 Comment(2)
Not sure if you found the solution, may be libedit can provide the symbols.Gertiegertrud
@Gertiegertrud This didn't work for me. libintl has become my worst nightmare over the past few days.Unceasing
E
0

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"]
        }
     }]
}
Endocrine answered 2/4, 2015 at 20:57 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.