Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
clang failed to compile with gcc arguments
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
piotr5
Tux's lil' helper
Tux's lil' helper


Joined: 14 Dec 2012
Posts: 121

PostPosted: Sat Jul 06, 2024 4:06 pm    Post subject: clang failed to compile with gcc arguments Reply with quote

distcc asks us to figure out what -march=native is doing and give those arguments. I did do that for gcc and wrote the result into CFLAGS in make.conf.
now however the package dev-libs/rocm-device-libs-6.1.1::gentoo failed (configure phase) because clang doesn't support a command-line option:
Code:
    clang: error: unknown argument '-mabm'; did you mean '-marm'?
is there a way to provide different CFLAGS for clang than for gcc? or was that the fault of the package to make use of CFLAGS in the first place?

needless to say, solution is to disable distcc and compile with -march=native at least for this package. strange though I never experienced this problem before...
Back to top
View user's profile Send private message
sedorox
Apprentice
Apprentice


Joined: 13 Feb 2004
Posts: 207

PostPosted: Sat Jul 13, 2024 12:59 am    Post subject: Reply with quote

I had been fighting this myself, but didn't spend time on it.
Finally did, this is how I got around it:

/etc/portage/package.env/rocm-device-libs:
Code:

dev-libs/rocm-device-libs dev-libs/rocm-device-libs.conf


Then /etc/portage/env/dev-libs/rocm-device-libs.conf
Code:

COMMON_FLAGS="-O2 -march=znver2 -pipe
-mmmx -msse -msse2 -msse3 -mssse3 -msse4a -mcx16 -msahf -mmovbe -maes -msha
-mpclmul -mpopcnt -mfma -mbmi -mbmi2 -mwbnoinvd -mavx -mavx2 -msse4.2
-msse4.1 -mlzcnt -mrdrnd -mf16c -mfsgsbase -mrdseed -mprfchw -madx -mfxsr
-mxsave -mxsaveopt -mclflushopt -mxsavec -mxsaves -mclwb -mmwaitx -mclzero
-mrdpid --param l1-cache-size=768 --param l1-cache-line-size=768
--param l2-cache-size=6144 -mtune=znver2 -fforce-addr -fomit-frame-pointer"


CFLAGS="${COMMON_FLAGS}"
CXXFLAGS="${COMMON_FLAGS} -D_FILE_OFFSET_BITS=64 -fPIC"
FCFLAGS="${COMMON_FLAGS}"
FFLAGS="${COMMON_FLAGS}"
LDFLAGS="${LDFLAGS} -Wl,--sort-common"



Which for rocm-device-libs.conf, it's the same as make.conf, but I removed -mabm. I think it was added at some point when I tried to get the specific flags that march=znver2 would bring in.

After this, I got a clean compile.
_________________
Home Desktop: Ryzen 3900X 3.8ghz | 32G Ram | 2x 1TB NVMe
Previous 7 Year Build: Intel i5-2400 3.1ghz | 16G Ram | 1x 60G SSD, 1x 1TB HDD
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum