Skip to contentSkip to conversation

package/ncmpc: don't set NLS

PATCH In review Fabrice Fontaine 2 participants 4 messages Jan 6, 2024 – Feb 6, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/ncmpc: don't set NLS

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)
| ^

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>

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
 
 ifeq ($(BR2_PACKAGE_LIRC_TOOLS),y)
 NCMPC_DEPENDENCIES += lirc-tools
Signature · 6 lines
2.43.0

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

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>

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?

Best regards,
Romain

Quoted 15 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 +0 -0
index bc8a62daea..0965981f23 100644

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

Quoted 9 lines
package/ncmpc/ncmpc.mk +1 -2
@@ -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
 
 ifeq ($(BR2_PACKAGE_LIRC_TOOLS),y)
 NCMPC_DEPENDENCIES += lirc-tools

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

#2 lore raw

Hello Romain,

Quoted 25 lines · Romain Naour

Hello,

Quoted 16 lines · Fabrice Fontaine

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?

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?

Quoted 21 lines

Best regards,
Romain

Quoted 16 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 +0 -0
index bc8a62daea..0965981f23 100644
@@ -20,8 +20,7 @@ NCMPC_CPE_ID_VENDOR = ncmpc_project
 
Quoted 9 lines

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

Quoted 8 lines
package/ncmpc/ncmpc.mk +1 -2
 NCMPC_CONF_OPTS = \
      -Dcurses=ncurses \
-     -Ddocumentation=disabled \
-     $(if $(BR2_SYSTEM_ENABLE_NLS),-Dnls=enabled,-Dnls=disabled)
+     -Ddocumentation=disabled
 
 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

#3 lore raw

Le 06/02/2024 à 18:59, Fabrice Fontaine a écrit :

Quoted 33 lines

Hello Romain,

Quoted 25 lines · Romain Naour

Hello,

Quoted 16 lines · Fabrice Fontaine

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?

The problem here is that libintl.h header is present in the staging directory when a glibc based toolchain is used with or without NLS enabled.

If ncmpc want to define gettext as a macro when NLS is disabled, its build system should at least do some check before defining gettext as a macro since the libintl.h header can be included indirectly.

When libintl.h header provide gettext, it should be undef before adding the gettext macro.

Something like this (untested):

i18n.h:

#ifdef HAVE_INTL
#include <libintl.h>
#endif

#ifdef ENABLE_NLS
...
#else
#undef gettext
#define gettext(x) (x)
...
#endif

Best regards,
Romain

Quoted 28 lines
Quoted 28 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