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

Linker error: mpd_client.c.o:(.bss+0x0): multiple definition of `mpd'; CMakeFiles/ympd.dir/src/ympd.c.o:(.bss+0x0): first defined here #190

Closed
fts-tmassey opened this issue May 9, 2020 · 6 comments · May be fixed by #191

Comments

@fts-tmassey
Copy link

fts-tmassey commented May 9, 2020

Hello!

I'm trying to use ympd on Fedora 32 on armhf (Raspberry Pi 3B+). The precompiled ympd does not support multiple mpd outputs (AFAICT). I've previously used a custom-compiled ympd that does, but it was compiled for aarch64. Raspberry Pi 3 code is almost always armhf, so I'm trying to stick with that. A glance at the current notandy/ympd head shows that the multiple output code is there, so it should simply be a case of the binary being out of date.

No problem: I'll compile it myself. Here's what I've done on a new Fedora 32 minimal install (with RPMFusion repo added):

dnf groupinstall 'Development Tools'
dnf install unzip cmake libmpdclient-devel openssl-devel
wget https://github.com/notandy/ympd/archive/master.zip
unzip master.zip
cd ympd-master
mkdir build; cd build
mkdir install
cmake .. -DCMAKE_INSTALL_PREFIX:PATH=./install
make

And here's the error that I get (after all compiles complete successfully):

[100%] Linking C executable ympd
/usr/bin/ld: CMakeFiles/ympd.dir/src/mpd_client.c.o:(.bss+0x0): multiple definition of `mpd'; CMakeFiles/ympd.dir/src/ympd.c.o:(.bss+0x0): first defined here
/usr/bin/ld: CMakeFiles/ympd.dir/src/mpd_client.c.o:(.bss+0x1909c): multiple definition of `dirble_api_token'; CMakeFiles/ympd.dir/src/ympd.c.o:(.bss+0x1909c): first defined here
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/ympd.dir/build.make:206: ympd] Error 1
make[1]: *** [CMakeFiles/Makefile2:98: CMakeFiles/ympd.dir/all] Error 2
make: *** [Makefile:150: all] Error 2
[root@mimhq-music build]#

In case there was a problem with the libmpdclient-devel package installed by Fedora/RPMFusion, I also tried compiling that from source as well:

dnf remove libmpdclient-devel
dnf install meson ninja-build
wget https://www.musicpd.org/download/libmpdclient/2/libmpdclient-2.18.tar.xz
tar -xvf libmpdclient-2.18.tar.xz
cd libmpdclient-2.18
meson . output
ninja -C output
ninja -C output install

No errors here, and lots of files were copied to /usr/local/include/mpd as expected.

Previous experience tells me that this error is probably a problem with conflicting / duplicate header includes. A glance showed me that the likely headers have include guards in place. I'm not familiar with ympd or libmpdclient code, so before I spend a lot of time ripping the headers apart, I would ask: Am I missing something?

Please let me know how I can help. Thank you very much for any information you can provide. My test environment will stay ready for whatever you need me to do! :)

@sheeit
Copy link

sheeit commented May 30, 2020

Same error on Arch Linux.

@jslick
Copy link

jslick commented May 31, 2020

I believe this project has been abandoned, but it has a maintained fork at https://github.com/jcorporation/myMPD . There is another fork at https://github.com/SuperBFG7/ympd , but I don't know if it would have the same error.

@fts-tmassey
Copy link
Author

fts-tmassey commented May 31, 2020

I believe this project has been abandoned, but it has a maintained fork at https://github.com/jcorporation/myMPD . There is another fork at https://github.com/SuperBFG7/ympd , but I don't know if it would have the same error.

Thank you for the suggestion. MyMPD might have re-used some of the code, but it is not yampd. He added a ton of new features admittedly, but IMHO destroyed the interface. If I wanted to use iTunes, I'd use iTunes... :) ympd excels at having everything I want on a single screen, not multiple tabs to constantly switch between. Controls, volume, output, music list: one screen.

Same error on Arch Linux.

Thanks for the confirmation. Nice to know I'm not alone... :)

I'm thinking about setting up something like a Fedora 28 system to see if I can compile it there -- though RPi support in 28 is sketchy... (But I don't want to move on! :) )

@SuperBFG7 SuperBFG7 mentioned this issue Jun 2, 2020
@SuperBFG7
Copy link
Contributor

SuperBFG7 commented Jun 2, 2020

Hi, it's a code issue, not sure why it pops up only now. Probably some change in how the linker works in newer versions. I've fixed it in my fork and created a pull request here as well.

@your-diary
Copy link

your-diary commented Aug 22, 2020

@SuperBFG7
This fix worked like a charm. Thank you.

@fts-tmassey
Copy link
Author

fts-tmassey commented Aug 27, 2020

Thank you very much! I too can confirm that this fixes my compile issue. For completeness, here are the GCC / LD versions -- should have included those before.

gcc version 10.1.1 20200507 (Red Hat 10.1.1-1) (GCC)
GNU ld version 2.34-3.fc32

Running on Fedora 32 on armv7l on Raspberry PI 3B+

Unfortunately, after compiling, I found that even the from-source version still has no multiple output controls. So, I went ahead and downloaded @SuperBFG7 's fork: not only did it compile perfectly out of the box, it also had multiple output controls! So do yourself a favor and use his fork.

Of course, in the interim, I've gotten used to the MyMPD interface. I still have uses for the compactness of ympd, but I've also grown to appreciate the extra features of MyMPD. The beauty of MPD, of course, is that you can have multiple client interfaces! So now I've got the best of both worlds! :)

Again, thank you for the patch, and for updating your tree. I'm back in business.

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

Successfully merging a pull request may close this issue.

5 participants