From 6524ce770587d5a35edb5d114b13414712a0a5e2 Mon Sep 17 00:00:00 2001 From: Robin De Schepper Date: Wed, 2 Oct 2024 08:36:23 +0200 Subject: [PATCH] Avoid `bash\r` with gitattributes eol (#2252) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Building arbor on WSL from a clone checked out with Windows line endings causes the following error: ``` [ 0%] Generating _always_rebuild [ 2%] Generating version.hpp-test /usr/bin/env: ‘bash\r’: No such file or directory make[2]: *** [arbor/include/CMakeFiles/generate_version_hpp.dir/build.make:77: arbor/include/version.hpp-test] Error 127 make[2]: *** Deleting file 'arbor/include/version.hpp-test' make[1]: *** [CMakeFiles/Makefile2:1613: arbor/include/CMakeFiles/generate_version_hpp.dir/all] Error 2 make[1]: *** Waiting for unfinished jobs.... [ 2%] Building CXX object ext/units/units/CMakeFiles/units.dir/units.cpp.o [ 2%] Building CXX object ext/units/units/CMakeFiles/units.dir/commodities.cpp.o [ 4%] Building CXX object ext/units/units/CMakeFiles/units.dir/x12_conv.cpp.o [ 4%] Building CXX object ext/units/units/CMakeFiles/units.dir/r20_conv.cpp.o [ 4%] Linking CXX static library ../../../lib/libunits.a [ 4%] Built target units make: *** [Makefile:136: all] Error 2 ``` The shebang line in `arbor/include/git-source-id` of the following custom command is misinterpreted: ``` add_custom_command( OUTPUT version.hpp-test DEPENDS _always_rebuild COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/git-source-id ${FULL_VERSION_STRING} ${ARB_ARCH} ${arb_config_str} ${arb_features} > version.hpp-test ) ``` Prepending `bash` directly to the custom command seems to fix the problem. I don't know how to confirm whether the `version.hpp-test` mechanism still works as intended, so someone should probably review that. --- .gitattributes | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000000..d080e5c3b5 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +arbor/include/git-source-id text eol=lf