Fix build dependencies and compiler warnings on Ubuntu 24.04#1
Open
SerErris wants to merge 1 commit into
Open
Conversation
…ild logic Description: This commit addresses several stability and build-system issues discovered on Ubuntu 24.04: src/files.c: Fixed a segmentation fault occurring during file handling/pointer dereferencing. src/gettext.h: Resolved compiler warnings by ensuring macro definitions don't conflict with system headers. CMakeLists.txt: Improved libintl recognition to ensure translations link correctly on modern Linux distributions. Added an explicit dependency for the test suite. Previously, tests would attempt to run before the z80asm binary was actually compiled, leading to Error 127.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed Changes: Fix Build Dependencies, gettext Warnings, and Segfault
This PR addresses several issues encountered when building and testing on Ubuntu 24.04. The changes focus on build system reliability and modern compiler compatibility.
1. Build System: Explicit Dependency for Tests
Issue: When running a parallel build or calling
make all, the test targets (e.g.,pass_test) were attempted before thez80asmbinary was actually compiled. This resulted inError 127because the shell could not find the executable in the build directory.Fix: Updated
CMakeLists.txtto ensure that all test targets explicitly depend on thez80asmexecutable target. This guarantees the binary is physically present before the test suite enters the Trugraum of execution.2. CMake: Improved libintl Detection
Issue: On modern Linux systems,
libintlis often built directly intoglibcrather than existing as a separate library file. The previous CMake configuration failed to recognize this, leading to linking issues.Fix: Modified
CMakeLists.txtto use a more robust detection method that checks if the required internationalization symbols are available in the standard library before attempting to link an externalintllibrary.3. Compiler Warnings: gettext.h Refactoring
Issue: The macro definitions in
include/gettext.hforbindtextdomainandtextdomainwere casting arguments to(const char *)without a consuming operation. Modern GCC/Clang compilers flag this with-Wunused-valuewarnings (e.g., “statement with no effect”).Fix: Refactored the fallback macros in
include/gettext.hto remove the unnecessary return-value casts when NLS (Native Language Support) is disabled. This cleans up the build log and allows for stricter "Warnings-as-Errors" configurations.4. Stability: files.c Segmentation Fault
Issue: Fixed a segmentation fault occurring during specific file access patterns.
Fix: Added null-pointer checks and sanitized pointer dereferences in
src/files.cto prevent the application from crashing during file I/O operations.Verification
makenow correctly builds thez80asmbinary before executing the test suite, resolving the previous file-not-found errors.libintl.Build and Test Log: