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

systemd build broken by #5065 #5113

Closed
jon-turney opened this issue Mar 18, 2019 · 6 comments
Closed

systemd build broken by #5065 #5113

jon-turney opened this issue Mar 18, 2019 · 6 comments
Milestone

Comments

@jon-turney
Copy link
Member

jon-turney commented Mar 18, 2019

See https://travis-ci.org/jon-turney/meson-corpus-test/jobs/508033325#L1596

Bisecting meson lands on commit 07818da

I think this may be related somehow to -lrt being de-duplicated in a linking command line?

@jon-turney
Copy link
Member Author

jon@bionic:~/src$ git clone https://github.com/jon-turney/meson-corpus-test-update
[...]
jon@bionic:~/src$ cd meson-corpus-test-update/
jon@bionic:~/src/meson-corpus-test-update$ ./run systemd
[...]
[584/1778] Linking target libnss_myhostname.so.2.
FAILED: libnss_myhostname.so.2 
cc  -o libnss_myhostname.so.2 'nss_myhostname@sha/src_nss-myhostname_nss-myhostname.c.o' 'nss_myhostname@sha/src_libsystemd_disable-mempool.c.o' -Wl,--no-undefined -Wl,--as-needed -shared -fPIC -Wl,--start-group -Wl,-soname,libnss_myhostname.so.2 -Wl,-z,relro -Wl,-z,now src/libsystemd/libsystemd_static.a src/basic/libbasic.a -Wl,-z,nodelete -shared -Wl,--version-script=/systemd/src/nss-myhostname/nss-myhostname.sym -Wl,--undefined -lrt /usr/lib/i386-linux-gnu/libcap.so /usr/lib/i386-linux-gnu/libselinux.so -lm -Wl,--end-group -pthread '-Wl,-rpath,$ORIGIN/src/libsystemd:$ORIGIN/src/basic' -Wl,-rpath-link,/systemd/_build/src/libsystemd:/systemd/_build/src/basic 
src/libsystemd/libsystemd_static.a(sd-daemon_sd-daemon.c.o): In function `sd_is_mq':
/systemd/_build/../src/libsystemd/sd-daemon/sd-daemon.c:411: undefined reference to `mq_getattr'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
jon@bionic:~/src/meson-corpus-test-update$ ./run systemd --commit 5f00c302
[...]
[1777/1778] Installing files.
[...]

@jon-turney
Copy link
Member Author

This should probably be tagged for 0.50.1, as #5065 was.

@jpakkane
Copy link
Member

jpakkane commented Apr 6, 2019

It may be that this is not a bug in Meson after all. Systemd has this in its build definition files:

                        link_args : ['-Wl,-z,nodelete',
                                     '-shared',
                                     '-Wl,--version-script=' + version_script_arg,
                                     '-Wl,--undefined'],

The last one of these is wrong from what I can tell. Ld's man page says the following:

       -u symbol
       --undefined=symbol
           Force symbol to be entered in the output file as an undefined symbol.  Doing this may, for example, trigger linking of additional modules from standard libraries.  -u may
           be repeated with different option arguments to enter additional undefined symbols.  This option is equivalent to the "EXTERN" linker script command.

           If this option is being used to force additional modules to be pulled into the link, and if it is an error for the symbol to remain undefined, then the option
           --require-defined should be used instead.

This would imply that it always requires an argument, which this does not pass. Thus it will grab the next argument on the command line as its argument. Before it took one of the many -lrt args (presumably) and now it grabs something other random linker argument and things break.

This patch to systemd makes it compile:

diff --git a/meson.build b/meson.build
index 287125f010..79195c9748 100644
--- a/meson.build
+++ b/meson.build
@@ -1606,8 +1606,7 @@ foreach tuple : [['myhostname', 'ENABLE_NSS_MYHOSTNAME'],
                         # Note that we link NSS modules with '-z nodelete' so that mempools never get orphaned
                         link_args : ['-Wl,-z,nodelete',
                                      '-shared',
-                                     '-Wl,--version-script=' + version_script_arg,
-                                     '-Wl,--undefined'],
+                                     '-Wl,--version-script=' + version_script_arg],
                         link_with : [libsystemd_static,
                                      libbasic],
                         dependencies : [threads,

Ping @keszybz

keszybz pushed a commit to keszybz/systemd that referenced this issue Apr 6, 2019
Ld's man page says the following:

  -u symbol
  --undefined=symbol

  Force symbol to be entered in the output file as an undefined symbol. Doing
  this may, for example, trigger linking of additional modules from standard
  libraries. -u may be repeated with different option arguments to enter
  additional undefined symbols. This option is equivalent to the "EXTERN"
  linker script command.

  If this option is being used to force additional modules to be pulled into
  the link, and if it is an error for the symbol to remain undefined, then the
  option --require-defined should be used instead.

This would imply that it always requires an argument, which this does not
pass. Thus it will grab the next argument on the command line as its
argument. Before it took one of the many -lrt args (presumably) and now it
grabs something other random linker argument and things break.

[zj: this line was added in the first version of the meson configuration back
in 5c23128. AFAICT, this was a mistake. No
such flag appeared in Makefile.am at the time.]

mesonbuild/meson#5113
@keszybz
Copy link
Contributor

keszybz commented Apr 6, 2019

systemd/systemd#12232

@jpakkane
Copy link
Member

jpakkane commented Apr 7, 2019

Thanks. Closing this.

@jpakkane jpakkane closed this as completed Apr 7, 2019
@jon-turney
Copy link
Member Author

Thanks

poettering pushed a commit to systemd/systemd that referenced this issue Apr 7, 2019
Ld's man page says the following:

  -u symbol
  --undefined=symbol

  Force symbol to be entered in the output file as an undefined symbol. Doing
  this may, for example, trigger linking of additional modules from standard
  libraries. -u may be repeated with different option arguments to enter
  additional undefined symbols. This option is equivalent to the "EXTERN"
  linker script command.

  If this option is being used to force additional modules to be pulled into
  the link, and if it is an error for the symbol to remain undefined, then the
  option --require-defined should be used instead.

This would imply that it always requires an argument, which this does not
pass. Thus it will grab the next argument on the command line as its
argument. Before it took one of the many -lrt args (presumably) and now it
grabs something other random linker argument and things break.

[zj: this line was added in the first version of the meson configuration back
in 5c23128. AFAICT, this was a mistake. No
such flag appeared in Makefile.am at the time.]

mesonbuild/meson#5113
keszybz pushed a commit to keszybz/systemd-stable that referenced this issue Apr 9, 2019
Ld's man page says the following:

  -u symbol
  --undefined=symbol

  Force symbol to be entered in the output file as an undefined symbol. Doing
  this may, for example, trigger linking of additional modules from standard
  libraries. -u may be repeated with different option arguments to enter
  additional undefined symbols. This option is equivalent to the "EXTERN"
  linker script command.

  If this option is being used to force additional modules to be pulled into
  the link, and if it is an error for the symbol to remain undefined, then the
  option --require-defined should be used instead.

This would imply that it always requires an argument, which this does not
pass. Thus it will grab the next argument on the command line as its
argument. Before it took one of the many -lrt args (presumably) and now it
grabs something other random linker argument and things break.

[zj: this line was added in the first version of the meson configuration back
in 5c23128. AFAICT, this was a mistake. No
such flag appeared in Makefile.am at the time.]

mesonbuild/meson#5113
(cherry picked from commit 700805f)
mrc0mmand pushed a commit to mrc0mmand/systemd-rhel that referenced this issue Apr 18, 2019
Ld's man page says the following:

  -u symbol
  --undefined=symbol

  Force symbol to be entered in the output file as an undefined symbol. Doing
  this may, for example, trigger linking of additional modules from standard
  libraries. -u may be repeated with different option arguments to enter
  additional undefined symbols. This option is equivalent to the "EXTERN"
  linker script command.

  If this option is being used to force additional modules to be pulled into
  the link, and if it is an error for the symbol to remain undefined, then the
  option --require-defined should be used instead.

This would imply that it always requires an argument, which this does not
pass. Thus it will grab the next argument on the command line as its
argument. Before it took one of the many -lrt args (presumably) and now it
grabs something other random linker argument and things break.

[zj: this line was added in the first version of the meson configuration back
in 5c23128. AFAICT, this was a mistake. No
such flag appeared in Makefile.am at the time.]

mesonbuild/meson#5113
(cherry picked from commit 700805f6c546f2adb79059614f3747f7b5474325)
lnykryn pushed a commit to lnykryn/systemd-rhel that referenced this issue Apr 18, 2019
Ld's man page says the following:

  -u symbol
  --undefined=symbol

  Force symbol to be entered in the output file as an undefined symbol. Doing
  this may, for example, trigger linking of additional modules from standard
  libraries. -u may be repeated with different option arguments to enter
  additional undefined symbols. This option is equivalent to the "EXTERN"
  linker script command.

  If this option is being used to force additional modules to be pulled into
  the link, and if it is an error for the symbol to remain undefined, then the
  option --require-defined should be used instead.

This would imply that it always requires an argument, which this does not
pass. Thus it will grab the next argument on the command line as its
argument. Before it took one of the many -lrt args (presumably) and now it
grabs something other random linker argument and things break.

[zj: this line was added in the first version of the meson configuration back
in 5c23128. AFAICT, this was a mistake. No
such flag appeared in Makefile.am at the time.]

mesonbuild/meson#5113
(cherry picked from commit 700805f6c546f2adb79059614f3747f7b5474325)
Yamakuzure pushed a commit to elogind/elogind that referenced this issue Apr 24, 2019
Ld's man page says the following:

  -u symbol
  --undefined=symbol

  Force symbol to be entered in the output file as an undefined symbol. Doing
  this may, for example, trigger linking of additional modules from standard
  libraries. -u may be repeated with different option arguments to enter
  additional undefined symbols. This option is equivalent to the "EXTERN"
  linker script command.

  If this option is being used to force additional modules to be pulled into
  the link, and if it is an error for the symbol to remain undefined, then the
  option --require-defined should be used instead.

This would imply that it always requires an argument, which this does not
pass. Thus it will grab the next argument on the command line as its
argument. Before it took one of the many -lrt args (presumably) and now it
grabs something other random linker argument and things break.

[zj: this line was added in the first version of the meson configuration back
in 5c23128daba7236a6080383b2a5649033cfef85c. AFAICT, this was a mistake. No
such flag appeared in Makefile.am at the time.]

mesonbuild/meson#5113
(cherry picked from commit 700805f6c546f2adb79059614f3747f7b5474325)
edevolder pushed a commit to edevolder/systemd that referenced this issue Jun 26, 2019
Ld's man page says the following:

  -u symbol
  --undefined=symbol

  Force symbol to be entered in the output file as an undefined symbol. Doing
  this may, for example, trigger linking of additional modules from standard
  libraries. -u may be repeated with different option arguments to enter
  additional undefined symbols. This option is equivalent to the "EXTERN"
  linker script command.

  If this option is being used to force additional modules to be pulled into
  the link, and if it is an error for the symbol to remain undefined, then the
  option --require-defined should be used instead.

This would imply that it always requires an argument, which this does not
pass. Thus it will grab the next argument on the command line as its
argument. Before it took one of the many -lrt args (presumably) and now it
grabs something other random linker argument and things break.

[zj: this line was added in the first version of the meson configuration back
in 5c23128. AFAICT, this was a mistake. No
such flag appeared in Makefile.am at the time.]

mesonbuild/meson#5113
keszybz pushed a commit to keszybz/systemd-stable that referenced this issue Jul 20, 2019
Ld's man page says the following:

  -u symbol
  --undefined=symbol

  Force symbol to be entered in the output file as an undefined symbol. Doing
  this may, for example, trigger linking of additional modules from standard
  libraries. -u may be repeated with different option arguments to enter
  additional undefined symbols. This option is equivalent to the "EXTERN"
  linker script command.

  If this option is being used to force additional modules to be pulled into
  the link, and if it is an error for the symbol to remain undefined, then the
  option --require-defined should be used instead.

This would imply that it always requires an argument, which this does not
pass. Thus it will grab the next argument on the command line as its
argument. Before it took one of the many -lrt args (presumably) and now it
grabs something other random linker argument and things break.

[zj: this line was added in the first version of the meson configuration back
in 5c23128. AFAICT, this was a mistake. No
such flag appeared in Makefile.am at the time.]

mesonbuild/meson#5113
(cherry picked from commit 700805f)
dsd pushed a commit to endlessm/systemd that referenced this issue Sep 5, 2019
Ld's man page says the following:

  -u symbol
  --undefined=symbol

  Force symbol to be entered in the output file as an undefined symbol. Doing
  this may, for example, trigger linking of additional modules from standard
  libraries. -u may be repeated with different option arguments to enter
  additional undefined symbols. This option is equivalent to the "EXTERN"
  linker script command.

  If this option is being used to force additional modules to be pulled into
  the link, and if it is an error for the symbol to remain undefined, then the
  option --require-defined should be used instead.

This would imply that it always requires an argument, which this does not
pass. Thus it will grab the next argument on the command line as its
argument. Before it took one of the many -lrt args (presumably) and now it
grabs something other random linker argument and things break.

[zj: this line was added in the first version of the meson configuration back
in 5c23128. AFAICT, this was a mistake. No
such flag appeared in Makefile.am at the time.]

mesonbuild/meson#5113
Yamakuzure pushed a commit to elogind/elogind that referenced this issue Sep 23, 2019
Ld's man page says the following:

  -u symbol
  --undefined=symbol

  Force symbol to be entered in the output file as an undefined symbol. Doing
  this may, for example, trigger linking of additional modules from standard
  libraries. -u may be repeated with different option arguments to enter
  additional undefined symbols. This option is equivalent to the "EXTERN"
  linker script command.

  If this option is being used to force additional modules to be pulled into
  the link, and if it is an error for the symbol to remain undefined, then the
  option --require-defined should be used instead.

This would imply that it always requires an argument, which this does not
pass. Thus it will grab the next argument on the command line as its
argument. Before it took one of the many -lrt args (presumably) and now it
grabs something other random linker argument and things break.

[zj: this line was added in the first version of the meson configuration back
in 5c23128daba7236a6080383b2a5649033cfef85c. AFAICT, this was a mistake. No
such flag appeared in Makefile.am at the time.]

mesonbuild/meson#5113
Yamakuzure pushed a commit to elogind/elogind that referenced this issue Sep 23, 2019
Ld's man page says the following:

  -u symbol
  --undefined=symbol

  Force symbol to be entered in the output file as an undefined symbol. Doing
  this may, for example, trigger linking of additional modules from standard
  libraries. -u may be repeated with different option arguments to enter
  additional undefined symbols. This option is equivalent to the "EXTERN"
  linker script command.

  If this option is being used to force additional modules to be pulled into
  the link, and if it is an error for the symbol to remain undefined, then the
  option --require-defined should be used instead.

This would imply that it always requires an argument, which this does not
pass. Thus it will grab the next argument on the command line as its
argument. Before it took one of the many -lrt args (presumably) and now it
grabs something other random linker argument and things break.

[zj: this line was added in the first version of the meson configuration back
in 5c23128daba7236a6080383b2a5649033cfef85c. AFAICT, this was a mistake. No
such flag appeared in Makefile.am at the time.]

mesonbuild/meson#5113
(cherry picked from commit 700805f6c546f2adb79059614f3747f7b5474325)
bgilbert pushed a commit to coreos/systemd that referenced this issue Feb 6, 2020
Ld's man page says the following:

  -u symbol
  --undefined=symbol

  Force symbol to be entered in the output file as an undefined symbol. Doing
  this may, for example, trigger linking of additional modules from standard
  libraries. -u may be repeated with different option arguments to enter
  additional undefined symbols. This option is equivalent to the "EXTERN"
  linker script command.

  If this option is being used to force additional modules to be pulled into
  the link, and if it is an error for the symbol to remain undefined, then the
  option --require-defined should be used instead.

This would imply that it always requires an argument, which this does not
pass. Thus it will grab the next argument on the command line as its
argument. Before it took one of the many -lrt args (presumably) and now it
grabs something other random linker argument and things break.

[zj: this line was added in the first version of the meson configuration back
in 5c23128. AFAICT, this was a mistake. No
such flag appeared in Makefile.am at the time.]

mesonbuild/meson#5113
jsynacek pushed a commit to jsynacek/rhel-8 that referenced this issue Feb 10, 2020
Ld's man page says the following:

  -u symbol
  --undefined=symbol

  Force symbol to be entered in the output file as an undefined symbol. Doing
  this may, for example, trigger linking of additional modules from standard
  libraries. -u may be repeated with different option arguments to enter
  additional undefined symbols. This option is equivalent to the "EXTERN"
  linker script command.

  If this option is being used to force additional modules to be pulled into
  the link, and if it is an error for the symbol to remain undefined, then the
  option --require-defined should be used instead.

This would imply that it always requires an argument, which this does not
pass. Thus it will grab the next argument on the command line as its
argument. Before it took one of the many -lrt args (presumably) and now it
grabs something other random linker argument and things break.

[zj: this line was added in the first version of the meson configuration back
in 5c23128. AFAICT, this was a mistake. No
such flag appeared in Makefile.am at the time.]

mesonbuild/meson#5113
(cherry picked from commit 700805f)
Related: CVE-2020-1712
mrc0mmand pushed a commit to mrc0mmand/rhel-8 that referenced this issue Feb 10, 2020
Ld's man page says the following:

  -u symbol
  --undefined=symbol

  Force symbol to be entered in the output file as an undefined symbol. Doing
  this may, for example, trigger linking of additional modules from standard
  libraries. -u may be repeated with different option arguments to enter
  additional undefined symbols. This option is equivalent to the "EXTERN"
  linker script command.

  If this option is being used to force additional modules to be pulled into
  the link, and if it is an error for the symbol to remain undefined, then the
  option --require-defined should be used instead.

This would imply that it always requires an argument, which this does not
pass. Thus it will grab the next argument on the command line as its
argument. Before it took one of the many -lrt args (presumably) and now it
grabs something other random linker argument and things break.

[zj: this line was added in the first version of the meson configuration back
in 5c23128. AFAICT, this was a mistake. No
such flag appeared in Makefile.am at the time.]

mesonbuild/meson#5113
(cherry picked from commit 700805f)
(cherry picked from commit 0ed1150)
lnykryn pushed a commit to redhat-plumbers/systemd-rhel8 that referenced this issue Feb 13, 2020
Ld's man page says the following:

  -u symbol
  --undefined=symbol

  Force symbol to be entered in the output file as an undefined symbol. Doing
  this may, for example, trigger linking of additional modules from standard
  libraries. -u may be repeated with different option arguments to enter
  additional undefined symbols. This option is equivalent to the "EXTERN"
  linker script command.

  If this option is being used to force additional modules to be pulled into
  the link, and if it is an error for the symbol to remain undefined, then the
  option --require-defined should be used instead.

This would imply that it always requires an argument, which this does not
pass. Thus it will grab the next argument on the command line as its
argument. Before it took one of the many -lrt args (presumably) and now it
grabs something other random linker argument and things break.

[zj: this line was added in the first version of the meson configuration back
in 5c23128. AFAICT, this was a mistake. No
such flag appeared in Makefile.am at the time.]

mesonbuild/meson#5113
(cherry picked from commit 700805f)
Related: CVE-2020-1712
fbuihuu pushed a commit to openSUSE/systemd that referenced this issue Apr 6, 2021
Ld's man page says the following:

  -u symbol
  --undefined=symbol

  Force symbol to be entered in the output file as an undefined symbol. Doing
  this may, for example, trigger linking of additional modules from standard
  libraries. -u may be repeated with different option arguments to enter
  additional undefined symbols. This option is equivalent to the "EXTERN"
  linker script command.

  If this option is being used to force additional modules to be pulled into
  the link, and if it is an error for the symbol to remain undefined, then the
  option --require-defined should be used instead.

This would imply that it always requires an argument, which this does not
pass. Thus it will grab the next argument on the command line as its
argument. Before it took one of the many -lrt args (presumably) and now it
grabs something other random linker argument and things break.

[zj: this line was added in the first version of the meson configuration back
in 5c23128. AFAICT, this was a mistake. No
such flag appeared in Makefile.am at the time.]

mesonbuild/meson#5113
(cherry picked from commit 700805f)

[fbui: adjust context]
zlind0 pushed a commit to zlind0/systemd-239 that referenced this issue Sep 14, 2024
Ld's man page says the following:

  -u symbol
  --undefined=symbol

  Force symbol to be entered in the output file as an undefined symbol. Doing
  this may, for example, trigger linking of additional modules from standard
  libraries. -u may be repeated with different option arguments to enter
  additional undefined symbols. This option is equivalent to the "EXTERN"
  linker script command.

  If this option is being used to force additional modules to be pulled into
  the link, and if it is an error for the symbol to remain undefined, then the
  option --require-defined should be used instead.

This would imply that it always requires an argument, which this does not
pass. Thus it will grab the next argument on the command line as its
argument. Before it took one of the many -lrt args (presumably) and now it
grabs something other random linker argument and things break.

[zj: this line was added in the first version of the meson configuration back
in 5c23128daba7236a6080383b2a5649033cfef85c. AFAICT, this was a mistake. No
such flag appeared in Makefile.am at the time.]

mesonbuild/meson#5113
(cherry picked from commit 700805f6c546f2adb79059614f3747f7b5474325)
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

4 participants