You are not logged in.

#1 2015-03-16 10:28:49

ntisithoj
Member
Registered: 2015-03-09
Posts: 11

[SOLVED] makepkg ignoreing CFLAGS

It seems no matter what I do makeflags ignores my CFLAGS and CXXFLAGS options.

I have added

CFLAGS="-march=sandybridge -mtune=sandybridge -O3 -pipe"

to all the locations that makepkg.conf has been installed..

/etc/makepkg.conf
/home/jwdev/abs/chroot/jwdev/etc/makepkg.conf
/home/jwdev/abs/chroot/root/etc/makepkg.conf
/var/abs/core/pacman/makepkg.conf

as well as to the makechrootpkg command

mkarchroot -C /etc/pacman.conf -M /etc/makepkg.conf $CHROOT/root base-devel
arch-nspawn $CHROOT/root pacman -Syu
cd $1
makechrootpkg  -c -r $CHROOT -- CFLAGS="-march=sandybridge -mtune=sandybridge -O3 -pipe" CXXFLAGS="-march=sandybridge -mtune=sandybridge -O3 -pipe" 

But still, when I run makepkg I see...

g++ -c -pipe -O2 -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong --param=ssp-buffer-size=4 -Wall

This is the case if I makepkg or makechrootpkg

is there some otehr secert location for these args? or are they hardcoded in

I do see that some packages have hardcoded args, like libaio, which kind of defeats the point of abs

build() {
  cd "$srcdir/$pkgname-$pkgver"
  CFLAGS="-march=${CARCH/_/-} -mtune=generic -O2 -pipe"
  make
}

but in my test case, smplayer, this is not the case

build() {
  cd "$pkgname-$pkgver"
  make PREFIX=/usr \   
    DOC_PATH="\\\"/usr/share/doc/smplayer\\\"" \
    QMAKE_OPTS=DEFINES+=NO_DEBUG_ON_CONSOLE
}

thanks

UPDATE:  running makepkg on "joe" I see that the CFLAGS are correct... so it seems that only some (all but 1 so far actually) packages respect the makepkg? while the other just do their 'own thing'?  I am new to Arch, so maybe I am missing a huge piece of information

Last edited by ntisithoj (2015-03-17 06:35:08)

Offline

#2 2015-03-16 10:54:53

mauritiusdadd
Member
From: Benevento, Italy
Registered: 2013-10-27
Posts: 776

Re: [SOLVED] makepkg ignoreing CFLAGS

Hi ntisithoj,

the problem is that smplayer uses qmake. Here there is a very similar thread https://bbs.archlinux.org/viewtopic.php?id=194482.
If you want to use the CFLAGS and CXXFLAGS you defined in the makepkg.conf then you have to edit the PKGBUILD and pass to qmake the variable QMAKE_CFLAGS_RELEASE and QMAKE_CXXFLAGS_RELEASE:

build() {
  cd "$pkgname-$pkgver"
  make PREFIX=/usr \
    DOC_PATH="\\\"/usr/share/doc/smplayer\\\"" \
    QMAKE_OPTS="DEFINES+=NO_DEBUG_ON_CONSOLE QMAKE_CFLAGS_RELEASE=\"${CFLAGS}\" QMAKE_CXXFLAGS_RELEASE=\"${CXXFLAGS}\""
}

For more information see also this section of the wiki: https://wiki.archlinux.org/index.php/ma … d_packages


About me - github

-- When you have eliminated the impossible, whatever remains, however improbable, must be the truth -- Spock | Sherlock Holmes

Offline

#3 2015-03-16 11:49:16

ntisithoj
Member
Registered: 2015-03-09
Posts: 11

Re: [SOLVED] makepkg ignoreing CFLAGS

Ah, that make sense.

Sadly, I could not see any change with either setting QMAKE_CFLAGS_RELEASE or using qmake -set or the ENV VARS.   

thanks


here is what didn't work...

build() {
  cd "$pkgname-$pkgver"
  make PREFIX=/usr \   
    DOC_PATH="\\\"/usr/share/doc/smplayer\\\"" \
    QMAKE_OPTS=DEFINES+=NO_DEBUG_ON_CONSOLE     
        QMAKE_CFLAGS_RELEASE="-march=sandybridge -mtune=sandybridge -O3"\ 
        QMAKE_CXXFLAGS_RELEASE="-march=sandybridge -mtune=sandybridge -O3"
}

or

build() {
  cd "$pkgname-$pkgver"
  make PREFIX=/usr \   
    DOC_PATH="\\\"/usr/share/doc/smplayer\\\"" \
    QMAKE_OPTS=DEFINES+=NO_DEBUG_ON_CONSOLE \   
    QMAKE_CFLAGS_RELEASE="${CFLAGS}"\
    QMAKE_CXXFLAGS_RELEASE="${CXXFLAGS}"
}

or

QMAKE_CFLAGS_RELEASE="-march=sandybridge -mtune=sandybridge -O3"
QMAKE_CXXFLAGS_RELEASE="-march=sandybridge -mtune=sandybridge -O3"
QMAKE_CFLAGS="-march=sandybridge -mtune=sandybridge -O3"
QMAKE_CXXFLAGS="-march=sandybridge -mtune=sandybridge -O3"

or

qmake -set QMAKE_CFLAGS_RELEASE "-march=sandybridge -mtune=sandybridge -O3"
qmake -set QMAKE_CXXFLAGS_RELEASE "-march=sandybridge -mtune=sandybridge -O3"
qmake -set QMAKE_CFLAGS "-march=sandybridge -mtune=sandybridge -O3"
qmake -set QMAKE_CXXFLAGS "-march=sandybridge -mtune=sandybridge -O3"

Offline

#4 2015-03-16 12:00:43

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

Re: [SOLVED] makepkg ignoreing CFLAGS

It looks like you'll need to patch the Makefile.  The PKGBUILD doesn't run qmake itself, but just runs make - the Makefile runs qmake and make (it's not immediately obvious to me how the latter works without leading to an infinite recursion, but I don't use qmake).  In any case, none of these steps allow for environment setting of any of the variables.  The definitions use explicit "=" assignment rather than "+=" or "?=" which could allow for user settings.


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

Offline

#5 2015-03-16 13:11:51

mauritiusdadd
Member
From: Benevento, Italy
Registered: 2013-10-27
Posts: 776

Re: [SOLVED] makepkg ignoreing CFLAGS

ntisithoj wrote:

here is what didn't work...

Have you actually tried the code I posted?

QMAKE_OPTS="DEFINES+=NO_DEBUG_ON_CONSOLE QMAKE_CFLAGS_RELEASE=\"${CFLAGS}\" QMAKE_CXXFLAGS_RELEASE=\"${CXXFLAGS}\""

For me that worked. Note the use of the double quotes in the definition of QMAKE_OPTS: as Trilby has pointed out, qmake is invoked inside the Makefile and only the variable QMAKE_OPTS is passed to qmake itself so you need to embed QMAKE_CFLAGS_RELEASE and QMAKE_CXXFLAGS_RELEASE inside the definition of QMAKE_OPTS. If you don't use the quotes then they are treated as normal variables and passed to make only.

--- EDIT ---

Trilby wrote:

it's not immediately obvious to me how the latter works without leading to an infinite recursion

To be honest, initially that puzzled me too big_smile
However it seems that make invokes qmake (and the other instance of make) in a different directory than the one containing the original Makefile.

Last edited by mauritiusdadd (2015-03-16 13:44:16)


About me - github

-- When you have eliminated the impossible, whatever remains, however improbable, must be the truth -- Spock | Sherlock Holmes

Offline

#6 2015-03-16 14:58:40

pb
Member
From: Krakow, PL
Registered: 2014-12-26
Posts: 336
Website

Re: [SOLVED] makepkg ignoreing CFLAGS

The trick desribed in wiki:

https://wiki.archlinux.org/index.php/makepkg#CFLAGS.2FCXXFLAGS.2FCPPFLAGS_in_makepkg.conf_do_not_work_for_QMAKE_based_packages

works only with those sources, that use qmake (qmake-qt4) for preconfigure. In those case, you should to define QMAKE variable in PKGBUILD and next invoke it in "build" section. See example of QupZilla that works for me (it's modified qupzilla-qt5-qtwebkit-git's PKGBUILD by Alex Talker):

pkgname=qupzilla-qt5-qtwebkit-git
pkgver=r3348.0c37b62
pkgrel=1
pkgdesc="A new and very fast open source browser based on WebKit core, written in Qt Framework."
arch=('i686' 'x86_64')
url="http://qupzilla.com/index.php"
license=('GPL')
depends=( 'qt5-base' 'qt5-script' 'qt5-webkit')
makedepends=('git')
provides=('qupzilla' 'qupzilla-git')
conflicts=('qupzilla' 'qupzilla-git' 'qupzilla-qt5-git')
source=('git+https://github.com/QupZilla/qupzilla.git')
md5sums=('SKIP')
CFLAGS="-march=native -mtune=bdver2 -O2 -pipe -fstack-protector-strong --param=ssp-buffer-size=4"
CXXFLAGS="-march=native -mtune=bdver2 -O2 -pipe -fstack-protector-strong --param=ssp-buffer-size=4"

pkgver() {
  cd qupzilla
  printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

build() {
  cd "$srcdir/qupzilla"
  export USE_WEBGL="true"
  export KDE_INTEGRATION="true"
  export QUPZILLA_PREFIX="/usr/"
  export USE_LIBPATH="/usr/lib"
   
  qmake-qt5 "$srcdir/qupzilla/QupZilla.pro" \
        PREFIX=/usr \
        CONFIG+=LINUX_INTEGRATED \
        INSTALL_ROOT_PATH="$pkgdir" \
        QMAKE_CFLAGS_RELEASE="${CFLAGS}" \
        QMAKE_CXXFLAGS_RELEASE="${CXXFLAGS}"
  
  make
}

package() {
  cd ${srcdir}/qupzilla
  make INSTALL_ROOT="$pkgdir/" install
}

Modified sections are:
- in "headers" - where I add CFLAGS="something" and CXXFLAGS="something" variable and
- in "build" section by add:
QupZilla.pro to

  qmake-qt5 "$srcdir/qupzilla/

in original PKGBUILD and

CONFIG+=LINUX_INTEGRATED \
        INSTALL_ROOT_PATH="$pkgdir" \
        QMAKE_CFLAGS_RELEASE="${CFLAGS}" \
        QMAKE_CXXFLAGS_RELEASE="${CXXFLAGS}"

But, in case of smplayer, it looks like, that is "preconfigured". There isn't *.pro file, you don't use "qmake" to preconfigure sources, and typical configuration for it is only:

make
sudo make install

because everything else is in Makefile.txt. You should use another trick (I don't know which will be correct).

Offline

#7 2015-03-16 15:04:28

ntisithoj
Member
Registered: 2015-03-09
Posts: 11

Re: [SOLVED] makepkg ignoreing CFLAGS

I thought I did try your code, but I see that what I did was a little differerent.  Indeed, a cut and paste of your code worked perfectly smile

cd src && qmake DEFINES+=NO_DEBUG_ON_CONSOLE QMAKE_CFLAGS_RELEASE="-march=sandybridge -mtune=sandybridge -O3 -pipe"
QMAKE_CXXFLAGS_RELEASE="-march=sandybridge -mtune=sandybridge -O3 -pipe" && DATA_PATH=\\\"/usr/share/smplayer\\\" TRANSLATION_PATH=\\\"/usr/share/smplayer/translations\\\" DOC_PATH=\\\"\"/usr/share/doc/smplayer\"\\\" THEMES_PATH=\\\"/usr/share/smplayer/themes\\\" SHORTCUTS_PATH=\\\"/usr/share/smplayer/shortcuts\\\" make
make[225]: Entering directory '/build/smplayer/src/smplayer-14.9.0.6690'

thanks

Offline

#8 2015-03-16 18:35:09

mauritiusdadd
Member
From: Benevento, Italy
Registered: 2013-10-27
Posts: 776

Re: [SOLVED] makepkg ignoreing CFLAGS

I'm glad that it worked wink
Please remember also to mark this thread as [SOLVED].


About me - github

-- When you have eliminated the impossible, whatever remains, however improbable, must be the truth -- Spock | Sherlock Holmes

Offline

#9 2015-03-17 06:32:26

ntisithoj
Member
Registered: 2015-03-09
Posts: 11

Re: [SOLVED] makepkg ignoreing CFLAGS

well...  is 'sorta' worked....

it is showing

make[586]: Entering directory '/build/smplayer/src/smplayer-14.9.0.6690'
./get_svn_revision.sh
cd src && qmake DEFINES+=NO_DEBUG_ON_CONSOLE QMAKE_CFLAGS_RELEASE="-march=sandybridge -mtune=sandybridge -O3 -pipe"
QMAKE_CXXFLAGS_RELEASE="-march=sandybridge -mtune=sandybridge -O3 -pipe" && DATA_PATH=\\\"/usr/share/smplayer\\\" TRANSLATION_PATH=\\\"/usr/share/smplayer/translations\\\" DOC_PATH=\\\"\"/usr/share/doc/smplayer\"\\\" THEMES_PATH=\\\"/usr/share/smplayer/themes\\\" SHORTCUTS_PATH=\\\"/usr/share/smplayer/shortcuts\\\" make

the "sandybridge" and "-O3"  (also tried with "-O2") is evidence of that.  But you can see by the [586] that is has done this 586 times!  I have let it run into the thousands...  so in that sense it doesn't work

Also, of related interest... editing ANY of the /etc/makepkg.conf files, or the ENV vars, has not effect.  The only thing that did was passing

makechrootpkg  -c -r $CHROOT -- CFLAGS="-march=sandybridge -mtune=sandybridge -O2 -pipe" CXXFLAGS="-march=sandybridge -mtune=sandybridge -O2 -pipe" 

on the makepkg command line

Is this a bug? 

From my limited experience with it, makepkg  seems pretty wonky sometimes... especially makechrootpkg.

For example
  ->  the manual says that everything past '--' from makechrootpkg is passed to makepkg, but "--skippgpcheck" is either ignored or never makes it through.

  ->  compiling the first time works, compiling the second time throws a 'cant verify' error, and the keys, evern after adding, does nothing

So it seems reasonable that makepkg is at fault here, and your solution does indeed fix the problem.

Last edited by ntisithoj (2015-03-17 06:36:22)

Offline

#10 2015-03-17 08:11:03

mauritiusdadd
Member
From: Benevento, Italy
Registered: 2013-10-27
Posts: 776

Re: [SOLVED] makepkg ignoreing CFLAGS

This problem has nothing to do with makepkg or makechrootpkg, they both work well. Here there is the head of my compilation output.

...
==> Starting build()...
./get_svn_revision.sh
cd src && qmake DEFINES+=NO_DEBUG_ON_CONSOLE QMAKE_CFLAGS_RELEASE="-march=native -mtune=generic -O2 -pipe -fstack-protector-strong --param=ssp-buffer-size=4" QMAKE_CXXFLAGS_RELEASE="-march=native -mtune=generic -O2 -pipe -fstack-protector-strong --param=ssp-buffer-size=4" && DATA_PATH=\\\"/usr/share/smplayer\\\" TRANSLATION_PATH=\\\"/usr/share/smplayer/translations\\\" DOC_PATH=\\\"\"/usr/share/doc/smplayer\"\\\" THEMES_PATH=\\\"/usr/share/smplayer/themes\\\" SHORTCUTS_PATH=\\\"/usr/share/smplayer/shortcuts\\\" make
make[1]: Entering directory '/mnt/CACHE/ABS/extra/smplayer/src/smplayer-14.9.0.6690/src'
/usr/lib/qt/bin/uic inputdvddirectory.ui -o .ui/ui_inputdvddirectory.h
...

The problem is inside your Makefile: as you can see my log says

make[1]: Entering directory '/mnt/CACHE/ABS/extra/smplayer/src/smplayer-14.9.0.6690/src'

while your says

ntisithoj wrote:
make[586]: Entering directory '/build/smplayer/src/smplayer-14.9.0.6690'

By any chance have you edited the Makefile or applied any patch (if so please show them to us)? Meanwhile, just try to re-download the sources with ABS and modify only the variable QMAKE_OPTS.

ntisithoj wrote:

  -> the manual says that everything past '--' from makechrootpkg is passed to makepkg, but "--skippgpcheck" is either ignored or never makes it through.

I already answered this question in the other thread you opened.

ntisithoj wrote:

  ->  compiling the first time works, compiling the second time throws a 'cant verify' error, and the keys, evern after adding, does nothing

If you have any problem feel free to open another thread and please post there any actual full log containing the errors.

Last edited by mauritiusdadd (2015-03-17 08:16:37)


About me - github

-- When you have eliminated the impossible, whatever remains, however improbable, must be the truth -- Spock | Sherlock Holmes

Offline

#11 2015-03-18 07:26:00

ntisithoj
Member
Registered: 2015-03-09
Posts: 11

Re: [SOLVED] makepkg ignoreing CFLAGS

ok, redownloaded the PKGBUILD and ONLY changed the one line to

QMAKE_OPTS="DEFINES+=NO_DEBUG_ON_CONSOLE QMAKE_CFLAGS_RELEASE=\"${CFLAGS}\" QMAKE_CXXFLAGS_RELEASE=\"${CXXFLAGS}\""

Which is what I had done before (not having a clue how to 'tweak' PKGBUILD files, I dare not touch them)

and this time is DID successfully compile smile  so, unfortunately I have no idea what was breaking it before, of what I inadvertantly changed, but glad it works now.

p.s. I had not yet read the other thread regarding --skippgpcheck.  I have since

Thank you

Offline

Board footer

Powered by FluxBB