When trying to install tree-sitter-cpp (guix install ... or declared in
home.scm), I met this error:
```
starting phase `install'
src/scanner.c: In function ‘tree_sitter_cpp_external_scanner_serialize’:
src/scanner.c:126:5: error: implicit declaration of function ‘static_assert’
[-Wimplicit-function-declaration]
126 | static_assert(MAX_DELIMITER_LENGTH * sizeof(wchar_t) <
TREE_SITTER_SERIALIZATION_BUFFER_SIZE,
| ^~~~~~~~~~~~~
error: in phase 'install': uncaught exception:
%exception #<&invoke-error program: "g++" arguments: ("-shared" "-fPIC"
"-fno-exceptions" "-O2" "-g" "-o"
"/gnu/store/vl7gd09bq926v76627d4ahbpybsw3xg1-tree-sitter-cpp-0.23.4/lib/tree-sitter/libtree-sitter-cpp.so"
"-Isrc" "-xc" "-std=c99" "src/scanner.c" "-xc" "src/parser.c") exit-status: 1
term-signal: #f stop-signal: #f>
phase `install' failed after 2.2 seconds
command "g++" "-shared" "-fPIC" "-fno-exceptions" "-O2" "-g" "-o"
"/gnu/store/vl7gd09bq926v76627d4ahbpybsw3xg1-tree-sitter-cpp-0.23.4/lib/tree-sitter/libtree-sitter-cpp.so"
"-Isrc" "-xc" "-std=c99" "src/scanner.c" "-xc" "src/parser.c" failed with
status 1
build process 14 exited with status 256
```
Web searching leaded me to
https://github.com/tree-sitter/tree-sitter-cpp/issues/275#issuecomment-2294629789,
which told use C11 standard.
Then I proceeded to define a custom package, with some help from
chatGPT:
```scheme
(define-public my-tree-sitter-cpp
(package
(inherit tree-sitter-cpp) (name "my-tree-sitter-cpp")
(arguments
(substitute-keyword-arguments
(package-arguments tree-sitter-cpp)
((#:make-flags flags #~'())
#~(append (list (string-append "CXXFLAGS='-std=gnu++11'")) #$flags)))
;; ;; or literally:
;; '(#:make-flags ("CXXFLAGS='-std=c++11'") #:grammar-directories ("."))
)))
```
Then when running `guix home reconfigure/container`, another error
raises:
```
guix/ui.scm:2169:25: In procedure specification->package+output:
In procedure string-index-right: Wrong type argument in position 1 (expecting
string): #<package [email protected] my-modules/packages.scm:37
7f94888180b0>
```
OS: Arch Linux, with Guix manually installed.
Thank you for looking!
---
Daanturo.