Build error occurred; My prior commit broke the build commands. - #268
Closed
Blake-sama wants to merge 1 commit into
Closed
Build error occurred; My prior commit broke the build commands.#268Blake-sama wants to merge 1 commit into
Blake-sama wants to merge 1 commit into
Conversation
… on the main GitHub page because my commit contained "" marks. These two adjustments to CMakeLists.txt resolve this by escaping "" marks in commit messages.
Contributor
Author
|
Wait . . . I broke something & made a pull request too early, brb! |
Member
|
huh ok |
Contributor
Author
|
Give me like ten seconds. I'm really sorry, I'm still learning git and tl;dr I fixed this in the main repo (no perms), went and updated my fork with the same fix, but um, my fork didn't build correctly, so now I need to check what I did different. |
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.
Using these build commands found on the main page of the repo:
cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr -S . -B ./build
cmake --build ./build --config Release --target hyprpaper -jnproc 2>/dev/null || getconf _NPROCESSORS_CONF
I caused this error when building:
/home/blake-sama/Developer/hyprpaper/src/main.cpp: In function ‘int main(int, char**, char**)’:
: error: unable to find string literal operator ‘operator""source’ with ‘const char [19]’, ‘long unsigned int’ arguments
/home/blake-sama/Developer/hyprpaper/src/main.cpp:6:90: note: in expansion of macro ‘GIT_COMMIT_MESSAGE’
6 | Debug::log(LOG, "Welcome to hyprpaper!\nbuilt from commit {} ({})", GIT_COMMIT_HASH, GIT_COMMIT_MESSAGE);
| ^~~~~~~~~~~~~~~~~~
make[3]: *** [CMakeFiles/hyprpaper.dir/build.make:205: CMakeFiles/hyprpaper.dir/src/main.cpp.o] Error 1
make[3]: *** Waiting for unfinished jobs....
make[2]: *** [CMakeFiles/Makefile2:87: CMakeFiles/hyprpaper.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:94: CMakeFiles/hyprpaper.dir/rule] Error 2
make: *** [Makefile:189: hyprpaper] Error 2
After ChatGPT'ing the error, when the build tried to compile, it detected a bad commit message. Well, that's because the most recent commit to the project was mine which had "source=" in the commit message. It failed to read the "" marks in my commit message correctly, breaking the compiler's ability to build hyprpaper.
I'm also not very great at explaining so here's ChatGPT expressing what this fix does:
"The fix I added ensures that any " characters in the commit message are escaped ("), so that when the macro is expanded into C++, it stays within the bounds of a valid string literal. This prevents the preprocessor from misinterpreting the contents of commit messages."
tl;dr I'm sorry I broke the build with a bad commit message, lesson learned . . . don't use "" marks in commits.