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

Build failure with CFLAGS="-ggdb" #272

Closed
khumba opened this issue Jan 22, 2018 · 2 comments
Closed

Build failure with CFLAGS="-ggdb" #272

khumba opened this issue Jan 22, 2018 · 2 comments

Comments

@khumba
Copy link

khumba commented Jan 22, 2018

Hello,

snes9x-1.55 on Gentoo amd64 fails to build when CFLAGS/CXXFLAGS contains -ggdb, because unix/configure.ac has the following code:

# Remove -g and -O2 flags manually.

if test "x$CFLAGS" != "x"; then
	CFLAGS="`echo \"$CFLAGS\" | sed -e 's/-g//'`"
	CFLAGS="`echo \"$CFLAGS\" | sed -e 's/-O2//'`"
fi

if test "x$CXXFLAGS" != "x"; then
	CXXFLAGS="`echo \"$CXXFLAGS\" | sed -e 's/-g//'`"
	CXXFLAGS="`echo \"$CXXFLAGS\" | sed -e 's/-O2//'`"
fi

which causes gdb to be passed as a literal argument to GCC:

make --jobs=8 --load-average=16
x86_64-pc-linux-gnu-g++ -I. -I.. -I../apu/ -I../apu/bapu -I../jma/ -I../filter/ -c -pipe -march=native gdb  -DJOYSTICK_SUPPORT -DUNZIP_SUPPORT -DSYSTEM_ZIP -DJMA_SUPPORT -DPTR_NOT_INT -DMITSHM ../apu/apu.cpp -o ../apu/apu.o
x86_64-pc-linux-gnu-g++ -I. -I.. -I../apu/ -I../apu/bapu -I../jma/ -I../filter/ -c -pipe -march=native gdb  -DJOYSTICK_SUPPORT -DUNZIP_SUPPORT -DSYSTEM_ZIP -DJMA_SUPPORT -DPTR_NOT_INT -DMITSHM ../apu/bapu/dsp/sdsp.cpp -o ../apu/bapu/dsp/sdsp.o
x86_64-pc-linux-gnu-g++: error: gdb: No such file or directory
make: *** [Makefile:77: ../apu/apu.o] Error 1
make: *** Waiting for unfinished jobs....
x86_64-pc-linux-gnu-g++: error: gdb: No such file or directory
make: *** [Makefile:77: ../apu/bapu/dsp/sdsp.o] Error 1

It would be nice if this flag could be used with the build. Also note there are other -g..., flags, as well as -g...<level>.

Thanks!

@SoapGentoo
Copy link

SoapGentoo commented Jan 22, 2018

In general, the proper solution here is to use the AX_CHECK_ENABLE_DEBUG macro from the Autoconf archive before AC_PROG_CC, which only mucks with user flags if --enable-debug=yes is given to configure.

@bearoso
Copy link
Collaborator

bearoso commented May 7, 2018

Yeah, we shouldn't be messing with flags like that. I removed that block, and moved the user's flags to the end, so they take precedence.

@bearoso bearoso closed this as completed May 7, 2018
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

No branches or pull requests

3 participants