You are not logged in.

#1 2016-06-25 14:02:11

arbacle
Member
Registered: 2015-11-16
Posts: 22

makepkg or PKGBUILD issues when compiling package

Hello!

I was trying to install the kdevelop-git package, present in AUR, but I got a compile error at some point. I searched in Google, but the only stuff I can find about this is about an older version, working with KDE4 and not with the new Plasma5.

[ 96%] Linking CXX shared module kdevgdb.so
../common/libkdevdebuggercommon.a(midebuggerplugin.cpp.o): In function `KDevMI::MIDebuggerPlugin::contextMenuExtension(KDevelop::Context*)':
midebuggerplugin.cpp:(.text+0x2cd3): undefined reference to `typeinfo for KDevelop::EditorContext'
midebuggerplugin.cpp:(.text+0x2cfb): undefined reference to `KDevelop::EditorContext::currentWord() const'
collect2: error: ld returned 1 exit status
make[2]: *** [debuggers/gdb/CMakeFiles/kdevgdb.dir/build.make:586: debuggers/gdb/kdevgdb.so] Error 1
make[1]: *** [CMakeFiles/Makefile2:5486: debuggers/gdb/CMakeFiles/kdevgdb.dir/all] Error 2
make: *** [Makefile:128: all] Error 2
==> ERROR: A failure occurred in build().
    Aborting...
==> ERROR: Makepkg was unable to build kdevelop-git.

But that's not the reason for the post. On a whim I decided to just do the Archy thing and do it myself. I cloned the git source and because the instructions on the website about building seemed a bit off, I just copied the same cmake line from the PKGBUILD in the AUR. So basically I just copied the build():

- make build directory
- run cmake (with the specified parameters, just changing the path) in the build dir
- run make in the build dir

And the thing compiles without any errors o_O'

It's the same git url from the PKGBUILD, so it shouldn't be the source (I diffed the two source directories - they are the same). It's the same build() so it shouldn't be the way it's built. I'm just baffled.

But okay, accepting this I made a PKGBUILD from scratch, because if it builds, then I can do it the proper way, right? Well, no - I get the same error as the one in the AUR. Here's my "spartan" PKGBUILD:

pkgname=kdevelop-git
pkgver=4.90.92
pkgrel=1

provides=('kdevelop')
source=('git://anongit.kde.org/kdevelop.git')
arch=('i686' 'x86_64')

md5sums=('SKIP')

prepare() {
  mkdir -p build
}

build() {
  cd build
  cmake ../kdevelop -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr -DLIB_INSTALL_DIR=lib -DKDE_INSTALL_USE_QT_SYS_PATHS=ON -DBUILD_TESTING=OFF
  make
}

package() {
  make -C build DESTDIR="${pkgdir}" install
}

So what could be wrong? Is there something that will make makepkg break things?

Offline

#2 2016-06-25 14:40:10

runical
Member
From: The Netherlands
Registered: 2012-03-03
Posts: 896

Re: makepkg or PKGBUILD issues when compiling package

Just a quick check, as I have no other ideas atm: did you install the base-devel group?

Offline

#3 2016-06-25 15:51:45

arbacle
Member
Registered: 2015-11-16
Posts: 22

Re: makepkg or PKGBUILD issues when compiling package

Yep, it's installed hmm

Edit:

So in the end this is what I did:

* clone the repo
* make manually
* edit the PKGBUILD from the AUR to bypass the build function
* run makepkg with the new PKGBUILD
* install the package with pacman -U

I'm a bit surprised, but it seems to work big_smile I even installed a package, which depends on it, so yay!

Still this issue is strange and if somebody wants to investigate and needs more info, just tell me what should I do.

Last edited by arbacle (2016-06-25 17:03:41)

Offline

#4 2016-06-25 18:38:48

loqs
Member
Registered: 2014-03-06
Posts: 17,325

Re: makepkg or PKGBUILD issues when compiling package

Happy to read you have a working solution.
The following might help your investigation into why the build is failing.
Try adding the following to the PKGBUILD

options=('!buildflags' '!makeflags')

The reason I suggest this is when building manually you will probably not have any of the environment variables buildflags and makeflags set.
For further investigating although it would probably need someone else to look at the results using-cmake-with-gnu-make-how-can-i-see-the-exact-commands suggests changing the make command to

make VERBOSE=1

Showing the full commands being executed might reveal differences which result in the failure.

Offline

#5 2016-06-26 03:04:55

Gero
Member
Registered: 2016-06-26
Posts: 2

Re: makepkg or PKGBUILD issues when compiling package

Hi, I ran into this exact same issue.

Just executing make in the build directory of the failed build does not work.
I need to remove the contents of the build directory, then rerun:

cmake ../kdevelop -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr -DLIB_INSTALL_DIR=lib -DKDE_INSTALL_USE_QT_SYS_PATHS=ON -DBUILD_TESTING=OFF

And after that, make will succeed.
So it seems the result of the cmake configuration differs when executed from within the PKGBUILD.

By comparing the two resulting build directories after doing a make clean I've verified that at least the passed CXX_FLAGS differ, see https://gist.github.com/gfokkema/dcedd6 … 3afe00de37.
There's a whole lot more that differs, so I'm not quite sure what to look for.

Offline

#6 2016-06-26 10:29:40

arbacle
Member
Registered: 2015-11-16
Posts: 22

Re: makepkg or PKGBUILD issues when compiling package

I've found the cause of this after some experimental compiling smile

My method:

* comment one of the buildflags in /etc/makepkg.conf
* try to compile
* delete the package (if any generated), delete pkg/, delete src/build/
* repeat

The cause was in the LDFLAGS - when I commented them, things worked with all other options enabled.

Testing further I've managed to compile with edited LDFLAGS from:

LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro"

to

LDFLAGS="-O1,--sort-common,--as-needed,-z,relro"

The man page for ld has this to say about -Wl:

Note---if the linker is being invoked indirectly, via a compiler driver (e.g. gcc) then all the linker command line options should be prefixed by -Wl, (or whatever is appropriate for the particular compiler driver) like this:

gcc -Wl,--start-group foo.o bar.o -Wl,--end-group
This is important, because otherwise the compiler driver program may silently drop the linker options, resulting in a bad link.

I've learned _a lot_ about makepkg and the building process in Arch, which was pretty fun smile

Going from here - should I file a bug report in mainstream? Should I notify the maintainer of the package in AUR?

loqs wrote:

Try adding the following to the PKGBUILD
options=('!buildflags' '!makeflags')

Totally forgot about /etc/makepkg.conf! Thank you for nudging me in the right direction. Your idea of course worked because it was disabling the LDFLAGS that were messing with things.

Gero wrote:

Just executing make in the build directory of the failed build does not work.
I need to remove the contents of the build directory

Yes, you need to start with a fresh build dir, because the previous attempt has left broken stuff inside.

Offline

Board footer

Powered by FluxBB