You are not logged in.

#1 2012-02-08 07:11:20

quantumphaze
Member
From: Melbourne, Australia
Registered: 2008-11-14
Posts: 169

New binutils 2.22 causing havoc on many AUR packages

Many posts around here showing that this is a common problem. ld has changed behaviour and has broken some packages that don't explicitly link to libraries.

My example: Minutor

gcc -Wl,--as-needed -o minutor minutor.o mapviewer.o colorschemes.o `pkg-config --libs gtk+-2.0` MinutorMap/MinutorMap.a
/usr/bin/ld: MinutorMap/MinutorMap.a(nbt.o): undefined reference to symbol 'gzopen'
/usr/bin/ld: note: 'gzopen' is defined in DSO /usr/lib/libz.so.1 so try adding it to the linker command line
/usr/lib/libz.so.1: could not read symbols: Invalid operation
collect2: ld returned 1 exit status
make: *** [minutor] Error 1

Related info I found on the Fedora Wiki

All posts so far suggest adding things to LDFLAGS but none of them have worked for me yet. Found on thread "EMC2 Simulator (CNC) PKGBUILD":

falconindy wrote:

--as-needed isn't the problem here, it's transitive linking. See the first item in the ld changelog for binutils 2.22. There's two options:

- add "-Wl,--copy-dt-needed-entries" to LDFLAGS
- add "-lXt" to LDFLAGS

Either way, this should be fixed upstream. You should explicitly link against any library you depend on.

This didn't work for me whether I put it in the PKGBUILD or /etc/makepkg.conf

Any ideas?

EDIT: It appears that the LDFLAGS are not being added to the gcc line shown above no matter where I put the additional LDFLAGS. Perhaps I'm doing it wrong.

Last edited by quantumphaze (2012-02-08 07:32:11)


▁▂▃▄▅▆▇█▉▊▋▌▍▎▏▏▎▍▌▋▊▉█▇▆▅▄▃▂▁

Offline

#2 2012-02-08 08:23:33

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 6,815

Re: New binutils 2.22 causing havoc on many AUR packages

quantumphaze wrote:

EDIT: It appears that the LDFLAGS are not being added to the gcc line shown above no matter where I put the additional LDFLAGS. Perhaps I'm doing it wrong.

Kinda hard to figure that out without you showing what you're doing. And whatever it is, you should always nag upstream to fix their assumptions on compilation and ld.

P.S. - OT - I've got 99 AUR packages installed and this problem doesn't show up on any of them, so I'm not sure what 'common' means in your case smile


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

#3 2012-02-08 09:57:36

Gusar
Member
Registered: 2009-08-25
Posts: 3,428

Re: New binutils 2.22 causing havoc on many AUR packages

ngoonee wrote:

P.S. - OT - I've got 99 AUR packages installed and this problem doesn't show up on any of them, so I'm not sure what 'common' means in your case smile

I maintain one package in AUR and it hit this issue. From this I extrapolate that every AUR package is broken tongue

Anyway, patch for minutor:

--- minutor.orig/Makefile	2011-05-21 08:34:22.000000000 +0200
+++ minutor/Makefile	2012-02-08 11:15:13.682083948 +0100
@@ -16,7 +16,7 @@
 all: $(EXEC)
 
 $(EXEC): $(OBJS) maplib
-	$(CC) -Wl,--as-needed -o $(EXEC) $(OBJS) $(LIBS) MinutorMap/MinutorMap.a
+	$(CC) -Wl,--as-needed -o $(EXEC) $(OBJS) $(LIBS) MinutorMap/MinutorMap.a -lz
 
 install: $(EXEC)
 	install -d $(BIN) $(DESKTOP) $(PIXMAP)

Last edited by Gusar (2012-02-08 10:14:44)

Offline

#4 2012-02-08 10:32:11

quantumphaze
Member
From: Melbourne, Australia
Registered: 2008-11-14
Posts: 169

Re: New binutils 2.22 causing havoc on many AUR packages

I found 3 other threads with similar problems (search for "dso") and just assumed that most people were going to wait and see if it gets fixed in a few days.

What I was trying to do before:
Tried adding to the PHGBUILD both outside and inside the build() function, with and without quotes and -Wl

LDFLAGS="-Wl,--copy-dt-needed-entries"
LDFLAGS="$(LDFLAGS) -Wl,--copy-dt-needed-entries"

and appending ,--copy-dt-needed-entries to the LDFLAGS line in /etc/makepkg.conf

I will go complain to upstream now since the maintainer probably doesn't know.


▁▂▃▄▅▆▇█▉▊▋▌▍▎▏▏▎▍▌▋▊▉█▇▆▅▄▃▂▁

Offline

#5 2012-02-08 11:08:56

Gusar
Member
Registered: 2009-08-25
Posts: 3,428

Re: New binutils 2.22 causing havoc on many AUR packages

Playing with LDFLAGSS won't do anything here, as Minutor uses a simple Makefile for building and this Makefile does not take into account the LFDFLAGS variable. So the right fix here is to just add the linker flags directly into the Makefile.

Offline

Board footer

Powered by FluxBB