Skip to contentSkip to conversation

package/ncmpc: don't set NLS

PATCH Andreas Ziegler 2 participants 3 messages Feb 7, 2024 – Feb 8, 2024 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Hi Fabrice,

sorry in case I do not reply to the latest message in the thread; my in-box is currently a bit crowded ...

Quoted 43 lines · Fabrice Fontaine

Message: 30
Date: Tue, 6 Feb 2024 18:59:00 +0100
From: Fabrice Fontaine <[email protected]>
To: Romain Naour <[email protected]>
Cc: [email protected]
Subject: Re: [Buildroot] [PATCH 1/1] package/ncmpc: don't set NLS Message-ID:
<CAPi7W81fffV_0zMh50hgB7bw7++JZzkdSpFUXXbHMPMKmHtbQw@mail.gmail.com>
Content-Type: text/plain; charset="UTF-8"

Hello Romain,

Le mar. 6 f?vr. 2024 ? 18:32, Romain Naour <[email protected]> a ?crit :

Quoted 25 lines

Hello,

Le 06/01/2024 ? 11:12, Fabrice Fontaine a ?crit :

Quoted 16 lines

ncmpc is able to automatically detect NLS support since version 0.47 and
https://github.com/MusicPlayerDaemon/ncmpc/commit/c264db04dd30af301e7d85c9d145bb1f1ae3fea3
so let it handle automatically to avoid the following build failure with a bootlin toolchain which embeds a gettext definition in libintl.h which will clash with the fake gettext definition provided by ncmpc since
https://github.com/MusicPlayerDaemon/ncmpc/commit/95af27ab2d3ceb9df26ebb4e0d936e392a84c153:

In file included from ../src/save_playlist.cxx:8:
/home/buildroot/autobuild/instance-2/output-1/host/or1k-buildroot-linux-gnu/sysroot/usr/include/libintl.h:39:14: error: expected unqualified-id before 'const'
39 | extern char *gettext (const char *__msgid)

      |              ^~~~~~~

/home/buildroot/autobuild/instance-2/output-1/host/or1k-buildroot-linux-gnu/sysroot/usr/include/libintl.h:39:14: error: expected ')' before 'const' ../src/i18n.h:22:20: note: to match this '('
22 | #define gettext(x) (x)
| ^

Quoted 4 lines

Indeed, even if NLS is disabled by the user, libintl.h will be included
by /home/fabrice/buildroot/output/host/opt/ext-toolchain/or1k-buildroot-linux-gnu/include/c++/13.2.0/or1k-buildroot-linux-gnu/bits/messages_members.h though include <chrono>

Quoted 4 lines

We usually want to explicitly handle such option from Buildroot package to not rely on automatic detection (as currently done).

It look like more a bug in ncmpc build system?

Quoted 7 lines

I don't know, upstream wants to have the same code with and without NLS, so they decided to define a gettext macro when NLS is disabled. I could find an upstreamable solution as upstream will probably reject a patch that removes this gettext define and puts #ifdef ENABLE_NLS before every gettext calls.
Do you have an upstreamable solution or should we just add a NLS dependency to ncmpc?

This is probably not related to NLS, but to gettext being included in the build by some other package. This tricks Meson into believing that NLS is enabled.

Also, the code in meson.txt may lead to unexpected results:

if meson.version().version_compare('>= 0.59') and not mini
# Meson 0.59 has native libintl support intl_dep = dependency('intl', required: enable_nls) enable_nls = intl_dep.found()
elif enable_nls.disabled() or mini
intl_dep = dependency('', required: false) enable_nls = false
elif cc.has_header('libintl.h')
intl_dep = dependency('', required: false) enable_nls = true
elif enable_nls.auto()
intl_dep = dependency('', required: false) enable_nls = false
else
error('libintl.h not found')

-- build is (Meson) version dependent
-- 'disabled' command line option overridden by the build system (> 0.59) -- 'auto' treated as 'disabled' (< 0.59)

It would be better to handle 'disabled' first (untested):

intl_dep = dependency('', required: false)
if enable_nls.disabled() or mini
enable_nls = false
# Meson from 0.59: New custom dependency for libintl
elif meson.version().version_compare('>= 0.59')
require_intl = enable_nls
if enable_nls.auto()
require_intl = false
intl_dep = dependency('intl', required: require_intl) enable_nls = intl_dep.found()
# Meson prior to 0.59
elif cc.has_header('libintl.h') # auto and enabled w/ dependency met
enable_nls = true
elif enable_nls.enabled() # enabled with w/ dependency unmet
error('libintl.h not found')

Kind regards,
Andreas

Quoted 27 lines
Quoted 27 lines

Best regards,
Romain

Quoted 22 lines

Fixes:
- http://autobuild.buildroot.org/results/c860e64909dd3b7fa033db0970e1cfc1376c4ec5
- http://autobuild.buildroot.org/results/36eab556fac80124755bff4110af3e43fe6edd78

---
 package/ncmpc/ncmpc.mk | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
package/ncmpc/ncmpc.mk +1 -2
index bc8a62daea..0965981f23 100644
@@ -20,8 +20,7 @@ NCMPC_CPE_ID_VENDOR = ncmpc_project
 
 NCMPC_CONF_OPTS = \
      -Dcurses=ncurses \
-     -Ddocumentation=disabled \
-     $(if $(BR2_SYSTEM_ENABLE_NLS),-Dnls=enabled,-Dnls=disabled)
+     -Ddocumentation=disabled
 
Quoted 7 lines
Quoted 3 lines

package/ncmpc/ncmpc.mk NCMPC_CPE_ID_VENDOR = ncmpc_project · line 26

Quoted 2 lines
package/ncmpc/ncmpc.mk +0 -0
 ifeq ($(BR2_PACKAGE_LIRC_TOOLS),y)
 NCMPC_DEPENDENCIES += lirc-tools

Best Regards,

Fabrice

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#2 lore raw

Hi Fabrice, Romain, *,

more complicated than I thought ...

Quoted 61 lines · Andreas Ziegler

Hi Fabrice,

sorry in case I do not reply to the latest message in the thread; my in-box is currently a bit crowded ...

Quoted 43 lines · Fabrice Fontaine

Message: 30
Date: Tue, 6 Feb 2024 18:59:00 +0100
From: Fabrice Fontaine <[email protected]>
To: Romain Naour <[email protected]>
Cc: [email protected]
Subject: Re: [Buildroot] [PATCH 1/1] package/ncmpc: don't set NLS Message-ID:
<CAPi7W81fffV_0zMh50hgB7bw7++JZzkdSpFUXXbHMPMKmHtbQw@mail.gmail.com>
Content-Type: text/plain; charset="UTF-8"

Hello Romain,

Le mar. 6 f?vr. 2024 ? 18:32, Romain Naour <[email protected]> a ?crit :

Quoted 25 lines

Hello,

Le 06/01/2024 ? 11:12, Fabrice Fontaine a ?crit :

Quoted 16 lines

ncmpc is able to automatically detect NLS support since version 0.47 and
https://github.com/MusicPlayerDaemon/ncmpc/commit/c264db04dd30af301e7d85c9d145bb1f1ae3fea3
so let it handle automatically to avoid the following build failure with a bootlin toolchain which embeds a gettext definition in libintl.h which will clash with the fake gettext definition provided by ncmpc since
https://github.com/MusicPlayerDaemon/ncmpc/commit/95af27ab2d3ceb9df26ebb4e0d936e392a84c153:

In file included from ../src/save_playlist.cxx:8:
/home/buildroot/autobuild/instance-2/output-1/host/or1k-buildroot-linux-gnu/sysroot/usr/include/libintl.h:39:14: error: expected unqualified-id before 'const'
39 | extern char *gettext (const char *__msgid)

      |              ^~~~~~~

/home/buildroot/autobuild/instance-2/output-1/host/or1k-buildroot-linux-gnu/sysroot/usr/include/libintl.h:39:14: error: expected ')' before 'const' ../src/i18n.h:22:20: note: to match this '('
22 | #define gettext(x) (x)
| ^

Quoted 4 lines

Indeed, even if NLS is disabled by the user, libintl.h will be included
by /home/fabrice/buildroot/output/host/opt/ext-toolchain/or1k-buildroot-linux-gnu/include/c++/13.2.0/or1k-buildroot-linux-gnu/bits/messages_members.h though include <chrono>

Quoted 4 lines

We usually want to explicitly handle such option from Buildroot package to not rely on automatic detection (as currently done).

It look like more a bug in ncmpc build system?

Quoted 7 lines

I don't know, upstream wants to have the same code with and without NLS, so they decided to define a gettext macro when NLS is disabled. I could find an upstreamable solution as upstream will probably reject a patch that removes this gettext define and puts #ifdef ENABLE_NLS before every gettext calls.
Do you have an upstreamable solution or should we just add a NLS dependency to ncmpc?

This is probably not related to NLS, but to gettext being included in the build by some other package. This tricks Meson into believing that NLS is enabled.

Also, the code in meson.txt may lead to unexpected results:

Quoted 16 lines

if meson.version().version_compare('>= 0.59') and not mini
# Meson 0.59 has native libintl support intl_dep = dependency('intl', required: enable_nls) enable_nls = intl_dep.found()
elif enable_nls.disabled() or mini
intl_dep = dependency('', required: false) enable_nls = false
elif cc.has_header('libintl.h')
intl_dep = dependency('', required: false) enable_nls = true
elif enable_nls.auto()
intl_dep = dependency('', required: false) enable_nls = false
else
error('libintl.h not found')

<cut>

meson.txt works like nls=auto within Buildroot, thus reflecting the setting of BR2_SYSTEM_ENABLE_NLS, so no worries.

The toolchain seems to have been built with NLS support; the C++ library makes use of this:

[3/73] Compiling C++ object src/event/libevent.a.p/TimerList.cxx.o
FAILED: src/event/libevent.a.p/TimerList.cxx.o
/home/data/test/autobuild/host/bin/or1k-linux-g++ -Isrc/event/libevent.a.p -Isrc/event -I../src/event -Isrc -I../src -I. -I.. -fdiagnostics-color=always -Wall -Winvalid-pch -Wextra -Wpedantic -std=c++2a -O3 -Wcast-qual -Wcast-align -Wdouble-promotion -Wmissing-declarations -Wmissing-format-attribute -Wmissing-noreturn -Wredundant-decls -Wshadow -Wundef -Wvla -Wwrite-strings -fno-threadsafe-statics -fmerge-all-constants -Wno-non-virtual-dtor -Wno-format-truncation -D_GNU_SOURCE -fvisibility=hidden -ffunction-sections -fdata-sections -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -O3 -g0 -D_FORTIFY_SOURCE=2 -fPIC -MD -MQ src/event/libevent.a.p/TimerList.cxx.o -MF src/event/libevent.a.p/TimerList.cxx.o.d -o src/event/libevent.a.p/TimerList.cxx.o -c ../src/event/TimerList.cxx In file included from /home/data/test/autobuild/host/opt/ext-toolchain/or1k-buildroot-linux-gnu/include/c++/13.2.0/or1k-buildroot-linux-gnu/bits/messages_members.h:36,
from
/home/data/test/autobuild/host/opt/ext-toolchain/or1k-buildroot-linux-gnu/include/c++/13.2.0/bits/locale_facets_nonio.h:2064,
from
/home/data/test/autobuild/host/opt/ext-toolchain/or1k-buildroot-linux-gnu/include/c++/13.2.0/locale:43,
from
/home/data/test/autobuild/host/opt/ext-toolchain/or1k-buildroot-linux-gnu/include/c++/13.2.0/iomanip:45,
from
/home/data/test/autobuild/host/opt/ext-toolchain/or1k-buildroot-linux-gnu/include/c++/13.2.0/bits/chrono_io.h:38,
from
/home/data/test/autobuild/host/opt/ext-toolchain/or1k-buildroot-linux-gnu/include/c++/13.2.0/chrono:3330,

                 from ../src/event/Chrono.hxx:6,
                 from ../src/event/TimerList.hxx:7,
                 from ../src/event/TimerList.cxx:5:
/home/data/test/autobuild/host/or1k-buildroot-linux-gnu/sysroot/usr/include/libintl.h:23:2: error: #error "libintl.h included here"
   23 | #error "libintl.h included here"
      |  ^~~~~

Probably the least invasive solution would be to add a new ncmpc dependency:

+ depends on !BR2_TOOLCHAIN_HAS_FULL_GETTEXT || BR2_SYSTEM_ENABLE_NLS

Kind regards,
Andreas
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#3 lore raw

Hi Andreas, Romain,

Quoted 132 lines · Andreas Ziegler

Hi Fabrice, Romain, *,

more complicated than I thought ...

Quoted 66 lines · Andreas Ziegler

Hi Fabrice,

sorry in case I do not reply to the latest message in the thread; my in-box is currently a bit crowded ...

Quoted 45 lines · Fabrice Fontaine

Message: 30
Date: Tue, 6 Feb 2024 18:59:00 +0100
From: Fabrice Fontaine <[email protected]>
To: Romain Naour <[email protected]>
Cc: [email protected]
Subject: Re: [Buildroot] [PATCH 1/1] package/ncmpc: don't set NLS Message-ID:
<CAPi7W81fffV_0zMh50hgB7bw7++JZzkdSpFUXXbHMPMKmHtbQw@mail.gmail.com>
Content-Type: text/plain; charset="UTF-8"

Hello Romain,

Le mar. 6 f?vr. 2024 ? 18:32, Romain Naour <[email protected]> a ?crit :

Quoted 25 lines

Hello,

Le 06/01/2024 ? 11:12, Fabrice Fontaine a ?crit :

Quoted 16 lines

ncmpc is able to automatically detect NLS support since version 0.47 and
https://github.com/MusicPlayerDaemon/ncmpc/commit/c264db04dd30af301e7d85c9d145bb1f1ae3fea3
so let it handle automatically to avoid the following build failure with a bootlin toolchain which embeds a gettext definition in libintl.h which will clash with the fake gettext definition provided by ncmpc since
https://github.com/MusicPlayerDaemon/ncmpc/commit/95af27ab2d3ceb9df26ebb4e0d936e392a84c153:

In file included from ../src/save_playlist.cxx:8:
/home/buildroot/autobuild/instance-2/output-1/host/or1k-buildroot-linux-gnu/sysroot/usr/include/libintl.h:39:14: error: expected unqualified-id before 'const'
39 | extern char *gettext (const char *__msgid)

      |              ^~~~~~~

/home/buildroot/autobuild/instance-2/output-1/host/or1k-buildroot-linux-gnu/sysroot/usr/include/libintl.h:39:14: error: expected ')' before 'const' ../src/i18n.h:22:20: note: to match this '('
22 | #define gettext(x) (x)
| ^

Quoted 4 lines

Indeed, even if NLS is disabled by the user, libintl.h will be included
by /home/fabrice/buildroot/output/host/opt/ext-toolchain/or1k-buildroot-linux-gnu/include/c++/13.2.0/or1k-buildroot-linux-gnu/bits/messages_members.h though include <chrono>

Quoted 5 lines

We usually want to explicitly handle such option from Buildroot package to not
rely on automatic detection (as currently done).

It look like more a bug in ncmpc build system?

Quoted 7 lines

I don't know, upstream wants to have the same code with and without NLS, so they decided to define a gettext macro when NLS is disabled. I could find an upstreamable solution as upstream will probably reject a patch that removes this gettext define and puts #ifdef ENABLE_NLS before every gettext calls.
Do you have an upstreamable solution or should we just add a NLS dependency to ncmpc?

This is probably not related to NLS, but to gettext being included in the build by some other package. This tricks Meson into believing that NLS is enabled.

Also, the code in meson.txt may lead to unexpected results:

Quoted 16 lines

if meson.version().version_compare('>= 0.59') and not mini
# Meson 0.59 has native libintl support intl_dep = dependency('intl', required: enable_nls) enable_nls = intl_dep.found()
elif enable_nls.disabled() or mini
intl_dep = dependency('', required: false) enable_nls = false
elif cc.has_header('libintl.h')
intl_dep = dependency('', required: false) enable_nls = true
elif enable_nls.auto()
intl_dep = dependency('', required: false) enable_nls = false
else
error('libintl.h not found')

<cut>

meson.txt works like nls=auto within Buildroot, thus reflecting the setting of BR2_SYSTEM_ENABLE_NLS, so no worries.

The toolchain seems to have been built with NLS support; the C++ library makes use of this:

[3/73] Compiling C++ object src/event/libevent.a.p/TimerList.cxx.o
FAILED: src/event/libevent.a.p/TimerList.cxx.o /home/data/test/autobuild/host/bin/or1k-linux-g++

(quoted diff) +0 -10
-Isrc/event/libevent.a.p -Isrc/event -I../src/event -Isrc -I../src -I.
-I.. -fdiagnostics-color=always -Wall -Winvalid-pch -Wextra -Wpedantic
-std=c++2a -O3 -Wcast-qual -Wcast-align -Wdouble-promotion
-Wmissing-declarations -Wmissing-format-attribute -Wmissing-noreturn
-Wredundant-decls -Wshadow -Wundef -Wvla -Wwrite-strings
-fno-threadsafe-statics -fmerge-all-constants -Wno-non-virtual-dtor
-Wno-format-truncation -D_GNU_SOURCE -fvisibility=hidden
-ffunction-sections -fdata-sections -D_LARGEFILE_SOURCE
-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -O3 -g0 -D_FORTIFY_SOURCE=2
-fPIC -MD -MQ src/event/libevent.a.p/TimerList.cxx.o -MF

src/event/libevent.a.p/TimerList.cxx.o.d -o
src/event/libevent.a.p/TimerList.cxx.o -c ../src/event/TimerList.cxx
In file included from /home/data/test/autobuild/host/opt/ext-toolchain/or1k-buildroot-linux-gnu/include/c++/13.2.0/or1k-buildroot-linux-gnu/bits/messages_members.h:36,
from
/home/data/test/autobuild/host/opt/ext-toolchain/or1k-buildroot-linux-gnu/include/c++/13.2.0/bits/locale_facets_nonio.h:2064,
from
/home/data/test/autobuild/host/opt/ext-toolchain/or1k-buildroot-linux-gnu/include/c++/13.2.0/locale:43,
from
/home/data/test/autobuild/host/opt/ext-toolchain/or1k-buildroot-linux-gnu/include/c++/13.2.0/iomanip:45,
from
/home/data/test/autobuild/host/opt/ext-toolchain/or1k-buildroot-linux-gnu/include/c++/13.2.0/bits/chrono_io.h:38,
from
/home/data/test/autobuild/host/opt/ext-toolchain/or1k-buildroot-linux-gnu/include/c++/13.2.0/chrono:3330,

                  from ../src/event/Chrono.hxx:6,
                  from ../src/event/TimerList.hxx:7,
                  from ../src/event/TimerList.cxx:5:

/home/data/test/autobuild/host/or1k-buildroot-linux-gnu/sysroot/usr/include/libintl.h:23:2:
error: #error "libintl.h included here"
23 | #error "libintl.h included here"
| ^~~~~

Quoted 4 lines

Probably the least invasive solution would be to add a new ncmpc dependency:

+ depends on !BR2_TOOLCHAIN_HAS_FULL_GETTEXT || BR2_SYSTEM_ENABLE_NLS

The following PR should fix the issue:
https://github.com/MusicPlayerDaemon/ncmpc/pull/142
Waiting for upstream feedback.

Quoted 3 lines

Kind regards,
Andreas

Best Regards,

Fabrice
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot