ahodesuka / ahoviewer

A GTK image viewer, manga reader, and booru browser
MIT License
480 stars 30 forks source link

Cannot build on Darwin with Nixpkgs #62

Closed Ericson2314 closed 6 years ago

Ericson2314 commented 6 years ago

With a recent version of http://github.com/nixos/nixpkgs/, I do

nix-build -A ahoviewer

and it fails to link with

  CXXLD    ahoviewer
Undefined symbols for architecture x86_64:
  "_libintl_gettext", referenced from:
      AhoViewer::Booru::Browser::on_copy_image_url() in ahoviewer-browser.o
      AhoViewer::Booru::Browser::on_copy_post_url() in ahoviewer-browser.o
      AhoViewer::Booru::Page::Page(Gtk::Menu*) in ahoviewer-page.o
      AhoViewer::Booru::Page::on_posts_downloaded() in ahoviewer-page.o
      AhoViewer::Booru::Page::Page(Gtk::Menu*) in ahoviewer-page.o
      AhoViewer::Booru::Page::ask_cancel_save() in ahoviewer-page.o
      AhoViewer::KeybindingEditor::KeybindingEditor(_GtkTreeView*, Glib::RefPtr<Gtk::Builder> const&) in ahoviewer-keybindingeditor.o
      ...
ld: symbol(s) not found for architecture x86_64

This makes me think there's a gettext dependency that isn't being accounted for explicitly. As it stands, other dependencies transitively bring gettext into scope for the nixpkgs build, but I notice autoreconf was saying

autoreconf: configure.ac: not using Gettext

After some searching around, I did:

diff --git a/configure-old.ac b/configure.ac
index 6c63b73..bfc59c4 100644
--- a/configure-old.ac
+++ b/configure.ac
@@ -26,6 +26,10 @@ AC_PROG_INSTALL
 AC_LANG([C++])
 AX_CXX_COMPILE_STDCXX_11([noext])

+AM_GNU_GETTEXT
+AM_GNU_GETTEXT_VERSION(0.19.1)
+AM_GNU_GETTEXT_REQUIRE_VERSION(0.19.1)
+
 # Make sure glibmm is up to date for Glib::Threads::Thread::create
 PKG_CHECK_MODULES([glibmm], [glibmm-2.4 >= 2.36.0])

an ugly but effective way to get autoreconf to do gettext things (0.19.1 was a version from 2014, chosen simply and stupidly because you use C++14). But unfortunately that still didn't solve the linking error.

ahodesuka commented 6 years ago

The solution from what I've gathered is to explicitly add -lintl to the linker flags which can be done in src/Makfile.am. Try adding -lintl after @GnuTLS_LIBS@.

On a side note - if you're on OS X I'd honestly just look into using https://github.com/DrabWeb/Booru-chan instead. I don't have the time and resources to test/support OS X extensively.

Ericson2314 commented 6 years ago

Thanks. I'm just a maintainer looking at arbitrary darwin failures; coincidentally there just was opened an across-the-board PR doing just that fix.