Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

meson: Fix missing libintl #60

Merged
merged 1 commit into from
Mar 13, 2023
Merged

meson: Fix missing libintl #60

merged 1 commit into from
Mar 13, 2023

Conversation

madpilot78
Copy link
Contributor

meson has issues finding libintl in FreeBSD, work around it.

Ref.: mesonbuild/meson#4468
mesonbuild/meson#8875

@radioactiveman
Copy link
Member

Hi @madpilot78, thanks for testing our Meson support on FreeBSD and your merge request(s).

  1. What is the error message from master and when does it fail (meson setup, compile, link)?
  2. Is this really only required for libaudqt? My expectation would be this affects at least libaudcore and libaudgui as well.

@madpilot78
Copy link
Contributor Author

@radioactiveman

Hi @madpilot78, thanks for testing our Meson support on FreeBSD and your merge request(s).

I'm actually using meson build in the FreeBSD port, since it gives better control of enabled options.

1. What is the error message from `master` and when does it fail (meson setup, compile, link)?

I have not tested the master branch, only the release. I'm building through the FreeBSD ports tree, since I maintain the audacious port there.

The only error I got is at build time:

[ 72% 130/170] c++  -o src/libaudqt/libaudqt.so.2.4.0 src/libaudqt/libaudqt.so.2.4.0.p/meson-generated_.._qt5-images_qrc.cpp.o src/libaudqt/libaudqt.so.2.4.0.p/about-qt.cc.o src/libaudqt/libaudqt.so.2.4.0.p/art-qt.cc.o src/libaudqt/libaudqt.so.2.4.0.p/audqt.cc.o src/libaudqt/libaudqt.so.2.4.0.p/colorbutton.cc.o src/libaudqt/libaudqt.so.2.4.0.p/dark-theme.cc.o src/libaudqt/libaudqt.so.2.4.0.p/dock.cc.o src/libaudqt/libaudqt.so.2.4.0.p/eq-preset-qt.cc.o src/libaudqt/libaudqt.so.2.4.0.p/equalizer-qt.cc.o src/libaudqt/libaudqt.so.2.4.0.p/file-entry.cc.o src/libaudqt/libaudqt.so.2.4.0.p/fileopener.cc.o src/libaudqt/libaudqt.so.2.4.0.p/font-entry.cc.o src/libaudqt/libaudqt.so.2.4.0.p/infopopup-qt.cc.o src/libaudqt/libaudqt.so.2.4.0.p/infowin-qt.cc.o src/libaudqt/libaudqt.so.2.4.0.p/info-widget.cc.o src/libaudqt/libaudqt.so.2.4.0.p/log-inspector.cc.o src/libaudqt/libaudqt.so.2.4.0.p/menu-qt.cc.o src/libaudqt/libaudqt.so.2.4.0.p/playlist-management.cc.o src/libaudqt/libaudqt.so.2.4.0.p/plugin-menu-qt.cc.o src/libaudqt/libaudqt.so.2.4.0.p/prefs-builder.cc.o src/libaudqt/libaudqt.so.2.4.0.p/prefs-plugin.cc.o src/libaudqt/libaudqt.so.2.4.0.p/prefs-widget-qt.cc.o src/libaudqt/libaudqt.so.2.4.0.p/prefs-window-qt.cc.o src/libaudqt/libaudqt.so.2.4.0.p/prefs-pluginlist-model.cc.o src/libaudqt/libaudqt.so.2.4.0.p/queue-manager-qt.cc.o src/libaudqt/libaudqt.so.2.4.0.p/song-window-qt.cc.o src/libaudqt/libaudqt.so.2.4.0.p/url-opener-qt.cc.o src/libaudqt/libaudqt.so.2.4.0.p/util-qt.cc.o src/libaudqt/libaudqt.so.2.4.0.p/treeview.cc.o src/libaudqt/libaudqt.so.2.4.0.p/volumebutton.cc.o -Wl,--as-needed -Wl,--no-undefined -Wl,-O1 -shared -fPIC -Wl,--start-group -Wl,-soname,libaudqt.so.2 -fstack-protector-strong -O2 -pipe -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing -isystem /usr/local/include -DLIBICONV_PLUG -isystem /usr/local/include '-Wl,-rpath,$ORIGIN/../libaudcore:/usr/local/lib/qt5:/usr/local/lib' -Wl,-rpath-link,/wrkdirs/usr/ports/multimedia/audacious/work-qt5/audacious-4.3/_build/src/libaudcore -Wl,-rpath-link,/usr/local/lib/qt5 -Wl,-rpath-link,/usr/local/lib src/libaudcore/libaudcore.so.5.4.0 /usr/local/lib/qt5/libQt5Core.so /usr/local/lib/qt5/libQt5Widgets.so /usr/local/lib/qt5/libQt5Gui.so -Wl,--end-group
FAILED: src/libaudqt/libaudqt.so.2.4.0 
c++  -o src/libaudqt/libaudqt.so.2.4.0 src/libaudqt/libaudqt.so.2.4.0.p/meson-generated_.._qt5-images_qrc.cpp.o src/libaudqt/libaudqt.so.2.4.0.p/about-qt.cc.o src/libaudqt/libaudqt.so.2.4.0.p/art-qt.cc.o src/libaudqt/libaudqt.so.2.4.0.p/audqt.cc.o src/libaudqt/libaudqt.so.2.4.0.p/colorbutton.cc.o src/libaudqt/libaudqt.so.2.4.0.p/dark-theme.cc.o src/libaudqt/libaudqt.so.2.4.0.p/dock.cc.o src/libaudqt/libaudqt.so.2.4.0.p/eq-preset-qt.cc.o src/libaudqt/libaudqt.so.2.4.0.p/equalizer-qt.cc.o src/libaudqt/libaudqt.so.2.4.0.p/file-entry.cc.o src/libaudqt/libaudqt.so.2.4.0.p/fileopener.cc.o src/libaudqt/libaudqt.so.2.4.0.p/font-entry.cc.o src/libaudqt/libaudqt.so.2.4.0.p/infopopup-qt.cc.o src/libaudqt/libaudqt.so.2.4.0.p/infowin-qt.cc.o src/libaudqt/libaudqt.so.2.4.0.p/info-widget.cc.o src/libaudqt/libaudqt.so.2.4.0.p/log-inspector.cc.o src/libaudqt/libaudqt.so.2.4.0.p/menu-qt.cc.o src/libaudqt/libaudqt.so.2.4.0.p/playlist-management.cc.o src/libaudqt/libaudqt.so.2.4.0.p/plugin-menu-qt.cc.o src/libaudqt/libaudqt.so.2.4.0.p/prefs-builder.cc.o src/libaudqt/libaudqt.so.2.4.0.p/prefs-plugin.cc.o src/libaudqt/libaudqt.so.2.4.0.p/prefs-widget-qt.cc.o src/libaudqt/libaudqt.so.2.4.0.p/prefs-window-qt.cc.o src/libaudqt/libaudqt.so.2.4.0.p/prefs-pluginlist-model.cc.o src/libaudqt/libaudqt.so.2.4.0.p/queue-manager-qt.cc.o src/libaudqt/libaudqt.so.2.4.0.p/song-window-qt.cc.o src/libaudqt/libaudqt.so.2.4.0.p/url-opener-qt.cc.o src/libaudqt/libaudqt.so.2.4.0.p/util-qt.cc.o src/libaudqt/libaudqt.so.2.4.0.p/treeview.cc.o src/libaudqt/libaudqt.so.2.4.0.p/volumebutton.cc.o -Wl,--as-needed -Wl,--no-undefined -Wl,-O1 -shared -fPIC -Wl,--start-group -Wl,-soname,libaudqt.so.2 -fstack-protector-strong -O2 -pipe -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing -isystem /usr/local/include -DLIBICONV_PLUG -isystem /usr/local/include '-Wl,-rpath,$ORIGIN/../libaudcore:/usr/local/lib/qt5:/usr/local/lib' -Wl,-rpath-link,/wrkdirs/usr/ports/multimedia/audacious/work-qt5/audacious-4.3/_build/src/libaudcore -Wl,-rpath-link,/usr/local/lib/qt5 -Wl,-rpath-link,/usr/local/lib src/libaudcore/libaudcore.so.5.4.0 /usr/local/lib/qt5/libQt5Core.so /usr/local/lib/qt5/libQt5Widgets.so /usr/local/lib/qt5/libQt5Gui.so -Wl,--end-group
ld: error: undefined symbol: libintl_dgettext
>>> referenced by about-qt.cc
>>>               src/libaudqt/libaudqt.so.2.4.0.p/about-qt.cc.o:(audqt::aboutwindow_show())
>>> referenced by about-qt.cc
>>>               src/libaudqt/libaudqt.so.2.4.0.p/about-qt.cc.o:(audqt::aboutwindow_show())
>>> referenced by audqt.cc
>>>               src/libaudqt/libaudqt.so.2.4.0.p/audqt.cc.o:(audqt::init())
>>> referenced 77 more times
c++: error: linker command failed with exit code 1 (use -v to see invocation)

I would need a little more time to test the master branch, but I don't expect any difference.

2. Is this really only required for `libaudqt`? My expectation would be this affects at least `libaudcore` and `libaudgui` as well.

Yes, the error happened only there, adding the attached fix allowed the software to build.

@radioactiveman
Copy link
Member

Does this patch work for you?

diff --git a/meson.build b/meson.build
index 6c0fa7163..b64a2f475 100644
--- a/meson.build
+++ b/meson.build
@@ -55,6 +55,7 @@ endif
 
 
 have_darwin = host_machine.system() == 'darwin'
+have_freebsd = host_machine.system() == 'freebsd'
 have_windows = host_machine.system() == 'windows'
 
 
@@ -120,7 +121,7 @@ endif
 if (cxx.has_header('libintl.h'))
   add_project_arguments('-DHAVE_GETTEXT', language: ['c', 'cpp'])
 
-  if have_darwin or have_windows
+  if have_darwin or have_freebsd or have_windows
     add_project_link_arguments('-lintl', language: ['c', 'cpp'])
   endif
 endif

@madpilot78
Copy link
Contributor Author

@radioactiveman Unluckily that would not work. It was the first thing I tried, but it fails because libintl resides in /usr/local/lib.

It could work with add_project_link_arguments('-L/usr/local/lib -lintl', language: ['c', 'cpp'])

@jlindgren90
Copy link
Member

libaudcore & libaudgui definitely use gettext as well. What library are they linking to? Are we mixing i18n libraries (e.g. BSD vs. GNU) by linking only libaudqt to libintl?

@madpilot78
Copy link
Contributor Author

@jlindgren90 Looks like the build system is able to figure things out for libaudcore by itself.

Most probable cause is that some other library that they are linking to, lists libintl as a dependency via pkgconfig, and this causes the correct options to get in the command line anyway.

I can investigate this. If this is the case would you rather have the patch extended to explicitly add libintl for those libraries too?

@jlindgren90
Copy link
Member

If this is the case would you rather have the patch extended to explicitly add libintl for those libraries too?

Yes please.

@madpilot78
Copy link
Contributor Author

@jlindgren90

If this is the case would you rather have the patch extended to explicitly add libintl for those libraries too?
Yes please.

On it.

@jlindgren90
Copy link
Member

It could work with add_project_link_arguments('-L/usr/local/lib -lintl', language: ['c', 'cpp'])

Can you try this approach again, along with setting LIBRARY_PATH? It would be nice to add -lintl in one place rather than three.

@madpilot78
Copy link
Contributor Author

madpilot78 commented Mar 13, 2023

@jlindgren90

Worth a test, although I'm not very confident it will work, but I could be wrong.

I'll report back.

@madpilot78
Copy link
Contributor Author

@jlindgren90

Worth a test, although I'm not very confident it will work, but I could be wrong.

I'll report back.

I was definitely wrong, it works fine, I'll followup later with a streamlined patch.

@madpilot78 madpilot78 marked this pull request as draft March 13, 2023 17:15
@madpilot78 madpilot78 marked this pull request as ready for review March 13, 2023 20:50
@jlindgren90
Copy link
Member

Short and sweet. Looks good to me!

@madpilot78
Copy link
Contributor Author

I need to give due credit, this was @radioactiveman suggestion!

@radioactiveman
Copy link
Member

Thanks, please prefix the commit message again with "meson: ". Then it's ready to go. :)

@madpilot78 madpilot78 changed the title Fix missing libintl meson: Fix missing libintl Mar 13, 2023
@radioactiveman radioactiveman merged commit 8b224c1 into audacious-media-player:master Mar 13, 2023
@madpilot78 madpilot78 deleted the FreeBSD_meson_build branch March 13, 2023 21:18
radioactiveman added a commit to audacious-media-player/audacious-plugins that referenced this pull request Mar 13, 2023
freebsd-git pushed a commit to freebsd/freebsd-ports that referenced this pull request Mar 13, 2023
@radioactiveman
Copy link
Member

Thanks @madpilot78 for reporting the issue and your time to fix and test this.
To be consistent I have applied the same fix for audacious-plugins.

@eli-schwartz
Copy link

Eventually, you probably want to update the minimum required version of meson and then use dependency('intl') which I think should handle everything for you.

@radioactiveman
Copy link
Member

@eli-schwartz: Sounds good, thanks for the remark. Requiring 0.59 is too soon though in my opinion. I would like to still support Ubuntu 20.04 which ships Meson 0.53. I may try using a version check. :)

https://mesonbuild.com/Dependencies.html#intl

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants