drat
drat copied to clipboard
Wouldn't compile on M1 Mac
I'm trying this repo directly by git clone
. (https://github.com/jivanpal/drat/issues/52#issuecomment-1872546923_ )
I've installed all the requirements in README.md, yet I get this error:
GCHS +++ include/drat/argp.h +++ out/include/drat/argp.gch
gcc -std=c99 -D _GNU_SOURCE -Werror -Wall -Wextra -Wno-incompatible-pointer-types -Wno-multichar -Wno-unused-variable -Wno-unused-parameter -Wno-missing-field-initializers -I./include -I/usr/local/Cellar/argp-standalone/1.3/include/ -c "include/drat/argp.h" -o "out/include/drat/argp.gch"
include/drat/argp.h:6:10: error: 'argp.h' file not found with <angled> include; use "quotes" instead
#include <argp.h>
^~~~~~~~
"argp.h"
include/drat/argp.h:30:53: error: array has incomplete element type 'const struct argp_option'
extern const struct argp_option argp_options_globals[];
^
include/drat/argp.h:30:21: note: forward declaration of 'struct argp_option'
extern const struct argp_option argp_options_globals[];
^
include/drat/argp.h:31:1: error: unknown type name 'error_t'
error_t argp_parser_command(int key, char* arg, struct argp_state* state);
^
include/drat/argp.h:31:56: error: declaration of 'struct argp_state' will not be visible outside of this function [-Werror,-Wvisibility]
error_t argp_parser_command(int key, char* arg, struct argp_state* state);
^
include/drat/argp.h:32:1: error: unknown type name 'error_t'
error_t argp_parser_globals(int key, char* arg, struct argp_state* state);
^
include/drat/argp.h:32:56: error: declaration of 'struct argp_state' will not be visible outside of this function [-Werror,-Wvisibility]
error_t argp_parser_globals(int key, char* arg, struct argp_state* state);
^
include/drat/argp.h:35:45: error: array has incomplete element type 'const struct argp_child'
extern const struct argp_child argp_children[];
^
include/drat/argp.h:35:21: note: forward declaration of 'struct argp_child'
extern const struct argp_child argp_children[];
^
7 errors generated.
make: *** [out/include/drat/argp.gch] Error 1
I encountered the same issue because my homebrew path is different from the one specified in the Makefile (brew list argp-standalone
confirmed the include and library paths needed to be /opt/homebrew/...
instead of /usr/local/...
).
Other problems I encountered:
- variable 'val_end' set but not used in
commands/modify.c
andcommands/search.c
- declaration of
open_container__info_stream()
ininclude/drat/io.h
is missing the parameter (should beint open_container__info_stream(FILE* info_stream);
) - variable 'num_records' set but not used in
include/drat/print-fs-records.c
Resolving those issues, everything builds successfully (MacBook Air M1 2020, Sonoma 14.4) and drat inspect
confirms more or less the same APFS issues I have with diskutil verifyvolume
.
Thanks, this solved the issue. I've applied the changed you've suggested, and compiled like magic.
However, in my case drat inspect
did not work
baggeon-u@gunoos-MacBook-Pro-2 drat % ./drat inspect --container /dev/disk7s2
Opening `/dev/disk7s2` in read-only mode ... open_container__info_stream: ERROR: You do not have sufficient privileges to read this file.
baggeon-u@gunoos-MacBook-Pro-2 drat % sudo ./drat inspect --container /dev/disk7s2
Password:
Opening `/dev/disk7s2` in read-only mode ... open_container__info_stream: ERROR: Unknown error.
This may be another issue, not related to the original compile issue.
Opening `/dev/disk7s2` in read-only mode ... open_container__info_stream: ERROR: You do not have sufficient privileges to read this file.
You'll need to run as root to have full access to the disk (sudo ./drat inspect ...
)