Skip to content

Commit

Permalink
Avoid bash\r with gitattributes eol (#2252)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Helveg authored Oct 2, 2024
1 parent 3f31da1 commit 6524ce7
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
arbor/include/git-source-id text eol=lf

0 comments on commit 6524ce7

Please sign in to comment.