You are not logged in.

#1 2012-05-28 15:24:13

nevliv
Member
From: Shenzhen,China
Registered: 2010-12-03
Posts: 8

[SOLVED]can't compile from aur

/usr/bin/ld: main.o: undefined reference to symbol 'XPending'
/usr/bin/ld: note: 'XPending' is defined in DSO /usr/lib/libX11.so.6 so try adding it to the linker command line
/usr/lib/libX11.so.6: could not read symbols: Invalid operation
collect2: error: ld returned 1 exit status
make: *** [netwmpager] error 1

Last edited by nevliv (2012-05-30 01:56:33)


Would like to make friends beyond China area!

Offline

#2 2012-05-28 15:30:03

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

Re: [SOLVED]can't compile from aur

The error tells you exactly what is wrong and what should be done to fix it.  Add -lX11 to the linker line.

If you want more help than that we'd need to know what package you were trying to compile.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Online

#3 2012-05-28 17:17:12

bananagranola
Member
From: US
Registered: 2011-08-07
Posts: 88
Website

Re: [SOLVED]can't compile from aur

Assuming you're trying to compile netwmpager, you simply need to add a line "LDFLAGS = -lX11" to the package's Makefile.

Offline

#4 2012-05-28 17:56:50

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

Re: [SOLVED]can't compile from aur

Ah, I guess the package name was hidden in there.  Edit the pkgbuild to add the sed line in build()

build() {
  cd $startdir/src/$pkgname-$pkgver
  ./configure --prefix=/usr
  sed -i 's/\(call cmd,ld,.*\)$/\1 -lX11/' Makefile
  make || return 1
  make DESTDIR=$startdir/pkg install
}

"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Online

#5 2012-05-28 18:00:05

bananagranola
Member
From: US
Registered: 2011-08-07
Posts: 88
Website

Re: [SOLVED]can't compile from aur

My goodness, that's brilliant.

Offline

#6 2012-05-28 18:03:47

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

Re: [SOLVED]can't compile from aur

I'm not sure if that was sarcasm, I'll assume not.  If not, sadly it's not really brilliant, just necessary.  It seems there are a lot of "broken" PKGBUILDs floating around*.  Sed patches are required for many packages.  It's become particularly prevelant for sources that include glib/*.h which has to be replaced with glib.h as of a recent revision to glib.

Note: not really complaining as I'm not volunteering to take over for all the AUR package maintainers.  But AUR users should have a working knowledge of how to "fix" the PKGBUILDs that fail.

Last edited by Trilby (2012-05-28 18:05:30)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Online

#7 2012-05-28 23:16:51

bananagranola
Member
From: US
Registered: 2011-08-07
Posts: 88
Website

Re: [SOLVED]can't compile from aur

Sorry if I sounded sarcastic; I'm serious. I've seen several AUR packages that require changing the Makefile, and that method's going to come in handy in the future. I'm pretty new to the whole Arch thing, and my first thought after reading your post was quite literally, "my goodness, that's brilliant."

Last edited by bananagranola (2012-05-28 23:17:52)

Offline

#8 2012-05-29 02:30:54

nevliv
Member
From: Shenzhen,China
Registered: 2010-12-03
Posts: 8

Re: [SOLVED]can't compile from aur

Thanks, Trilby, you are great, it works and solved my problem.


Would like to make friends beyond China area!

Offline

#9 2012-05-29 03:02:18

nevliv
Member
From: Shenzhen,China
Registered: 2010-12-03
Posts: 8

Re: [SOLVED]can't compile from aur

the same promble when i try to compile extcalc occured.

/usr/bin/ld: CMakeFiles/extcalc.dir/src/graphout.o: undefined reference to symbol 'glEnd'
/usr/bin/ld: note: 'glEnd' is defined in DSO /usr/lib/libGL.so.1 so try adding it to the linker command line
/usr/lib/libGL.so.1: could not read symbols: Invalid operation
collect2: error:ld return1
make[2]: *** [extcalc] error 1

try to add that "sed" line ,replace lX11 with glEnd, but not work, sorry, i am new baby.:-)


Would like to make friends beyond China area!

Offline

#10 2012-05-29 12:36:49

Terminator
Member
From: Belgium
Registered: 2012-05-07
Posts: 265

Re: [SOLVED]can't compile from aur

I guess you should replace -lX11 by -lGL but I'm also new smile.

Offline

#11 2012-05-29 13:01:12

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

Re: [SOLVED]can't compile from aur

Yup, not quite the same problem.  It's an entirely independent problem with a related root cause: old/faulty PKGBUILDS.

Terminator is correct about the general solution, but note the sed line will have to be modified more than that.  The above sed line was specific to the netwmpager Makefile.  The extcalc Makefile will not have the same linker line so the sed context will not match.

For one-of fixes, it's probably easier to manually edit the Makefile.  Once you find an edit that works, it can be made into a sed line [and reported to the package maintainer] so they can add it to the PKGBUILD in the AUR, so other users can benefit from your fix.

Just to stress that last point - please make sure  you are reporting these problems and the fixes on the AUR page of the package.

EDIT: I just looked at extcalc.  It uses cmake.  I'm not remotely familiar with cmake, so the exact solution for this package may be very different.

Last edited by Trilby (2012-05-29 13:02:02)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Online

#12 2012-05-30 01:55:19

nevliv
Member
From: Shenzhen,China
Registered: 2010-12-03
Posts: 8

Re: [SOLVED]can't compile from aur

Ok, i just add a line <export LDFLAGS="-lGL">
it works,ahh, U guys are so kind.


Would like to make friends beyond China area!

Offline

#13 2012-05-30 01:58:07

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

Re: [SOLVED]can't compile from aur

*Slaps forehead*

Now THAT is brilliant ... AND it is the 'right' way to do it.

Last edited by Trilby (2012-05-30 01:58:25)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Online

#14 2012-06-01 13:20:20

Architeckt
Member
Registered: 2012-06-01
Posts: 2

Re: [SOLVED]can't compile from aur

Trying to build extcalc with the changes above, but still getting the error.
Just c/p the suggested lines:
http://pastebin.com/MpB0TLGX
Sorry don't exactly know what I'm doing smile not quite into writing pkgfiles right now

Offline

#15 2012-06-01 15:02:40

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

Re: [SOLVED]can't compile from aur

Architeckt, remove the sed line, that was a solution for a different package.  That will undoubtedly cause an error as it will not match.

Other than that your PKGBUILD looks good - you may also have to move the export LDFLAGS line before the cmake command, I'm not to sure about that part.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Online

#16 2012-06-02 07:39:43

nevliv
Member
From: Shenzhen,China
Registered: 2010-12-03
Posts: 8

Re: [SOLVED]can't compile from aur

cd $srcdir/$pkgname-${pkgver/_/-} || return 1
        #cmake -CMAKE_INSTALL_PREFIX="/usr". || return 1
        patch CMakeLists.txt < $srcdir/CMakeLists.txt.patch || return 1
        export LDFLAGS="-lGL"
        cmake . || return 1
        make || return 1
        make DESTDIR=$pkgdir install || return 1


Would like to make friends beyond China area!

Offline

#17 2012-06-02 11:13:06

Architeckt
Member
Registered: 2012-06-01
Posts: 2

Re: [SOLVED]can't compile from aur

Thanks much, works perfectly.
Added it to the comments in the AUR.

Offline

Board footer

Powered by FluxBB