Community Packages

Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#67092 - [nim] makepkg compiler flags should be removed after compilation

Attached to Project: Community Packages
Opened by Danil Yarantsev (Yardanico) - Tuesday, 23 June 2020, 21:07 GMT
Last edited by freswa (frederik) - Wednesday, 24 June 2020, 21:38 GMT
Task Type Bug Report
Category Packages
Status Assigned
Assigned To Levente Polyak (anthraxx)
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 2
Private No

Details

Description:
If you check https://git.archlinux.org/svntogit/community.git/tree/trunk/PKGBUILD?h=packages/nim#n37 (lines from 37 to 40), you can see that the PKGBUILD adds the compilation flags to the Nim configuration (and for some reason in compiler/nim.cfg too although that's not needed since it'll use flags from the config/nim.cfg too).

The problem is - if these flags are not removed after building the compiler and all tools, the user wouldn't be able to cross-compile using GCC since Nim would always add flags like "-march=x86_64 -mtune=generic" (which were added in the PKGBUILD) to any GCC cross-compilers.

Proposed solution:
Remove these flags from the nim.cfg after building the compiler and all tools.

Initially reported in a Nim Telegram group (starts at https://t.me/nim_lang/38313)
This task depends upon

Comment by Danil Yarantsev (Yardanico) - Tuesday, 23 June 2020, 21:09 GMT
To reproduce, you can install nim package itself and any cross-compiler (such as aarch64-linux-gnu-gcc), then make a hello world file like:

# hello.nim
echo "Hello world"

And try to cross-compile it with nim c --cpu:arm64 --gcc.exe="aarch64-linux-gnu-gcc" --gcc.linkerexe="aarch64-linux-gnu-gcc" hello.nim
It'll fail because -march=x86_64 -mtune=generic were passed to aarch64-linux-gnu-gcc

Loading...