Ignalina/alloy

make build-all; unknown type name 'ArrowSchema'

Closed this issue · 6 comments

It seems that we have some syntax error or missing information in the C header. I get the same error on 3 different machines [Kubuntu x64_64 GNU/Linux, raspberrypi armv7l GNU/Linux, Ubuntu22.04 WSL2].

eli@CONSTELLATION:~/Coding/alloy$ make
    Finished release [optimized] target(s) in 0.04s
go build ./...
go: downloading github.com/apache/arrow/go/v9 v9.0.0
go: downloading golang.org/x/sys v0.0.0-20220412211240-33da011f77ad
go: downloading golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f
# github.com/ignalina/alloy/api
api/call_impl.go:24:2: could not determine kind of name for C.callwithtable
cgo:
gcc errors for preamble:
In file included from api/call_impl.go:11:
./../lib/impl.h:5:20: error: unknown type name 'ArrowSchema'
    5 | void callwithtable(ArrowSchema *schema);
      |                    ^~~~~~~~~~~

make: *** [Makefile:12: build-go] Error 2

Will look into resolving this with the C header file definition.

I resolved ( i think the specific error is resolved ) the "unknown type name 'ArrowSchema'" by defining the ArrowSchema struct as a `typedef.

typedef struct {
  // Array type description
  const char* format;
  const char* name;
  const char* metadata;
  int64_t flags;
  int64_t n_children;
  struct ArrowSchema** children;
  struct ArrowSchema* dictionary;

  // Release callback
  void (*release)(struct ArrowSchema*);
  // Opaque producer-specific data
  void* private_data;
} ArrowSchema;

typedef struct {
  // Array data description
  int64_t length;
  int64_t null_count;
  int64_t offset;
  int64_t n_buffers;
  int64_t n_children;
  const void** buffers;
  struct ArrowArray** children;
  struct ArrowArray* dictionary;

  // Release callback
  void (*release)(struct ArrowArray*);
  // Opaque producer-specific data
  void* private_data;
} ArrowArray;

However, now I get another error:

eli@CONSTELLATION:~/Coding/alloy$ make
    Finished release [optimized] target(s) in 0.04s
go build ./...
# github.com/ignalina/alloy/api
api/call_impl.go:24:46: cannot use _cgo0 (variable of type *arrow.Schema) as type *_Ctype_struct___0 in argument to _Cfunc_Callwithtable
make: *** [Makefile:12: build-go] Error 2

It builds!! Yay 🥲

Please see latest commit to main (#17) which fixes build issues. BOTH GO AND RUST SHOULD BUILD. However, the workflow fails... Could be that the checkout is incorrect Go version or something...

Closing issue. It was resolved with (#17). Open new issue for failing go build in the workflow.