You are not logged in.

#1 2020-05-16 03:21:26

danielcohenhillel
Member
Registered: 2019-12-05
Posts: 3

[SOLVED] Linker related issued when making c packages

Some packages that I try to install from the AUR simply don't install and they throw an error. They don't throw the same error but it usually something related to the linker. As an example, I tried to install the mmg3d package, and after getting a bunch of "multiple definition" messages of the form

/usr/bin/ld: CMakeFiles/libmmg_so.dir/src/mmgs/variadic_s.c.o:(.bss+0x68): multiple definition of `MMG5_lenSurfEdg'; CMakeFiles/libmmg_so.dir/src/common/mmgexterns.c.o:(.bss+0x30): first defined here

I get the error message:

collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/libmmg_so.dir/build.make:1962: lib/libmmg.so.5.4.3] Error 1
make[2]: Leaving directory '/home/dnl/.cache/yay/mmg3d/src/mmg-5.4.3'
make[1]: *** [CMakeFiles/Makefile2:434: CMakeFiles/libmmg_so.dir/all] Error 2
make[1]: Leaving directory '/home/dnl/.cache/yay/mmg3d/src/mmg-5.4.3'
make: *** [Makefile:152: all] Error 2

To check that the problem is not with `yay` or something, it tried installing the package from the website with `makepkg`, and I also tried installing it directly from source. When I tried building from source the `cmake` command did work but the `make` command failed with the same error.

I tried upgrading my entire system, reinstalling make\cmake\binutils and other build utilities. I also tried using older versions of these packages but still nothing worked and I get the same message. I also have a laptop (that runs Manjaro) and when I tried installing these packages it worked just fine so I know it's a problem with my system and not with the packages or something. I'm running the latest kernel of Linux (5.6.13-arch1-1) if that matters. Also some other packages that I remember failing to install are `cmake` and `paraview` and maybe more that I don't remember.

If anyone can help me troubleshoot that would be great smile

Last edited by danielcohenhillel (2020-05-16 17:18:55)

Offline

#2 2020-05-16 04:01:25

pancho
Member
From: Madrid, Spain
Registered: 2018-08-14
Posts: 5
Website

Re: [SOLVED] Linker related issued when making c packages

Not sure what's happening, but it's happening to me as well.  Tried to build pam_ssh and rasdaemon, and I get the same type of code error messages.
Smells like a gcc regression, right?


Arch + sway + fish + doom emacs

Offline

#3 2020-05-16 04:12:32

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,330
Website

Re: [SOLVED] Linker related issued when making c packages

The problem is as described in this inaccurately titled thread.

For now a workaround would be to add -fcommon to CFLAGS, but also report the issue upstream.

Last edited by Trilby (2020-05-16 04:16:57)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#4 2020-05-16 04:15:59

pancho
Member
From: Madrid, Spain
Registered: 2018-08-14
Posts: 5
Website

Re: [SOLVED] Linker related issued when making c packages

Trilby wrote:

The problem is as described in this inaccurately titled thread.

Thanks!


Arch + sway + fish + doom emacs

Offline

#5 2020-05-16 05:02:07

danielcohenhillel
Member
Registered: 2019-12-05
Posts: 3

Re: [SOLVED] Linker related issued when making c packages

Trilby wrote:

The problem is as described in this inaccurately titled thread.

For now a workaround would be to add -fcommon to CFLAGS, but also report the issue upstream.

Thanks! It worked smile although I still can't build it from source :\  Where should I report this to?

Offline

#6 2020-05-16 08:24:03

loqs
Member
Registered: 2014-03-06
Posts: 18,045

Re: [SOLVED] Linker related issued when making c packages

danielcohenhillel wrote:
Trilby wrote:

The problem is as described in this inaccurately titled thread.

For now a workaround would be to add -fcommon to CFLAGS, but also report the issue upstream.

Thanks! It worked smile although I still can't build it from source :\  Where should I report this to?

mmg3d 5.4.3-2 built successfully with the following change:

diff --git a/PKGBUILD b/PKGBUILD
index bf898ef..89f8991 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -14,6 +14,8 @@ sha256sums=('73fb63616d87094a1fbd0a721ded7e062c7768844e450df4fa34e50dd9924c41')
 build () {
   cd "mmg-$pkgver"
 
+  CFLAGS="$CFLAGS -fcommon"
+
   cmake \
     -DCMAKE_INSTALL_PREFIX="$pkgdir"/usr \
     -DLIBMMG2D_SHARED=ON \

Edit:
Should be fixed with https://github.com/MmgTools/mmg/pull/61

Last edited by loqs (2020-05-16 08:31:43)

Offline

#7 2020-05-16 12:17:31

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,330
Website

Re: [SOLVED] Linker related issued when making c packages

danielcohenhillel wrote:

Thanks! It worked smile although I still can't build it from source

What does this mean?  You say it worked, and then say it didn't work?  If it worked, and if this was the only problem, then you could build the source.  If there is a new problem, you'll have to show the new error messages.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#8 2020-05-16 17:18:29

danielcohenhillel
Member
Registered: 2019-12-05
Posts: 3

Re: [SOLVED] Linker related issued when making c packages

loqs wrote:
danielcohenhillel wrote:
Trilby wrote:

The problem is as described in this inaccurately titled thread.

For now a workaround would be to add -fcommon to CFLAGS, but also report the issue upstream.

Thanks! It worked smile although I still can't build it from source :\  Where should I report this to?

mmg3d 5.4.3-2 built successfully with the following change:

diff --git a/PKGBUILD b/PKGBUILD
index bf898ef..89f8991 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -14,6 +14,8 @@ sha256sums=('73fb63616d87094a1fbd0a721ded7e062c7768844e450df4fa34e50dd9924c41')
 build () {
   cd "mmg-$pkgver"
 
+  CFLAGS="$CFLAGS -fcommon"
+
   cmake \
     -DCMAKE_INSTALL_PREFIX="$pkgdir"/usr \
     -DLIBMMG2D_SHARED=ON \

Edit:
Should be fixed with https://github.com/MmgTools/mmg/pull/61

Thanks! I'll mark it as solved smile

Trilby wrote:
danielcohenhillel wrote:

Thanks! It worked smile although I still can't build it from source

What does this mean?  You say it worked, and then say it didn't work?  If it worked, and if this was the only problem, then you could build the source.  If there is a new problem, you'll have to show the new error messages.

I changed the CFLAGS in my .makepkg.conf and added `-fcommon` and then it did install when I used yay to install, so basically my problem is solved. I still wondered about building it directly from source (i.e. clone it from github and build with make) and when I tried it it gave the same error. Is it possible to change the CFLAGS when when you build with make and not with makepkg? (if that is even a thing, I don't really understand what are the CFLAGS so I might talk complete nonsense... )

Offline

#9 2020-05-16 17:33:36

loqs
Member
Registered: 2014-03-06
Posts: 18,045

Re: [SOLVED] Linker related issued when making c packages

What had you set CFLAGS to when you called cmake/make?

Offline

#10 2020-05-16 17:50:03

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,330
Website

Re: [SOLVED] Linker related issued when making c packages

CFLAGS are used in Makefiles, they are not specific to makepkg.  Makepkg.conf does allow you to set CFLAGS and related variables, but all it does is export them into the neviornment when it calls the build() function so they are picked up by any build process that uses them.

Point of fact, make itself doesn't even use those variables, but a well written Makefile will (as will Makefiles generated by autotools).

When you built manually, you'd need to either set the variables explicitly, or source makepkg.conf.

Last edited by Trilby (2020-05-16 17:50:37)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

Board footer

Powered by FluxBB