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

C executable build failure on ARM Mac #19

Open
stenczelt opened this issue Jun 27, 2024 · 5 comments
Open

C executable build failure on ARM Mac #19

stenczelt opened this issue Jun 27, 2024 · 5 comments

Comments

@stenczelt
Copy link
Member

I've tried to make and run the C executable on an ARM Mac, and got the following errors:

make: Entering directory '/Users/tks32/[..path..]/extxyz/libextxyz'
cc -I/opt/homebrew/Cellar/pcre2/10.44/include -I/opt/homebrew/Cellar/pcre2/10.44/include -I../libcleri/inc -g -c test_C_main.c -o test_C_main.o
test_C_main.c:17:70: error: too few arguments to function call, expected 7, have 5
    int success = extxyz_read_ll(kv_grammar, fp, &nat, &info, &arrays);
                  ~~~~~~~~~~~~~~                                     ^
./extxyz.h:71:5: note: 'extxyz_read_ll' declared here
int extxyz_read_ll(cleri_grammar_t *kv_grammar, FILE *fp, int *nat, DictEntry **info, DictEntry **arrays, char *comment, char *error_message);
    ^
1 error generated.
make: *** [Makefile:49: test_C_main.o] Error 1
make: Leaving directory '/Users/tks32/[..path..]/extxyz/libextxyz'

Prior to this, I've installed pcre2 with brew and built the library itself with make -C libextxyz install_libcleri install.

@stenczelt
Copy link
Member Author

p.s. CC version:

Apple clang version 15.0.0 (clang-1500.3.9.4)
Target: arm64-apple-darwin23.5.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

@stenczelt
Copy link
Member Author

when adding variables to capture the last two args of extxyz_read_ll then it's complaining about looking for a static library rather than dynamic ones when linking:

ld: library '../libcleri/Release/libcleri.a' not found

@jameskermode
Copy link
Member

The missing arguments are indeed due to a change in the library interface that has not been reflected in the example. If you could make a PR with your changes that would be great. I can look at #20 next.

@stenczelt
Copy link
Member Author

I've found some interesting things when writing #21, both on MacOS (ARM) and ubuntu (using docker on the same Mac)

  1. libcleri.a is only built by setup.py creating an additional makefile at libcleri/Release/makefile.extxyz - this is not explained anywhere, and the makefile is not doing it, so if you are installing without Python this does not happen and can be confusing
  2. since libcleri is not built by just running the default targets of the makefile, if you follow the steps from the readme, you run into issues. I'd just add libcleri to be ran with the libextxyz.${dlext} target.

@jameskermode
Copy link
Member

This is primarily a documentation issues. libcleri is an external dependency which we include as a submodule here for convenience, which is why the extra makefile is needed. Would be find to add the Makefile target you suggest, PR welcome.

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