-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Firstly a belated thank you for the fix of the library link order ( https://github.com/bucciarati/mpc123/issues1) back in 2018, and also I note the application of the Debian patches (mpc123_0.2.4-7.debian).
If I use the somewhat old gcc-7 to compile the latest mpc123 r.36e45cf then it build successful but if I use the more recent gcc-13, the linking stage fails with the errors
Building mpc123 version 0.2 ...
/usr/bin/gcc-13 -Wall -O2 -o mpc123 ao.o player.o playlist.o reader.o reader_file.o shuffle.o signals.o mpc123.c -lao -lmpcdec
/usr/lib64/gcc/x86_64-suse-linux/13/../../../../x86_64-suse-linux/bin/ld: player.o:(.bss+0x0): multiple definition of `options'; ao.o:(.bss+0x0): first defined here
/usr/lib64/gcc/x86_64-suse-linux/13/../../../../x86_64-suse-linux/bin/ld: player.o:(.bss+0x40): multiple definition of `mpc123_file_reader'; ao.o:(.bss+0x40): first defined here
/usr/lib64/gcc/x86_64-suse-linux/13/../../../../x86_64-suse-linux/bin/ld: playlist.o:(.bss+0x0): multiple definition of `options'; ao.o:(.bss+0x0): first defined here
/usr/lib64/gcc/x86_64-suse-linux/13/../../../../x86_64-suse-linux/bin/ld: playlist.o:(.bss+0x40): multiple definition of `mpc123_file_reader'; ao.o:(.bss+0x40): first defined here
/usr/lib64/gcc/x86_64-suse-linux/13/../../../../x86_64-suse-linux/bin/ld: reader.o:(.bss+0x40): multiple definition of `mpc123_file_reader'; ao.o:(.bss+0x40): first defined here
/usr/lib64/gcc/x86_64-suse-linux/13/../../../../x86_64-suse-linux/bin/ld: reader.o:(.bss+0x0): multiple definition of `options'; ao.o:(.bss+0x0): first defined here
/usr/lib64/gcc/x86_64-suse-linux/13/../../../../x86_64-suse-linux/bin/ld: reader_file.o:(.bss+0x0): multiple definition of `options'; ao.o:(.bss+0x0): first defined here
/usr/lib64/gcc/x86_64-suse-linux/13/../../../../x86_64-suse-linux/bin/ld: reader_file.o:(.data.rel.local+0x0): multiple definition of `mpc123_file_reader'; ao.o:(.bss+0x40): first defined here
/usr/lib64/gcc/x86_64-suse-linux/13/../../../../x86_64-suse-linux/bin/ld: shuffle.o:(.bss+0x0): multiple definition of `options'; ao.o:(.bss+0x0): first defined here
/usr/lib64/gcc/x86_64-suse-linux/13/../../../../x86_64-suse-linux/bin/ld: shuffle.o:(.bss+0x40): multiple definition of `mpc123_file_reader'; ao.o:(.bss+0x40): first defined here
/usr/lib64/gcc/x86_64-suse-linux/13/../../../../x86_64-suse-linux/bin/ld: signals.o:(.bss+0x140): multiple definition of `options'; ao.o:(.bss+0x0): first defined here
/usr/lib64/gcc/x86_64-suse-linux/13/../../../../x86_64-suse-linux/bin/ld: signals.o:(.bss+0x180): multiple definition of `mpc123_file_reader'; ao.o:(.bss+0x40): first defined here
/usr/lib64/gcc/x86_64-suse-linux/13/../../../../x86_64-suse-linux/bin/ld: /var/tmp/root/cc8AtvAz.o:(.data+0x1a0): multiple definition of `options'; ao.o:(.bss+0x0): first defined here
/usr/lib64/gcc/x86_64-suse-linux/13/../../../../x86_64-suse-linux/bin/ld: /var/tmp/root/cc8AtvAz.o:(.bss+0x0): multiple definition of `mpc123_file_reader'; ao.o:(.bss+0x40): first defined here
collect2: error: ld returned 1 exit status
make: *** [Makefile:48: mpc123] Error 1
A good explanation of the problem can be found at
The items "options" and "mpc123_file_reader" are declared in the header file mpc123.h. The header file is included in more than one of the source files, in fact all eight of them. As these items are declared without values, they are thus tentatively defined eight times which is now flagged as an error by the newer, stricter versions of gcc.
So the simple fix is to declare the items as "extern" in the header file and the problem is resolved.
--- mpc123.h.ORIG 2019-06-05 13:40:30.000000000 +0200
+++ mpc123.h 2019-06-05 13:40:30.000000000 +0200
@@ -143,9 +143,9 @@
} reader_data;
/* global data */
-mpc_reader mpc123_file_reader;
+extern mpc_reader mpc123_file_reader;
-opts_t options;
+extern opts_t options;
/* function declaration */
/* reader.c */
Also a minor point, would you consider changing line 13 of the manual page mpc123.1 from
to the process, thus usually pressing ^C will act as a "next-button" for the
with the addition of a backslash before the hyphen to
to the process, thus usually pressing ^C will act as a "next\-button" for the
as this prevents a line break on the hyphen as per the Debian patch fix for the manual page.