Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake(Linux): make "-fno-omit-frame-pointer" configurable in release … #1429

Closed

Conversation

apocelipes
Copy link
Contributor

@apocelipes apocelipes commented Dec 8, 2024

…mode.

Starting last year, Fedora and Ubuntu began to require softwares in the repository to turn on the "-fno-omit-frame-pointer" and "-mno-omit-leaf-frame-pointer" compiler options by default. This year Arch Linux also began to make similar requirements.

Fedora: https://fedoraproject.org/wiki/Changes/fno-omit-frame-pointer
Ubuntu: https://www.phoronix.com/news/Ubuntu-Frame-Pointers-Default
Arch Linux: https://rfc.archlinux.page/0026-fno-omit-frame-pointer/

So add an option and set its default value to OFF, packagers can set to ON if they need it. This might make those packagers' lives easier.

Currently the frame pointer is only valuable under Linux so it is only enabled when the build target is Linux.

This option is also not enabled in Debug mode, for two reasons:

  1. Debug mode already sets "-fno-omit-frame-pointer", that's enough.
  2. Frame pointers are not only for debugging but for tools like perf and eBPF to do profiling.

Test:

Turn on the option:
on

Default/Turn off:
off

image

@CarterLi
Copy link
Member

CarterLi commented Dec 8, 2024

Why not CFLAGS="-fno-omit-frame-pointer -mno-omit-leaf-frame-pointer" cmake ...

@apocelipes
Copy link
Contributor Author

apocelipes commented Dec 8, 2024

Why not CFLAGS="-fno-omit-frame-pointer -mno-omit-leaf-frame-pointer" cmake ...

It's too long and the packager should check the whole cmakelists file to ensure the flags won't be overrode, maybe too difficult to some one (a packager not need to be a programmer).

Sometimes I also need this for profiling, so I made my life easier too. To be honest, I can't remember options like "-mno-omit-leaf-xxxx", but I can barely remember ENABLE_FRAME_POINTERS.

@apocelipes
Copy link
Contributor Author

Using options has another benifit: users can use ccmake to select their favourite features.
image

@CarterLi
Copy link
Member

CarterLi commented Dec 9, 2024

Why not CFLAGS="-fno-omit-frame-pointer -mno-omit-leaf-frame-pointer" cmake ...

It's too long and the packager should check the whole cmakelists file to ensure the flags won't be overrode, maybe too difficult to some one (a packager not need to be a programmer).

There's ninja --verbose. There are thousands of packages but I don't think they can require every package to add this kind of option.

Sometimes I also need this for profiling, so I made my life easier too. To be honest, I can't remember options like "-mno-omit-leaf-xxxx", but I can barely remember ENABLE_FRAME_POINTERS.

What if you want -mno-omit-leaf-yyyy later? Fastfetch needs to add a new option again to fulfil your personal requirements?

No.

@CarterLi CarterLi closed this Dec 9, 2024
@apocelipes
Copy link
Contributor Author

That's not my PERSONAL requirement. THAT'S FEDORA/UBUNTU/ARCH's REQUIREMENTS.

@apocelipes
Copy link
Contributor Author

There's ninja --verbose. There are thousands of packages but I don't think they can require every package to add this kind of option.

No, they can.

@apocelipes
Copy link
Contributor Author

OK, seems like u never read links that I posted and only want to against me. It's wasting time.

@apocelipes apocelipes deleted the enable-frame-pointers branch December 9, 2024 01:45
@CarterLi
Copy link
Member

CarterLi commented Dec 9, 2024

Have you ever used CFLAGS??? CFLAGS is the standard environment variable that can be set globally, for example, in your bashrc. Both fedora and debian use helper scripts to invoke cmake. If I am the package manager, I will just set CFLAGS="-fno-omit-frame-pointer -mno-omit-leaf-frame-pointer" in the helper script, and all packages that use the script will have the flags set.

That's not my PERSONAL requirement. THAT'S FEDORA/UBUNTU/ARCH's REQUIREMENTS.

Sometimes I also need this for profiling, so I made my life easier too. To be honest, I can't remember options like "-mno-omit-leaf-xxxx", but I can barely remember ENABLE_FRAME_POINTERS.

This is your requirements. As for now, no mantainers of fastfetch distro packages made a request of adding this kind of cmake option. ENABLE_FRAME_POINTERS is your idea and named by you. I don't think you discussed it with any real fastfetch package mantainers.

@CarterLi
Copy link
Member

CarterLi commented Dec 9, 2024

OK, seems like u never read links that I posted and only want to against me. It's wasting time.

Again, please make requests that really solve problems. Otherwise, it's wasting time. Yes.

@apocelipes
Copy link
Contributor Author

I think you should take a look at aur or ubuntu ppa's build scripts, almost no one use CFlags=xxx cmake. This is an unusual way to set compiler flags. However, if you are living in 20 years ago may be it was not so much unusual.
image

But who cares, I'm not your package mantainer so that's not my business. God bless your packagers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants