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

libidn: build errors #806

Open
amuetzel opened this issue Apr 3, 2024 · 0 comments
Open

libidn: build errors #806

amuetzel opened this issue Apr 3, 2024 · 0 comments

Comments

@amuetzel
Copy link
Contributor

amuetzel commented Apr 3, 2024

When building libidn (not libidn2!) on nanbield (MACHINE = "qemux86-64"), I am observing two build errors.

No changes to the recipe happened between my state and master, so I do not expect differences w/ respect to the outcome. But if necessary, I'll reproduce the error on scarthgap.

First Error: -Werror=format-security

The first one is related to the -Werror=format-security build option (see log below). I had a look at the history and noticed that the error was previously fixed by a patch that was removed in
910c70a160cca64935035e925c76645f2203ca2f.

The commit message only mentions that the patch is "unneeded", but reintroducing the patch fixes the error for me - so I am wondering what was the reason for the removal of this patch?

Error Message
[...]
| libtool: compile:  x86_64-poky-linux-gcc -m64 -march=core2 -mtune=core2 -msse3 -mfpmath=sse -fstack-protector-strong -Os -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/build/tmp/work/core2-64-poky-linux/libidn/1.41/recipe-sysroot -DHAVE_CONFIG_H -I. -I../../libidn-1.41/src -I.. -I../../libidn-1.41/lib -I../lib -I../../libidn-1.41/gl -I../gl -DLOCALEDIR=\"/usr/share/locale\" -Os -pipe -g -feliminate-unused-debug-types -fcanon-prefix-map -fmacro-prefix-map=/build/tmp/work/core2-64-poky-linux/libidn/1.41/libidn-1.41=/usr/src/debug/libidn/1.41-r0 -fdebug-prefix-map=/build/tmp/work/core2-64-poky-linux/libidn/1.41/libidn-1.41=/usr/src/debug/libidn/1.41-r0 -fmacro-prefix-map=/build/tmp/work/core2-64-poky-linux/libidn/1.41/build=/usr/src/debug/libidn/1.41-r0 -fdebug-prefix-map=/build/tmp/work/core2-64-poky-linux/libidn/1.41/build=/usr/src/debug/libidn/1.41-r0 -fdebug-prefix-map=/build/tmp/work/core2-64-poky-linux/libidn/1.41/recipe-sysroot= -fmacro-prefix-map=/build/tmp/work/core2-64-poky-linux/libidn/1.41/recipe-sysroot= -fdebug-prefix-map=/build/tmp/work/core2-64-poky-linux/libidn/1.41/recipe-sysroot-native= -ffunction-sections -fdata-sections -c ../../libidn-1.41/src/idn_cmd.c  -fPIC -DPIC -o .libs/libidn_cmd_la-idn_cmd.o
| ../../libidn-1.41/src/idn.c: In function 'usage':
| ../../libidn-1.41/src/idn.c:66:14: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
|    66 |              program_name);
|       |              ^~~~~~~~~~~~
| ../../libidn-1.41/src/idn.c:69:7: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
|    69 |       printf (_("\
|       |       ^~~~~~
| In file included from ../../libidn-1.41/src/idn.c:34:
| ../../libidn-1.41/src/idn.c: In function 'main':
| ../../libidn-1.41/gl/gettext.h:89:25: warning: statement with no effect [-Wunused-value]
|    89 |     ((void) (Domainname), (const char *) (Dirname))
|       |     ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
| ../../libidn-1.41/src/idn.c:137:3: note: in expansion of macro 'bindtextdomain'
|   137 |   bindtextdomain (PACKAGE, LOCALEDIR);
|       |   ^~~~~~~~~~~~~~
| ../../libidn-1.41/gl/gettext.h:86:34: warning: statement with no effect [-Wunused-value]
|    86 | # define textdomain(Domainname) ((const char *) (Domainname))
|       |                                 ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
| ../../libidn-1.41/src/idn.c:138:3: note: in expansion of macro 'textdomain'
|   138 |   textdomain (PACKAGE);
|       |   ^~~~~~~~~~
| ../../libidn-1.41/src/idn.c:173:14: error: format not a string literal and no format arguments [-Werror=format-security]
|   173 |              _("only one of -s, -e, -d, -a, -u or -n can be specified"));
|       |              ^
| ../../libidn-1.41/src/idn.c:182:5: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
|   182 |     fprintf (stderr, _("Charset: %s\n"), stringprep_locale_charset ());
|       |     ^~~~~~~
| ../../libidn-1.41/src/idn.c:186:5: error: format not a string literal and no format arguments [-Werror=format-security]
|   186 |     fprintf (stderr, _("Type each input string on a line by itself, "
|       |     ^~~~~~~
| ../../libidn-1.41/src/idn.c:198:11: error: format not a string literal and no format arguments [-Werror=format-security]
|   198 |           error (EXIT_FAILURE, errno, _("input error"));
|       |           ^~~~~
| ../../libidn-1.41/src/idn.c:210:20: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
|   210 |                    stringprep_locale_charset ());
|       |                    ^~~~~~~~~~~~~~~~~~~~~~~~~
| ../../libidn-1.41/src/idn.c:217:22: error: format not a string literal and no format arguments [-Werror=format-security]
|   217 |                      _("could not convert from UTF-8 to UCS-4"));
|       |                      ^
| ../../libidn-1.41/src/idn.c:235:20: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
|   235 |                    stringprep_strerror (rc));
|       |                    ^~~~~~~~~~~~~~~~~~~
| ../../libidn-1.41/src/idn.c:242:22: error: format not a string literal and no format arguments [-Werror=format-security]
|   242 |                      _("could not convert from UTF-8 to UCS-4"));
|       |                      ^
| ../../libidn-1.41/src/idn.c:258:20: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
|   258 |                    stringprep_locale_charset ());
|       |                    ^~~~~~~~~~~~~~~~~~~~~~~~~
| ../../libidn-1.41/src/idn.c:273:20: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
|   273 |                    stringprep_locale_charset ());
|       |                    ^~~~~~~~~~~~~~~~~~~~~~~~~
| ../../libidn-1.41/src/idn.c:279:20: error: format not a string literal and no format arguments [-Werror=format-security]
|   279 |                    _("could not convert from UTF-8 to UCS-4"));
|       |                    ^
| ../../libidn-1.41/src/idn.c:294:20: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
|   294 |                    punycode_strerror (rc));
|       |                    ^~~~~~~~~~~~~~~~~
| ../../libidn-1.41/src/idn.c:301:20: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
|   301 |                    stringprep_locale_charset ());
|       |                    ^~~~~~~~~~~~~~~~~~~~~~~~~
| ../../libidn-1.41/src/idn.c:322:22: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
|   322 |                      punycode_strerror (rc));
|       |                      ^~~~~~~~~~~~~~~~~
| ../../libidn-1.41/src/idn.c:338:20: error: format not a string literal and no format arguments [-Werror=format-security]
|   338 |                    _("could not convert from UCS-4 to UTF-8"));
|       |                    ^
| ../../libidn-1.41/src/idn.c:344:20: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
|   344 |                    stringprep_locale_charset ());
|       |                    ^~~~~~~~~~~~~~~~~~~~~~~~~
| ../../libidn-1.41/src/idn.c:356:20: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
|   356 |                    stringprep_locale_charset ());
|       |                    ^~~~~~~~~~~~~~~~~~~~~~~~~
| ../../libidn-1.41/src/idn.c:362:20: error: format not a string literal and no format arguments [-Werror=format-security]
|   362 |                    _("could not convert from UCS-4 to UTF-8"));
|       |                    ^
| ../../libidn-1.41/src/idn.c:380:20: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
|   380 |                    idna_strerror (rc));
|       |                    ^~~~~~~~~~~~~
| ../../libidn-1.41/src/idn.c:394:24: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
|   394 |                        idna_strerror (rc));
|       |                        ^~~~~~~~~~~~~
| ../../libidn-1.41/src/idn.c:408:24: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
|   408 |                        (unsigned long) errpos, tld_strerror (rc));
|       |                        ^
| ../../libidn-1.41/src/idn.c:411:24: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
|   411 |                        tld_strerror (rc));
|       |                        ^~~~~~~~~~~~
| ../../libidn-1.41/src/idn.c:433:20: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
|   433 |                    stringprep_locale_charset ());
|       |                    ^~~~~~~~~~~~~~~~~~~~~~~~~
| ../../libidn-1.41/src/idn.c:440:22: error: format not a string literal and no format arguments [-Werror=format-security]
|   440 |                      _("could not convert from UCS-4 to UTF-8"));
|       |                      ^
| ../../libidn-1.41/src/idn.c:460:20: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
|   460 |                    idna_strerror (rc));
|       |                    ^~~~~~~~~~~~~
| ../../libidn-1.41/src/idn.c:481:26: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
|   481 |                          (unsigned long) errpos, tld_strerror (rc));
|       |                          ^
| ../../libidn-1.41/src/idn.c:487:26: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
|   487 |                          tld_strerror (rc));
|       |                          ^~~~~~~~~~~~
| ../../libidn-1.41/src/idn.c:496:20: error: format not a string literal and no format arguments [-Werror=format-security]
|   496 |                    _("could not convert from UTF-8 to UCS-4"));
|       |                    ^
| ../../libidn-1.41/src/idn.c:502:20: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
|   502 |                    stringprep_locale_charset ());
|       |                    ^~~~~~~~~~~~~~~~~~~~~~~~~
| ../../libidn-1.41/src/idn.c:514:20: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
|   514 |                    stringprep_locale_charset ());
|       |                    ^~~~~~~~~~~~~~~~~~~~~~~~~
| ../../libidn-1.41/src/idn.c:525:26: error: format not a string literal and no format arguments [-Werror=format-security]
|   525 |                          _("could not convert from UTF-8 to UCS-4"));
|       |                          ^
| ../../libidn-1.41/src/idn.c:538:13: error: format not a string literal and no format arguments [-Werror=format-security]
|   538 |             error (EXIT_FAILURE, 0, _("could not do NFKC normalization"));
|       |             ^~~~~
| ../../libidn-1.41/src/idn.c:549:26: error: format not a string literal and no format arguments [-Werror=format-security]
|   549 |                          _("could not convert from UTF-8 to UCS-4"));
|       |                          ^
| ../../libidn-1.41/src/idn.c:563:20: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
|   563 |                    stringprep_locale_charset ());
|       |                    ^~~~~~~~~~~~~~~~~~~~~~~~~
[...]

Second Error: Documentation Build

If the first error is fixed by re-introducing the patch, the error (see below) occurs. Basically, the Makefile is executing the built idn binary to get the help text for the documentation (idn --help).

This is done without regards to cross-compilation - if the host and target architecture are the same (as is the case in my build), this leads to an error because the executable won't find the library libidn.so.12, which is located next to it and, thus, not in the search path. I haven't tried it on other ARCHes yet, but fully expect a build error here due to differing architectures.

I see two possible solutions:

  • disabling the documentation build by adding --disable-doc to EXTRA_OECONF and rmdir the now-empty ${D}/${datadir}' in do_install` (my currently used solution)
  • patch the Makefile to write a dummy text instead of calling idn --help, or remove this part from the documentation (relevant references in doc/Makefile.am of the source package: idn-help.texi in l.27 + 48ff.)
Error Message
[...]
| make[2]: Leaving directory '/build/tmp/work/core2-64-poky-linux/libidn/1.41/build/src'
| Making all in doc
| make[2]: Entering directory '/build/tmp/work/core2-64-poky-linux/libidn/1.41/build/doc'
| make  all-recursive
| make[3]: Entering directory '/build/tmp/work/core2-64-poky-linux/libidn/1.41/build/doc'
| Making all in specifications
| make[4]: Entering directory '/build/tmp/work/core2-64-poky-linux/libidn/1.41/build/doc/specifications'
| make[4]: Nothing to be done for 'all'.
| make[4]: Leaving directory '/build/tmp/work/core2-64-poky-linux/libidn/1.41/build/doc/specifications'
| Making all in tld
| make[4]: Entering directory '/build/tmp/work/core2-64-poky-linux/libidn/1.41/build/doc/tld'
| make[4]: Nothing to be done for 'all'.
| make[4]: Leaving directory '/build/tmp/work/core2-64-poky-linux/libidn/1.41/build/doc/tld'
| Making all in java
| make[4]: Entering directory '/build/tmp/work/core2-64-poky-linux/libidn/1.41/build/doc/java'
| make[4]: Nothing to be done for 'all'.
| make[4]: Leaving directory '/build/tmp/work/core2-64-poky-linux/libidn/1.41/build/doc/java'
| Making all in cyclo
| make[4]: Entering directory '/build/tmp/work/core2-64-poky-linux/libidn/1.41/build/doc/cyclo'
| make[4]: Nothing to be done for 'all'.
| make[4]: Leaving directory '/build/tmp/work/core2-64-poky-linux/libidn/1.41/build/doc/cyclo'
| make[4]: Entering directory '/build/tmp/work/core2-64-poky-linux/libidn/1.41/build/doc'
| ../src/idn --help | /build/tmp/hosttools/grep '^  *-' > tmp && \
|       mv tmp idn-help.texi
| ../src/idn: line 117: /build/tmp/work/core2-64-poky-linux/libidn/1.41/build/src/.libs/idn: cannot execute: required file not found
| make[4]: *** [Makefile:2282: idn-help.texi] Error 1
| make[4]: *** Waiting for unfinished jobs....
| make[4]: Leaving directory '/build/tmp/work/core2-64-poky-linux/libidn/1.41/build/doc'
| make[3]: *** [Makefile:1888: all-recursive] Error 1
| make[3]: Leaving directory '/build/tmp/work/core2-64-poky-linux/libidn/1.41/build/doc'
| make[2]: *** [Makefile:1616: all] Error 2
| make[2]: Leaving directory '/build/tmp/work/core2-64-poky-linux/libidn/1.41/build/doc'
| make[1]: *** [Makefile:1597: all-recursive] Error 1
| make[1]: Leaving directory '/build/tmp/work/core2-64-poky-linux/libidn/1.41/build'
| make: *** [Makefile:1523: all] Error 2
| ERROR: oe_runmake failed
| WARNING: exit code 1 from a shell command.
ERROR: Task (/build/../work/layers/external/meta-openembedded/meta-oe/recipes-extended/libidn/libidn_1.41.bb:do_compile) failed with exit code '1'

Fix

For me, re-introducing the patch and disabling the documentation build solves the issues and makes the package build fine. If you think this is a viable fix (and/or the second solution for the doc problem is better), I can prepare a PR.

thomas-roos pushed a commit to thomas-roos/meta-openembedded that referenced this issue May 2, 2024
This release contains bug fixes only.
The following CVEs have been addressed:

CVE-2023-27783
CVE-2023-27784
CVE-2023-27785
CVE-2023-27786
CVE-2023-27787
CVE-2023-27788
CVE-2023-27789

Changelog:
=========
dlt_jnpr_ether_cleanup: check subctx before cleanup by @Marsman1996 in openembedded#781
Bug openembedded#780 assert tcpedit dlt cleanup by @fklassen in openembedded#800
Fix bugs caused by strtok_r by @Marsman1996 in openembedded#783
Bug openembedded#782 openembedded#784 openembedded#785 openembedded#786 openembedded#787 openembedded#788 strtok r isuses by @fklassen in openembedded#801
Update en10mb.c by @david-guti in openembedded#793
PR openembedded#793 ip6 unicast flood by @fklassen in openembedded#802
Bug openembedded#719 fix overflow check for parse_mpls() by @fklassen in openembedded#804
PR openembedded#793 - update tests for corrected IPv6 MAC by @fklassen in openembedded#805
PR openembedded#793 - update tests for vlandel by @fklassen in openembedded#806
Feature openembedded#773 gh actions ci by @fklassen in openembedded#807
Feature openembedded#759: Upgrade autogen/libopts to 5.18.16 by @fklassen in openembedded#760
Bug openembedded#751 don't exit after send error by @fklassen in openembedded#761
Bug openembedded#750: configure: libpcap version robustness by @fklassen in openembedded#764
Bug openembedded#749 flow stats: avoid overstating flow packet count by @fklassen in openembedded#765
Bug openembedded#750 more libpcap version updates by @fklassen in openembedded#766
Bug openembedded#767 tests: support for out-of-tree tests by @fklassen in openembedded#768
Bug openembedded#750 - fix macOS test failure by @fklassen in openembedded#770
4.4.3 by @fklassen in openembedded#769 and openembedded#771

Signed-off-by: Archana Polampalli <archana.polampalli@windriver.com>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
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

No branches or pull requests

1 participant