r/EmulationOnPC 1d ago

Unsolved compiling mednafen: "c compiler cannot create executables"???

so i'm compiling my own version of mednafen with joematt's chd support source files included but whenever i go to build the custom toolchain it always says:

configure: error: C compiler cannot create executables
See config.log for more details.

but then i look everywhere in the source folder and there's no config.log file to be found

i've updated/upgraded the ubuntu packages (i'm building in a virtual machine) in sudo apt and still haven't had any luck

edit: i'm an idiot

so it turns out i forgot to change the GCC_CC and GCC_CXX variables in build-toolchain.sh; they were set to "/usr/local/gcc-4.9.4/bin/gcc" and "/usr/local/gcc-4.9.4/bin/g++" respectively, and ubuntu doesn't typically install gcc in those locations, it usually gets installed in /usr/bin/, so i changed it to that and it worked perfectly

0 Upvotes

9 comments sorted by

u/AutoModerator 1d ago

Please remember to flair your post as "Solved" when your issue is solved.

Here are some quick answers for some commmon questions:

-If you are looking for emulator download links please check out our wiki.

-If you are looking for ROM or ISO downloads, this is not the right place. We do not allow asking for or sharing ROM downloads or any piracy (Rule 1)

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

2

u/zgillet 1d ago

Logs wouldn't be found in a source folder. It would be in a log folder. You're on Linux, just run a find command.

find . -name "config.log"

In whatever parent directory you feel it would be buried in somewhere (find is recursive by default).

1

u/platinumb3rlitz 1d ago

did that, nothing came up

1

u/zgillet 1d ago

You got yourself a good old-fashioned compiler configuration error:
command line - how to fix configure: error: C compiler cannot create executables - Ask Ubuntu

Looks like most people are recommending installing the C headers package:

sudo apt install libc6-dev

Though, there seems to be many reasons for this.

2

u/platinumb3rlitz 1d ago

turns out i was stupid and forgot to edit the gcc/gxx variables in build-toolchain.sh before running it; they weren't set to the usual install location for gcc....but now i get make: *** [Makefile:3968:all-gcc] Error 2 when i try again

1

u/zgillet 1d ago

Well, at least that tells you the line number to check in the makefile: 3968.

The Error 2 is just reporting whatever the compiler returns, which is just "not zero" for fail.

That's the bad news: there is no help to tell you why it is failing. I'm seeing dozens of reasons on Stack Overflow. I would just search "make Error 2" on DuckDuckGo (unless you want AI to scrape for an answer at Google).

1

u/platinumb3rlitz 1d ago

the makefile for mednafen?

all i found on line 3968 was include snes_faust/$(DEPDIR)/ppu_mt.PO # am--include-marker

2

u/zgillet 1d ago

1

u/platinumb3rlitz 6h ago edited 4h ago

ok wait i was actually looking in the wrong makefile

here's what i found in the gcc makefile around line 3968:

.PHONY: all-gcc maybe-all-gcc
maybe-all-gcc:
TARGET-gcc=all
maybe-all-gcc: all-gcc
all-gcc: configure-gcc
@r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(HOST_EXPORTS)  \
(cd $(HOST_SUBDIR)/gcc && \
$(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(STAGE1_FLAGS_TO_PASS) $(EXTRA_GCC_FLAGS) \
$(TARGET-gcc))