Conversation
…init-linux*. Add libbsd to MAIKO_LIBRARIES (where appropriate) in CMakeLists.txt. This will support building maiko on Ubuntu 22.04 and Debian 12, where strlcat is found only in libbsd. For Ubuntu 24.04 and beyond and Debian 13 and beyond, strlcat is now in glibc (>2.38).
…on systems with glibc <2.38 (e.g., Ubuntu 22.04 and Debian 12).
…file as well as common makefiles for X and sdl. These included makefiles have the name linux-*.mk. Updated all linux makefiles to use the libbsd-overlay package, using pkg-config to set the appropriate flags. Updated CMakelists to also use the libbsd-overlay package via pkgconfig for Linux only. Finally added install targets to the CMakelists file so that cmake --install . will place the lde binaries into the appropriate directory in maiko as the makefiles currently do.
… be used by libbsd changes to linux makefiles
… depending on whats installed. Refactored Linux makefiles to simplify top level makefiles with slightly more complicated common makefiles. Makefiles for Cygwin and WSL1 all rewritten to use the common linux makefiles code.
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly refactors the build system by introducing a common set of Makefile includes for Linux-based environments, including Cygwin and WSL1. This change centralizes compiler selection, library dependencies, and display-specific options, reducing redundancy and simplifying maintenance across various Linux, Cygwin, and WSL1 build configurations. Additionally, the CMake build configuration was updated to properly link with 'libbsd-overlay' on Linux and to define installation targets. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Ignored Files
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request refactors the various Linux, Cygwin, and WSL1 makefiles to use a common set of included makefiles, reducing code duplication and improving maintainability. It also introduces some changes to CMakeLists.txt to add installation targets and handle Linux-specific libraries. The refactoring is a good improvement, but I've found a few issues that need to be addressed to ensure the build system is correct and robust. I've identified a critical bug in one of the makefiles using the wrong architecture flag, and a couple of high-severity issues related to linking and path robustness in the build scripts.
bin/makefile-linux.386-sdl
Outdated
| GCC_CFLAGS := -m64 $(GCC_CFLAGS) | ||
| CLANG_CFLAGS := -m64 $(CLANG_CFLAGS) |
There was a problem hiding this comment.
This makefile is for the 386 (i.e., 32-bit x86) architecture, but GCC_CFLAGS and CLANG_CFLAGS are being set with the -m64 flag, which is for the 64-bit architecture. This will result in a build for the wrong architecture. The flag should be -m32.
GCC_CFLAGS := -m32 $(GCC_CFLAGS)
CLANG_CFLAGS := -m32 $(CLANG_CFLAGS)
| execute_process( | ||
| COMMAND sh -c "echo $(../bin/osversion).$(../bin/machinetype)" | ||
| OUTPUT_VARIABLE release_dir | ||
| WORKING_DIRECTORY ${CMAKE_BINARY_DIR} | ||
| OUTPUT_STRIP_TRAILING_WHITESPACE | ||
| ) |
There was a problem hiding this comment.
The execute_process command uses relative paths like ../bin/osversion. This approach is not robust for out-of-source builds, where the build directory is not a direct subdirectory of the source root, and will cause the build to fail in such standard setups. You should use absolute paths constructed with CMAKE_SOURCE_DIR to make the command reliable regardless of the build directory location.
execute_process(
COMMAND sh -c "echo $(${CMAKE_SOURCE_DIR}/bin/osversion).$(${CMAKE_SOURCE_DIR}/bin/machinetype)"
OUTPUT_VARIABLE release_dir
OUTPUT_STRIP_TRAILING_WHITESPACE
)
bin/linux-common.mk
Outdated
| DFLAGS = $(XFLAGS) -DRELEASE=$(RELEASE) $(BSD_CFLAGS) $(ADDITIONAL_DFLAGS) | ||
|
|
||
| LDFLAGS = $(XLDFLAGS) -lc -lm $(BSD_LDFLAGS) | ||
| LDELDFLAGS = $(XLDFLAGS) -lc -lm $(BSD_LDFLAGS) |
There was a problem hiding this comment.
The LDELDFLAGS variable is being set to include $(XLDFLAGS). When building with SDL (USE_DISPLAY=sdl), XLDFLAGS contains SDL-related linker flags. The lde executable, which is linked using LDELDFLAGS, does not use SDL and should not be linked against SDL libraries. This will likely cause build failures. LDELDFLAGS should only include X11 flags when USE_DISPLAY=x.
ifeq ($(USE_DISPLAY),x)
LDELDFLAGS = $(XLDFLAGS) -lc -lm $(BSD_LDFLAGS)
else
LDELDFLAGS = -lc -lm $(BSD_LDFLAGS)
endif
nbriggs
left a comment
There was a problem hiding this comment.
Gemini is correct that bin/makefile-linux.386-SDL must have "-m32" not "-m64" for the 32-bit 386 build.
…king to libbsd (if requested) only if glibc < version 2.38 since glibc >= 2.38 includes strlcat and friends.
|
It builds and works with no issues on Linux Mint 22.1 Cinnamon. |
|
Merged into PR 544 (fgh_redo-linux-makefiles branch). Closing without merge to master. |
This PR does three things:
Slightly update the Linux makefiles that use the common included makefiles scheme implemented in PR Update linux makefiles to 1) use libbsd-overlay and 2) isolate common code from linux makefiles into included makefiles. And update Cmakelists to use libbsd-overlay package in case of Linux; Update Cmakelists to include an install target similar to that used in the makefiles. #542
Apply the updated common included makefiles scheme to the Cygwin and WSL1 makefiles - since they are essentially the same as the Linux makefiles.
Update all github workflows to use the latest versions of github actions to account for the impending deprecation of Node 20.