Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wouldn't compile on M1 Mac #80

Open
guntgbtgv opened this issue Mar 12, 2024 · 3 comments
Open

Wouldn't compile on M1 Mac #80

guntgbtgv opened this issue Mar 12, 2024 · 3 comments

Comments

@guntgbtgv
Copy link

guntgbtgv commented Mar 12, 2024

I'm trying this repo directly by git clone. (#52 (comment)_ )
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


@stephanmantler
Copy link

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 and commands/search.c
  • declaration of open_container__info_stream() in include/drat/io.h is missing the parameter (should be int open_container__info_stream(FILE* info_stream);)
  • variable 'num_records' set but not used in include/drat/print-fs-records.c

Minimum effort patchfile

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.

@guntgbtgv
Copy link
Author

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.

@stephanmantler
Copy link

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 ...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants