Comments (5)
So dont do that. Compiling something in order to detect the compiler is
a crazy approach. If you dont know what the compiler is, you cannot in
general compile anything. GCC making it impossible to detect what
compiler it is from its --version output, is a bug in gcc. That said
maybe I can instead check for clang since it seems to have a much more
sensible design than gcc.
from kitty.
On the contrary; the crazy approach is scraping version output that is clearly fragile and intended for human, not machine, consumption. The most sane way to tell if you can pass certain options to a compiler (without requiring up-front user input) is to try to run it with those arguments and find out if it complains.
Alternatively, exposing tunables to allow builders to indicate what compiler should be expected is a simple and reliable method to solve this problem.
from kitty.
Only GCC's --version output is fragile. And as I said that is a bug in GCC. One I will workaround by switching detection to check for clang. And incidentally passing flags to a compiler to check if itcomplains is bonkers. That only tells you whether the compiler runs or not. It does not distiguish between different compilers having different effects from the same flag. Many compilers implement flags from each other and ignore them in the name of some misguided attempt at being drop in replacements for each other.
from kitty.
Oh yeah and kitty's build system supports the CC env var just fine. So use that as your tuneable.
from kitty.
You don't need to compile anything to get the compiler ID.
Meson, for example, has a lot of very complex logic to detect many different compilers. It detects that cc.get_id()
should be "gcc" by probing the --version
output, it simply doesn't check for "gcc" as the first word: https://github.com/mesonbuild/meson/blob/0b7b4a3d9e41901b000074e903ad0bb8a299785c/mesonbuild/compilers/detect.py#L339
Instead, it checks for "Free Software Foundation" in the output.
Well, actually it uses that to detect "gcc_or_lcc". In case you care about the lcc compiler, it does then check for compiler defines via $CC -E -dM - < /dev/null
, still no compilation needed.
There are other interesting things going on there -- the file is 1400 lines long, and quite a bit of it is just for detecting C / C++ compilers specifically. It's not as simple a task as people might assume.
(This is why eventually people trend towards migrating to dedicated build systems.)
from kitty.
Related Issues (20)
- Autohide tabbar HOT 2
- Allow `combine` mappable action to use a custom delimiter HOT 1
- Cursor gets Reset after sourcing ~/.zshrc HOT 2
- Scrolling became unusable on Wayland HOT 3
- Characters get bugged when entering a container HOT 1
- With `symbol_map` set, kitty still renders nerd font icons in two ways HOT 5
- kitty is constantly freezing up HOT 5
- Shell integration breaks embedded newlines in PS1 HOT 1
- Make `kitten transfer` work in tmux HOT 1
- Feature request: `--range` and `--multiple-ranges` for `hint` `kitten` HOT 1
- Inactive (non-OS) window styling HOT 4
- some font cannot show HOT 2
- Possibly missing KP_ENTER in terminfo database HOT 1
- Scrollback corruption after resizing window HOT 1
- scrollback pager showing shell integration characters with multi-line prompt HOT 4
- Apple Color Emoji not found on kitty +list-fonts HOT 5
- Nerd font `symbol_map` from FAQ not all ranges seem to work
- Build fails if -D_FORTIFY_SOURCES is in env CFLAGS HOT 6
- SIGSEGV when deleting a lot of images at once HOT 6
- Alias Invader HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kitty.