residuum/PuRestJson

error: implicit declaration of function 'error' is invalid in C99

Closed this issue · 6 comments

when compiling on intel Mac:

In file included from src/json-encode.c:38:
src/inc/kvp.c:160:2: error: implicit declaration of function 'error' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
MYASSERT(kvp->is_array != 1 || is_array != 1, "This should not be called: array values should be appended, not replaced.");
^
src/purest_json.h:47:9: note: expanded from macro 'MYASSERT'
MYERROR(VA_ARGS);
^
src/purest_json.h:35:23: note: expanded from macro 'MYERROR'
#define MYERROR(...) error(VA_ARGS)
^
src/json-encode.c:134:5: error: implicit declaration of function 'error' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
MYERROR("What other JSON type?");
^
src/purest_json.h:35:23: note: expanded from macro 'MYERROR'
#define MYERROR(...) error(VA_ARGS)
^
6 errors generated.
make: *** [src/json-encode.o] Error 1

What source version are you using? The macro MYERROR() has been removed and replaced by pd_error() with d8591fc

My mistake, was 1.4.3 from releases.

could you help with this error? Mac m1

++++ info: linking objects in json-encode.pd_darwin for lib purest_json
cc -undefined suppress -flat_namespace -bundle -arch x86_64 -arch arm64 -mmacosx-version-min=10.6 -o json-encode.pd_darwin src/json-encode.o -lc -lcurl -ljson-c -loauth
ld: library not found for -ljson-c
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [json-encode.pd_darwin] Error 1

That is something I am trying to figure out, i.e. the whole packaging process. That would then yield a new release, but I have made no real progress since June.

One step would be to use the code from pd-lib-builder: https://git.iem.at/pd/iem-ci/-/tree/main/pd-lib-builder

But linking dependencies on Mac M1 is still unsolved for me: https://lists.puredata.info/pipermail/pd-dev/2022-06/023085.html

It would be great if you could help me figure out a solution to this problem, as I do not have a Mac here, and all I can do is getting the code to compile on a Circle-CI: https://app.circleci.com/pipelines/github/residuum/PuRestJson

I glad to help, but I'm very newbie to C.
when I compiling looks like it searches in directories pre-designated by the compiler, but can't find my dependancies installed by homebrew. So I had to manually add required libs to main folder and change #include < > to " ". I guess something still missing.

it's in /opt/homebrew

Compilation on m1 is resolved here:

#69 (comment)