What happened to GCC?

Discussion of chess software programming and technical issues.

Moderators: chrisw, Rebel, Ras

User avatar
Gabor Szots
Posts: 1408
Joined: Sat Jul 21, 2018 7:43 am
Location: Budapest, Hungary
Full name: Gabor Szots

What happened to GCC?

Post by Gabor Szots »

Recently, when I try to use gcc with the command line "gcc *.c etc." I get an error message that *.c is an invalid argument. I'd be grateful if someone here could explain why is that and whether there is a solution.
Gabor Szots
CCRL testing group
fire_varan
Posts: 11
Joined: Mon Dec 23, 2024 1:32 am
Full name: Anatoliy Sova

Re: What happened to GCC?

Post by fire_varan »

I believe you need to provide exact list of .c files to gcc for compile - like gcc myfile1.c myfile2.c
BeyondCritics
Posts: 408
Joined: Sat May 05, 2012 2:48 pm
Full name: Oliver Roese

Re: What happened to GCC?

Post by BeyondCritics »

Nothing of course, it looks like as if the shell you were using could not expand your globbing pattern and in turn left it as is, hence the compiler stumbled over it. Could that be?
What do you want to do? Could it be, that you are not an experienced coder, since you are trying to do something that you normally never should do?
If you want to compile the source code of a given engine for yourself you should use the build system provided. I also would recommend to always ask a coding model for assistance, it is the way it goes in the future. Resistance is futile😉
User avatar
Gabor Szots
Posts: 1408
Joined: Sat Jul 21, 2018 7:43 am
Location: Budapest, Hungary
Full name: Gabor Szots

Re: What happened to GCC?

Post by Gabor Szots »

fire_varan wrote: Wed Jan 01, 2025 9:37 pm I believe you need to provide exact list of .c files to gcc for compile - like gcc myfile1.c myfile2.c
That would be a pain when there are 10 or more source files.
Gabor Szots
CCRL testing group
fire_varan
Posts: 11
Joined: Mon Dec 23, 2024 1:32 am
Full name: Anatoliy Sova

Re: What happened to GCC?

Post by fire_varan »

You could construct a .bat or .sh file and just run it. Or use tool like make / CMake.
User avatar
Gabor Szots
Posts: 1408
Joined: Sat Jul 21, 2018 7:43 am
Location: Budapest, Hungary
Full name: Gabor Szots

Re: What happened to GCC?

Post by Gabor Szots »

BeyondCritics wrote: Wed Jan 01, 2025 11:20 pm Nothing of course, it looks like as if the shell you were using could not expand your globbing pattern and in turn left it as is, hence the compiler stumbled over it. Could that be?
What do you want to do? Could it be, that you are not an experienced coder, since you are trying to do something that you normally never should do?
If you want to compile the source code of a given engine for yourself you should use the build system provided. I also would recommend to always ask a coding model for assistance, it is the way it goes in the future. Resistance is futile😉
I am not an experienced coder. In fact I am not a coder at all. However, I have compiled lots of chess engines from source using '*.c'. But now, for some time, that has not been possible. I'm on Win11 23H2.

When you say 'you should use the build system provided' I guess you mean the makefile, don't you?
And when you say 'ask a coding model for assistance' I simply don't know what you are taling about.
Gabor Szots
CCRL testing group
User avatar
Bo Persson
Posts: 254
Joined: Sat Mar 11, 2006 8:31 am
Location: Malmö, Sweden
Full name: Bo Persson

Re: What happened to GCC?

Post by Bo Persson »

Gabor Szots wrote: Thu Jan 02, 2025 7:52 am However, I have compiled lots of chess engines from source using '*.c'. But now, for some time, that has not been possible. I'm on Win11 23H2.
Yes, that is the problem. On Linux the shell will expand *.c and feed that list to the compiler. The standard Windows console does not do anything like that.

So it has nothing to do with gcc, it is the environment.
Modern Times
Posts: 3656
Joined: Thu Jun 07, 2012 11:02 pm

Re: What happened to GCC?

Post by Modern Times »

Bo Persson wrote: Thu Jan 02, 2025 10:44 am Yes, that is the problem. On Linux the shell will expand *.c and feed that list to the compiler. The standard Windows console does not do anything like that.
How about Windows Powershell ? Same ?
User avatar
Gabor Szots
Posts: 1408
Joined: Sat Jul 21, 2018 7:43 am
Location: Budapest, Hungary
Full name: Gabor Szots

Re: What happened to GCC?

Post by Gabor Szots »

Bo Persson wrote: Thu Jan 02, 2025 10:44 am So it has nothing to do with gcc, it is the environment.
It was OK a couple of months ago. My typical command looked like this: gcc *.c -O3 -flto -march=native -oSomething.exe, and it usually worked. I use Total Commander as a file manager and I issue commands from there.

There were a couple of Windows updates lately, maybe they ruined something.

Thanks for the hints.
Gabor Szots
CCRL testing group
User avatar
Roland Chastain
Posts: 669
Joined: Sat Jun 08, 2013 10:07 am
Location: France
Full name: Roland Chastain

Re: What happened to GCC?

Post by Roland Chastain »

Don't know why it doesn't work for you. It still works here (Linux).

I would use a Makefile. For example this one I have made for an engine named Leonidas.

Code: Select all

SRC := $(wildcard *.c)

leonidas: ${SRC}
	gcc -o $@ $^
When I type make in a terminal, I can see the command sent to gcc:
[roland@localhost leonidas-makefile]$ make
gcc -o leonidas bitboard.c board.c evaluate.c game.c genrand.c hashkey.c hashtable.c keypressed.c leo.c move.c movegen.c perft.c pieces.c play.c search.c see.c square.c timer.c variants.c xboard.c
That Makefile should work for any C program. It will work also under Windows, provided that you have make.exe.
Qui trop embrasse mal étreint.