Re: What is the best practice to use both gcc and clang flags macros in %check?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> I see no way this can actually work.
>
> For one, there's typos in the second part ($ instead of %, which of
> course makes them empty when those environment variables aren't
> defined).

Ahh, sorry for my mistakes. Thank you for finding my mistakes.

> Also I don't think you can set RPM .spec macros *within* a %check
> script (which is executed by bash), so `%global toolchain clang` would
> get passed to bash in this case, instead of getting parsed by RPM, no?
> So the errors after this line are understandable to me.

After fixing the typos, then the lines after setting `%global
toolchain clang` in %check section, it seems that the macros are used
as clang values.

The scratch build: https://koji.fedoraproject.org/koji/taskinfo?taskID=48762229

```
+ CC=clang
+ CXX=clang++
+ cmake -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON '-DCMAKE_C_FLAGS=-O2 -flto
-fexceptions -g -grecord-gcc-switches -pipe -Wall
-Werror=format-security -Wp,-D_FORTIFY_SOURCE=2
-Wp,-D_GLIBCXX_ASSERTIONS --config
/usr/lib/rpm/redhat/redhat-hardened-clang.cfg -fstack-protector-strong
  -m64 -mtune=generic -fasynchronous-unwind-tables  -fcf-protection'
'-DCMAKE_CXX_FLAGS=-O2 -flto -fexceptions -g -grecord-gcc-switches
-pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2
-Wp,-D_GLIBCXX_ASSERTIONS --config
/usr/lib/rpm/redhat/redhat-hardened-clang.cfg -fstack-protector-strong
  -m64 -mtune=generic -fasynchronous-unwind-tables  -fcf-protection'
..
```

> I also wonder why you are trying to override `toolchain` manually in
> this case, which I don't think is necessary at all. Reading the docs
> for those macros, it looks like using %set_build_flags and setting CC
> and CXX correctly should do what you want to do (unless CMake doesn't
> read those environment variables correctly, then you need to use
> %build_cflags, %build_cxxflags, %build_ldflags as you did before).

Let me check how to use %set_build_flags with CC=clang CXX=clang++.

Thanks!

-- 
Jun | He - His - Him
_______________________________________________
packaging mailing list -- packaging@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to packaging-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/packaging@xxxxxxxxxxxxxxxxxxxxxxx




[Index of Archives]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite Forum]     [KDE Users]

  Powered by Linux