CobbCoding1 / Cano

Text Editor Written In C Using ncurses
Apache License 2.0
63 stars 12 forks source link

Nix build is failling #27

Closed Sigmanificient closed 5 months ago

Sigmanificient commented 5 months ago

Hi, I couldn't build the binary using the provided default.nix file. From the following logs of nix-build, it seems that lib math is missing, causing the problem:

this derivation will be built:
  /nix/store/2mksnw6mbf06qmbz17n5wiqjiynls03v-cano.drv
building '/nix/store/2mksnw6mbf06qmbz17n5wiqjiynls03v-cano.drv'...
unpacking sources
unpacking source archive /nix/store/6cfhwy4941j6gkz2nlm6lazz4v2p5di3-Cano
source root is Cano
building
In file included from src/main.c:17:
src/lex.c: In function 'read_file_to_str':
src/lex.c:112:5: warning: ignoring return value of 'fread' declared with attribute 'warn_unused_result' [8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wunused-result-Wunused-result8;;]
  112 |     fread(*contents, 1, length, file);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/lex.c: In function 'read_file_by_lines':
src/lex.c:360:5: warning: ignoring return value of 'fread' declared with attribute 'warn_unused_result' [8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wunused-result-Wunused-result8;;]
  360 |     fread(contents, 1, length, file);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/main.c: In function 'read_file_to_buffer':
src/main.c:693:5: warning: ignoring return value of 'fread' declared with attribute 'warn_unused_result' [8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wunused-result-Wunused-result8;;]
  693 |     fread(buf, sizeof(char)*length, 1, file);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/main.c:684:5: warning: '__builtin_strncpy' output truncated before terminating nul copying as many bytes from a string as its length [8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wstringop-truncation-Wstringop-truncation8;;]
  684 |     strncpy(buffer->filename, filename, filename_s);
      |     ^
src/main.c:682:25: note: length computed here
  682 |     size_t filename_s = strlen(filename);
      |                         ^~~~~~~~~~~~~~~~
src/main.c: In function 'main':
src/main.c:1427:31: warning: array subscript 'char *[0]' is partly outside array bounds of 'unsigned char[2]' [8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Warray-bounds-Warray-bounds8;;]
 1427 |             Command command = parse_command(lines[i], strlen(lines[i]));
      |                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/main.c:1422:20: note: object of size 2 allocated by 'malloc'
 1422 |     char **lines = malloc(sizeof(char)*2);
      |                    ^~~~~~~~~~~~~~~~~~~~~~
src/main.c:1429:13: warning: array subscript 'char *[0]' is partly outside array bounds of 'unsigned char[2]' [8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Warray-bounds-Warray-bounds8;;]
 1429 |             free(lines[i]);
      |             ^~~~~~~~~~~~~~
src/main.c:1422:20: note: object of size 2 allocated by 'malloc'
 1422 |     char **lines = malloc(sizeof(char)*2);
      |                    ^~~~~~~~~~~~~~~~~~~~~~
/nix/store/3r87a2wq1w4l66wnsm7rqvy608mx23h6-binutils-2.40/bin/ld: /build/ccoPL7LH.o: in function `main':
main.c:(.text.startup+0x4c3): undefined reference to `log10'
collect2: error: ld returned 1 exit status
error: builder for '/nix/store/2mksnw6mbf06qmbz17n5wiqjiynls03v-cano.drv' failed with exit code 1;
       last 10 log lines:
       >       |                    ^~~~~~~~~~~~~~~~~~~~~~
       > src/main.c:1429:13: warning: array subscript 'char *[0]' is partly outside array bounds of 'unsigned char[2]' [8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Warray-bounds-Warray-bounds8;;]
       >  1429 |             free(lines[i]);
       >       |             ^~~~~~~~~~~~~~
       > src/main.c:1422:20: note: object of size 2 allocated by 'malloc'
       >  1422 |     char **lines = malloc(sizeof(char)*2);
       >       |                    ^~~~~~~~~~~~~~~~~~~~~~
       > /nix/store/3r87a2wq1w4l66wnsm7rqvy608mx23h6-binutils-2.40/bin/ld: /build/ccoPL7LH.o: in function `main':
       > main.c:(.text.startup+0x4c3): undefined reference to `log10'
       > collect2: error: ld returned 1 exit status
       For full logs, run 'nix log /nix/store/2mksnw6mbf06qmbz17n5wiqjiynls03v-cano.drv'.