Path: csiph.com!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: Universal Build System for C Date: Fri, 08 Oct 2021 20:51:28 -0700 Organization: None to speak of Lines: 50 Message-ID: <87sfxa6ekf.fsf@nosuchdomain.example.com> References: <933b95c1-8c8c-48dc-ae58-d49806746b2fn@googlegroups.com> <32f93050-eff2-4960-b4c8-d3dd3075b31en@googlegroups.com> <4a46c648-4897-4b28-a3fc-242583460506n@googlegroups.com> <87h7ds7v8u.fsf@nosuchdomain.example.com> <18a56158-6c16-4c04-807e-74dfde2fd15an@googlegroups.com> <2f5ffa4f-052d-45d8-a610-c36743ab1c22n@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: reader02.eternal-september.org; posting-host="7e8bdc203eb18db33af681d8600aa123"; logging-data="7106"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/LGqnY09DSJA2COqCZhXLa" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) Cancel-Lock: sha1:6ybddKlmPxhJ2JgyIlo3wRlkths= sha1:3szuDCeHroLl6UbISzevZtLWGOI= Xref: csiph.com comp.lang.c:163060 Thiago Adams writes: > On Friday, October 8, 2021 at 7:30:24 PM UTC-3, Thiago Adams wrote: > ... >> For Linux it is using default but I guess it could auto select as well, or show >> some options.. > > This is what I found how to change default gcc (because build script has hardcoded gcc) > > " > 1. Open the terminal window in LINUX and execute the command: > $ which gcc > This will provide the symbolic link (softlink) to the default version of GCC. > 2. Navigate to the directory which has this softlink. > Change the softlink to point to the version of GCC that you want to use. > For example, for a standard GCC version 4.7 installed (where the compiler command is put at /usr/bin/gcc-4.7), > this can be done using the following command: > $ sudo ln -f -s /usr/bin/gcc-4.7 gcc > " > from > https://www.mathworks.com/matlabcentral/answers/454659-how-can-i-change-my-current-gcc-g-version-to-a-supported-one > > > also added > system(""gcc --version") inside the build script to know > what version is being used. > > this is an extra step , however I guess all linux programmers > must know about this. That's bad advice. Telling users to mess around with system-owned directories like /usr/bin is dangerous. I know Linux pretty well, and I don't do that myself. On my system, for example, /usr/bin/gcc is a symbolic link to "gcc-9", which is provided by the "gcc-9" package. That package provides 55 files; the compiler executable is just one of them. If I manually change just the /usr/bin/gcc symlink, I'm likely to leave my system in an inconsistent state. And g++ (the C++ compiler) is provided by another package "g++9", which should normally be kept in synch with the gcc package. On Ubuntu, the "update-alternatives" command can be used to safely change the default version of a command. Other systems are likely to have something similar. -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com Working, but not speaking, for Philips void Void(void) { Void(); } /* The recursive call of the void */