-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Create proper debug configuration #6193
base: master
Are you sure you want to change the base?
Conversation
for at least spk/ffmpeg To check against https://github.com/icegood/spksrc/tree/fix/libpng_debug_builds at it fixes png bug Applicable for issue SynoCommunity#6176 Signed-off-by: Serhii Ivanov <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First off, thnx a lot for your contribution. You actually went quite a bit into the weeds in here, well done. You'll find a a few questions, suggestions & changes proposed part of my review.
CONFIGURE_ARGS += --extra-cflags="-I$(WORK_DIR)/install$(INSTALL_PREFIX)/include" | ||
CONFIGURE_ARGS += --extra-ldflags="-L$(WORK_DIR)/install$(INSTALL_PREFIX)/lib" | ||
CONFIGURE_ARGS += --extra-libs="-lxml2 -ldl -lm" --pkg-config=/usr/bin/pkg-config --ranlib=$(RANLIB) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code dates way-back, before I started maintaining ffmpeg. Why is only pkg-config related code kept?
@@ -19,7 +19,6 @@ GNU_CONFIGURE = 1 | |||
CONFIGURE_ARGS = --enable-shared | |||
CONFIGURE_ARGS += --enable-pic | |||
CONFIGURE_ARGS += --disable-opencl | |||
CONFIGURE_ARGS += --prefix=$(INSTALL_PREFIX) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is the prefix being removed? Presumably because the spksrc.configure.mk adds it anyway?
CMAKE_ARGS += -DCMAKE_BUILD_TYPE=Debug | ||
endif | ||
CMAKE_ARGS += -DCMAKE_BUILD_TYPE=Release |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't this be ifeq / else / endif such as:
ifeq ($(strip $(CMAKE_BUILD_TYPE)),)
ifeq ($(strip $(GCC_DEBUG_INFO)),1)
CMAKE_ARGS += -DCMAKE_BUILD_TYPE=Debug
else
CMAKE_ARGS += -DCMAKE_BUILD_TYPE=Release
endif
else
CMAKE_ARGS += -DCMAKE_BUILD_TYPE=$(CMAKE_BUILD_TYPE)
endif
ADDITIONAL_CFLAGS := $(patsubst -O%,,$(ADDITIONAL_CFLAGS)) | ||
ADDITIONAL_CPPFLAGS := $(patsubst -O%,,$(ADDITIONAL_CPPFLAGS)) | ||
ADDITIONAL_CXXFLAGS := $(patsubst -O%,,$(ADDITIONAL_CXXFLAGS)) | ||
ifeq ($(strip $(GCC_DEBUG_INFO)),1) | ||
GCC_DEBUG_FLAGS = -O0 -g3 | ||
ADDITIONAL_CFLAGS := $(patsubst -O%,,$(ADDITIONAL_CFLAGS)) $(GCC_DEBUG_FLAGS) | ||
ADDITIONAL_CPPFLAGS := $(patsubst -O%,,$(ADDITIONAL_CPPFLAGS)) $(GCC_DEBUG_FLAGS) | ||
ADDITIONAL_CXXFLAGS := $(patsubst -O%,,$(ADDITIONAL_CXXFLAGS)) $(GCC_DEBUG_FLAGS) | ||
# other options to consider: | ||
#GCC_DEBUG_FLAGS += -fsanitize=address -fsanitize=undefined -fstack-protector-all | ||
GCC_DEBUG_FLAGS = -ggdb3 -g3 | ||
else | ||
GCC_DEBUG_FLAGS = -O3 -fomit-frame-pointer | ||
endif | ||
ADDITIONAL_CFLAGS := $(ADDITIONAL_CFLAGS) $(GCC_DEBUG_FLAGS) | ||
ADDITIONAL_CPPFLAGS := $(ADDITIONAL_CPPFLAGS) $(GCC_DEBUG_FLAGS) | ||
ADDITIONAL_CXXFLAGS := $(ADDITIONAL_CXXFLAGS) $(GCC_DEBUG_FLAGS) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has a much broader effect than only affecting debug builds. This is turn will enforce using -O3 -fomit-frame-pointer
on all buids, which will not work due to some arch specific caveats that requires special flags to be used. GCC_DEBUG_FLAGS should only be used for GCC_DEBUG_INFO builds and not be affecting other regular builds.
Also I believe this sort of explains the reasons for removing -O?
in some other Makefiles?
echo TC_ENV += CFLAGS=\"$(CFLAGS) $(GCC_DEBUG) $$\(ADDITIONAL_CFLAGS\)\" ; \ | ||
echo TC_ENV += CPPFLAGS=\"$(CPPFLAGS) $(GCC_DEBUG) $$\(ADDITIONAL_CPPFLAGS\)\" ; \ | ||
echo TC_ENV += CXXFLAGS=\"$(CXXFLAGS) $(GCC_DEBUG) $$\(ADDITIONAL_CXXFLAGS\)\" ; \ | ||
echo TC_ENV += CFLAGS=\"$(CFLAGS) $$\(ADDITIONAL_CFLAGS\)\" ; \ | ||
echo TC_ENV += CPPFLAGS=\"$(CPPFLAGS) $$\(ADDITIONAL_CPPFLAGS\)\" ; \ | ||
echo TC_ENV += CXXFLAGS=\"$(CXXFLAGS) $$\(ADDITIONAL_CXXFLAGS\)\" ; \ | ||
echo TC_ENV += LDFLAGS=\"$(LDFLAGS) $$\(ADDITIONAL_LDFLAGS\)\" ; \ | ||
echo TC_ENV += CARGO_HOME=\"$(realpath $(CARGO_HOME))\" ; \ | ||
echo TC_ENV += RUSTUP_HOME=\"$(realpath $(RUSTUP_HOME))\" ; \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't thig be GCC_DEBUG_FLAGS
?
echo TC_TARGET := $(TC_TARGET) ; \ | ||
echo TC_PREFIX := $(TC_PREFIX) ; \ | ||
echo TC_PATH := $(WORK_DIR)/$(TC_TARGET)/bin/ ; \ | ||
echo CFLAGS := $(CFLAGS) $(GCC_DEBUG) $$\(ADDITIONAL_CFLAGS\) ; \ | ||
echo CPPFLAGS := $(CPPFLAGS) $(GCC_DEBUG) $$\(ADDITIONAL_CPPFLAGS\) ; \ | ||
echo CXXFLAGS := $(CXXFLAGS) $(GCC_DEBUG) $$\(ADDITIONAL_CXXFLAGS\) ; \ | ||
echo CFLAGS := $(CFLAGS) $$\(ADDITIONAL_CFLAGS\) ; \ | ||
echo CPPFLAGS := $(CPPFLAGS) $$\(ADDITIONAL_CPPFLAGS\) ; \ | ||
echo CXXFLAGS := $(CXXFLAGS) $$\(ADDITIONAL_CXXFLAGS\) ; \ | ||
echo LDFLAGS := $(LDFLAGS) $$\(ADDITIONAL_LDFLAGS\) ; \ | ||
echo TC_INCLUDE := $(TC_INCLUDE) ; \ | ||
echo TC_LIBRARY := $(TC_LIBRARY) ; \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
likewise to previous comment.
With this PR it is easier to create more rigorous debug builds for further debugging in gdb.
(for at least spk/ffmpeg)
Not applicable out of the box since other dependant repos need to be fit as well.
To check against
https://github.com/icegood/spksrc/tree/fix/libpng_debug_builds at it fixes png bug
Applicable for issue #6176
Description
Fixes #
Checklist
all-supported
completed successfullyType of change