libAtoms/extxyz

C executable build failure on ARM Mac

stenczelt opened this issue · 5 comments

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.

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

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

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.

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.

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.