You are not logged in.

#1 2020-05-10 22:02:45

Numaurasis
Member
Registered: 2020-04-28
Posts: 10

[Solved] Compiling all programs with -march=native?

So I have a lot of programs I download from the AUR (mostly using the yay wrapper), many of which are high-performance programs that I would rather have run faster. I've noticed that almost all of the packages build with -O2 and -march=generic. Is there any way for me to override this setting to -O3 (on some of them that I know this is safe on) and -march=native? Since I'm willing to experiment with stability and I'm only gonna be running the binaries on my own computer?

Last edited by Numaurasis (2020-05-10 23:48:51)

Offline

#2 2020-05-10 22:04:57

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

Re: [Solved] Compiling all programs with -march=native?

Seriously?  RTFW or man page.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#3 2020-05-10 22:10:41

Numaurasis
Member
Registered: 2020-04-28
Posts: 10

Re: [Solved] Compiling all programs with -march=native?

I want to do it from yay automatically every time I build that specific package, sorry if that wasn't clear.

Last edited by Numaurasis (2020-05-10 22:12:28)

Offline

#4 2020-05-10 22:14:49

loqs
Member
Registered: 2014-03-06
Posts: 19,076

Re: [Solved] Compiling all programs with -march=native?

You followed the link Trilby provided and yay is not using the flags?

Offline

#5 2020-05-10 22:17:10

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

Re: [Solved] Compiling all programs with -march=native?

What specific package?  You haven't mentioned a specific package.  In fact, your title says you want to use these settings for all programs.  But in any case, yay is irrelevant.  If you have no idea what yay is doing, you most definitely shouldn't be using it.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#6 2020-05-10 22:21:45

Numaurasis
Member
Registered: 2020-04-28
Posts: 10

Re: [Solved] Compiling all programs with -march=native?

Ok, let me clarify. I want a handful of specific packages to be compiled with -O3, as I said before " Is there any way for me to override this setting to -O3 (on some of them that I know this is safe on)." I want the rest to be compiled with -O2 and everything to have -march=native. I know what yay is doing, it's a wrapper for pacman that automates the process of downloading AUR packages, managing the build files and building them.

Offline

#7 2020-05-10 22:28:19

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

Re: [Solved] Compiling all programs with -march=native?

Editted post.  I have nothing constructive to offer here.  OP, don't expect to be handheld, make some effort.

Last edited by Trilby (2020-05-10 22:29:24)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#8 2020-05-10 22:28:21

loqs
Member
Registered: 2014-03-06
Posts: 19,076

Re: [Solved] Compiling all programs with -march=native?

Trilby already provided the solution for changes for every build.

For specific builds you can:

  • Alter the PKGBUILD to change CFLAGS/CXXFLAGS

  • Use an alternate config file for makepkg

  • Set CFLAGS/CXXFLAGS as environment variables so the values set in makepkg.conf are overridden then unset the variables afterwards if you exported them.

Edit:
The above all assumes the package being built respects CFLAGS/CXXFLAGS.

Last edited by loqs (2020-05-10 22:33:03)

Offline

#9 2020-05-10 23:48:36

Numaurasis
Member
Registered: 2020-04-28
Posts: 10

Re: [Solved] Compiling all programs with -march=native?

The packages I were trying to compile with -O3 and -march=native did not respect CFLAGS/CXXFLAGS, I figured out how to change the compiler flags another way, marking as solved.

Offline

#10 2020-05-11 03:21:55

Awebb
Member
Registered: 2010-05-06
Posts: 6,688

Re: [Solved] Compiling all programs with -march=native?

If yay supported being fed a makepkg.conf per operation, then you could use yay.

Offline

Board footer

Powered by FluxBB