You are not logged in.

#1 2009-12-07 09:11:03

tocer
Member
Registered: 2008-10-23
Posts: 28

[Solved] compile manually success, but makepkg fail.

I have a PKGBUILD file below. When I makepkg, it failed. But I can compile manually sucess for the code source.

------------------ error message when makepkg ---------------------
dhtlib.o: In function `hashsg_init':
dhtlib.c:(.text+0x11ce): undefined reference to `SHA1_Init'
dhtlib.c:(.text+0x11e4): undefined reference to `SHA1_Update'
dhtlib.c:(.text+0x11f3): undefined reference to `SHA1_Final'
dhtrouter.o: In function `dr_generate_token':
dhtrouter.c:(.text+0x93b): undefined reference to `SHA1_Init'
dhtrouter.c:(.text+0x952): undefined reference to `SHA1_Update'
dhtrouter.c:(.text+0x969): undefined reference to `SHA1_Update'
dhtrouter.c:(.text+0x975): undefined reference to `SHA1_Final'
collect2: ld returned 1 exit status
make[2]: *** [acnchess] Error 1
make[2]: Leaving directory `/share/arch/LocalPackages/acnchess/src/acnchess-0.0.1/src'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/share/arch/LocalPackages/acnchess/src/acnchess-0.0.1/src'
make: *** [all-recursive] Error 1
------------------ PKGBUILD file ---------------------------------
pkgname=acnchess
_mainver=0.0.1
_subver=69
pkgver=${_mainver}_${_subver}
pkgrel=2
pkgdesc="another Chinese chess game coded by Alf"
arch=('i686' 'x86_64')
url="http://code.google.com/p/acnchess/"
license=('GPL2')
depends=('gtk2>=2.6.0' 'rpmextract' 'openssl')
source=("http://acnchess.googlecode.com/files/$pkgname-${_mainver}-${_subver}.src.rpm")
md5sums=('a21cd520eaab3ceeb0604704f10da869')

build() {
  cd $srcdir
  rpmextract.sh $pkgname-${_mainver}-${_subver}.src.rpm
  bsdtar -xf $pkgname-${_mainver}.tar.gz
  cd "$srcdir/$pkgname-${_mainver}"

  ./configure --prefix=/usr
  make || return 1
  make DESTDIR="$pkgdir/" install
}

any idea?

SOLUTION: add "unset LDFLAGS" into build function in PKGBUILD  as bangkok_manouel said OR  filter out some flag as Ranguvar wrote

export LDFLAGS="${LDFLAGS//-Wl,--as-needed}"

Last edited by tocer (2009-12-07 15:33:49)

Offline

#2 2009-12-07 09:17:50

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,392
Website

Re: [Solved] compile manually success, but makepkg fail.

Do you have "MAKEFLAGS=-j3" or something like that in your makepkg.conf.  If so, try adding "options=('!makeflags')" to your pkgbuild.

Offline

#3 2009-12-07 13:46:21

tocer
Member
Registered: 2008-10-23
Posts: 28

Re: [Solved] compile manually success, but makepkg fail.

Allan wrote:

Do you have "MAKEFLAGS=-j3" or something like that in your makepkg.conf.  If so, try adding "options=('!makeflags')" to your pkgbuild.

No, the following is the part of makepkg.conf

#########################################################################
# ARCHITECTURE, COMPILE FLAGS
#########################################################################
#
CARCH="i686"
CHOST="i686-pc-linux-gnu"

#-- Exclusive: will only run on i686
# -march (or -mcpu) builds exclusively for an architecture
# -mtune optimizes for an architecture, but builds for whole processor family
CFLAGS="-march=i686 -mtune=generic -O2 -pipe"
CXXFLAGS="-march=i686 -mtune=generic -O2 -pipe"
LDFLAGS="-Wl,--hash-style=gnu -Wl,--as-needed"
#-- Make Flags: change this for DistCC/SMP systems
#MAKEFLAGS="-j2"

Offline

#4 2009-12-07 13:55:33

bangkok_manouel
Member
From: indicates a starting point
Registered: 2005-02-07
Posts: 1,556

Re: [Solved] compile manually success, but makepkg fail.

what if you unset LDFLAGS ?

Offline

#5 2009-12-07 14:13:28

tocer
Member
Registered: 2008-10-23
Posts: 28

Re: [Solved] compile manually success, but makepkg fail.

bangkok_manouel wrote:

what if you unset LDFLAGS ?

It works well, thank you very much.  But, it is the default value, and I never change it. I think most of Arch user use the default value. I'll submit this package to AUR, how to patch the PKGBUILD file so that other Arch user compile it correctly?

Offline

#6 2009-12-07 14:25:12

bangkok_manouel
Member
From: indicates a starting point
Registered: 2005-02-07
Posts: 1,556

Re: [Solved] compile manually success, but makepkg fail.

tocer wrote:
bangkok_manouel wrote:

what if you unset LDFLAGS ?

It works well, thank you very much.  But, it is the default value, and I never change it. I think most of Arch user use the default value. I'll submit this package to AUR, how to patch the PKGBUILD file so that other Arch user compile it correctly?

adding

unset LDFLAGS

below

build() {

should do it...

edit: LDFLAGS not CFLAGS errrf...

Last edited by bangkok_manouel (2009-12-07 14:26:35)

Offline

#7 2009-12-07 14:44:01

tocer
Member
Registered: 2008-10-23
Posts: 28

Re: [Solved] compile manually success, but makepkg fail.

bangkok_manouel:

good solution. thank you again.

Offline

#8 2009-12-07 14:57:17

Ranguvar
Member
Registered: 2008-08-12
Posts: 2,549

Re: [Solved] compile manually success, but makepkg fail.

More than likely it is the --as-needed flag giving problems.
I suggest you just filter out that flag rather than completely override the user's flags.

export LDFLAGS="${LDFLAGS//-Wl,--as-needed}"
export LDFLAGS="${LDFLAGS//,--as-needed}"
export LDFLAGS="${LDFLAGS//--as-needed}"

Offline

#9 2009-12-07 15:30:04

tocer
Member
Registered: 2008-10-23
Posts: 28

Re: [Solved] compile manually success, but makepkg fail.

Ranguvar wrote:

More than likely it is the --as-needed flag giving problems.
I suggest you just filter out that flag rather than completely override the user's flags.

export LDFLAGS="${LDFLAGS//-Wl,--as-needed}"
export LDFLAGS="${LDFLAGS//,--as-needed}"
export LDFLAGS="${LDFLAGS//--as-needed}"

the first line is good, the others compiled fail.

you are right, and it is better.

Offline

#10 2009-12-07 20:06:58

Ranguvar
Member
Registered: 2008-08-12
Posts: 2,549

Re: [Solved] compile manually success, but makepkg fail.

No, all three lines are supposed to be used.
They strip out --as-needed in different ways that the user might have them set.
The first line takes care of how it is set in default Arch, but if you use all three lines, then even custom LDFLAGS users should be covered.

Offline

#11 2009-12-08 01:27:46

tocer
Member
Registered: 2008-10-23
Posts: 28

Re: [Solved] compile manually success, but makepkg fail.

I got it. thank you

Offline

Board footer

Powered by FluxBB