Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Portage & Programming
  • Search

rust CFLAGS

Problems with emerge or ebuilds? Have a basic programming question about C, PHP, Perl, BASH or something else?
Post Reply
Advanced search
8 posts • Page 1 of 1
Author
Message
paluszak
Apprentice
Apprentice
Posts: 274
Joined: Mon Jun 28, 2004 4:27 pm
Location: Warsaw, Poland

rust CFLAGS

  • Quote

Post by paluszak » Wed Feb 13, 2019 2:12 pm

Hi,

Is there a way to add CPU-specific flags for rust ebuilds to make.conf? For instance something along the lines '-C target-cpu=native' to generate CPU optimized code? Or possibly other codegen options (https://doc.rust-lang.org/rustc/codegen ... index.html)?

J.
Top
NeddySeagoon
Administrator
Administrator
User avatar
Posts: 56085
Joined: Sat Jul 05, 2003 9:37 am
Location: 56N 3W

  • Quote

Post by NeddySeagoon » Wed Feb 13, 2019 7:31 pm

paluszak,

Yes and no.

Yes you can have per package CFLAGS. No, you don't do it in make.conf.

The process is documented in Per-package environment variables
The worked example is for debugging but you will be able to adapt it.

-- edit --

EXTRA_ECONF= lets you pass additional options to some build systems.
This may be useful too.
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Top
paluszak
Apprentice
Apprentice
Posts: 274
Joined: Mon Jun 28, 2004 4:27 pm
Location: Warsaw, Poland

  • Quote

Post by paluszak » Wed Feb 13, 2019 7:41 pm

I know how to set up per-package CFLAGS, but what I'm asking about is if there's an equivalent of CFLAGS for rust packages. For istance, I'd like my rust packages to be built with '-C target-cpu=native' option added to command line.
Top
NeddySeagoon
Administrator
Administrator
User avatar
Posts: 56085
Joined: Sat Jul 05, 2003 9:37 am
Location: 56N 3W

  • Quote

Post by NeddySeagoon » Wed Feb 13, 2019 8:41 pm

paluszak,

Sorry, I misunderstood your question. I can delete my posts and your response to get your opening post back into the unanswered post search if you like.
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Top
paluszak
Apprentice
Apprentice
Posts: 274
Joined: Mon Jun 28, 2004 4:27 pm
Location: Warsaw, Poland

  • Quote

Post by paluszak » Wed Feb 13, 2019 8:59 pm

No, that's fine. I'll try to delve into the rust eclass. For now I found only that setting RUSTFLAGS env value adds given options to cargo builds, but that's what I found in the cargo man page. So it's kind of solved, but only kind of - afaik you can use rustc directly and not exclusively via cargo build system.
Top
Ant P.
Watchman
Watchman
Posts: 6920
Joined: Sat Apr 18, 2009 7:18 pm
Contact:
Contact Ant P.
Website

  • Quote

Post by Ant P. » Sat Mar 30, 2019 7:58 am

Putting RUSTFLAGS="-C target-cpu=native" into make.conf seems to have an effect - tested by putting an invalid option in there and watching emerge fail.

Unlike CFLAGS it's probably safe to use native there for the foreseeable future because rust has no distcc support.
Top
NeddySeagoon
Administrator
Administrator
User avatar
Posts: 56085
Joined: Sat Jul 05, 2003 9:37 am
Location: 56N 3W

  • Quote

Post by NeddySeagoon » Sat Mar 30, 2019 10:47 am

Ant P.

For a long time now using -march=native in CFLAGS has been 'safe' with distcc.
distcc won't distribute when it sees that.
You no longer gent a mix of arches back, depending on what built on what arch.
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Top
paluszak
Apprentice
Apprentice
Posts: 274
Joined: Mon Jun 28, 2004 4:27 pm
Location: Warsaw, Poland

[SOLVED] rust CFLAGS

  • Quote

Post by paluszak » Sat Mar 30, 2019 10:51 am

Ant P. wrote:Putting RUSTFLAGS="-C target-cpu=native" into make.conf seems to have an effect - tested by putting an invalid option in there and watching emerge fail.

Unlike CFLAGS it's probably safe to use native there for the foreseeable future because rust has no distcc support.
Yep, I noticed that. Seems to work perfectly fine. There are some build that fail with lto, mostly those linking against external C code, like Firefox.
Top
Post Reply

8 posts • Page 1 of 1

Return to “Portage & Programming”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic