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

libparquet-glib-dev: no definition of struct _GArrowArrayBuilderClass #242

Open
andre2007 opened this issue Feb 12, 2020 · 5 comments
Open

Comments

@andre2007
Copy link

andre2007 commented Feb 12, 2020

If have this dockerfile

###############################################################################
## Base image
FROM debian:stretch as base

COPY install.sh /
RUN /install.sh

###############################################################################
## Ldc image
FROM dlang2/ldc-ubuntu:1.19.0 as ldc

RUN apt-get install -y clang-9 libclang-9-dev
RUN ln -s /usr/bin/clang-9 /usr/bin/clang
COPY parquet.dpp /tmp/

COPY --from=base /usr/include/glib-2.0 /usr/include/glib-2.0
COPY --from=base /usr/lib/x86_64-linux-gnu/glib-2.0/include /usr/lib/x86_64-linux-gnu/glib-2.0/include
COPY --from=base /usr/include/arrow-glib /usr/include/arrow-glib
COPY --from=base /usr/include/parquet-glib /usr/include/parquet-glib

COPY --from=base /usr/lib/x86_64-linux-gnu/libparquet-glib.so /usr/lib/x86_64-linux-gnu/libparquet-glib.so
COPY --from=base /usr/lib/x86_64-linux-gnu/libarrow.so /usr/lib/x86_64-linux-gnu/libarrow.so
COPY --from=base /usr/lib/x86_64-linux-gnu/libgobject-2.0.so /usr/lib/x86_64-linux-gnu/libgobject-2.0.so

RUN DFLAGS="-L=-L/usr/lib/llvm-9/lib/" dub run dpp -- /tmp/parquet.dpp \
    --include-path /usr/include/glib-2.0 \
    --include-path /usr/lib/x86_64-linux-gnu/glib-2.0/include \
    --include-path /usr/include/arrow-glib \
    --include-path /usr/include/parquet-glib \
    --preprocess-only

COPY app.d /tmp/
RUN DFLAGS="-L=-L/usr/lib/x86_64-linux-gnu/" ldc2 /tmp/app.d /tmp/parquet.d -of=/tmp/app

Script install.sh looks like this

apt-get update && apt-get install -y -V lsb-release wget
if [ $(lsb_release --codename --short) = "stretch" ]; then
  tee /etc/apt/sources.list.d/backports.list <<APT_LINE
deb http://deb.debian.org/debian $(lsb_release --codename --short)-backports main
APT_LINE
fi
wget https://apache.bintray.com/arrow/$(lsb_release --id --short | tr 'A-Z' 'a-z')/apache-arrow-archive-keyring-latest-$(lsb_release --codename --short).deb
apt install -y -V ./apache-arrow-archive-keyring-latest-$(lsb_release --codename --short).deb
apt update && apt install -y -V libparquet-glib-dev

parquet.dpp looks like this

#include <parquet-glib/arrow-file-reader.h>
#include <parquet-glib/arrow-file-writer.h>

app.d is just

import parquet;
pragma(lib, "parquet-glib");
void main(){}

LDC fails with:

/tmp/parquet.d(226): Error: variable parquet._GArrowBooleanArrayBuilderClass.parent_class no definition of struct _GArrowArrayBuilderClass
... a lot more error messages like this ...
The command '/bin/sh -c DFLAGS="-L=-L/usr/lib/x86_64-linux-gnu/" ldc2 /tmp/app.d /tmp/parquet.d -of=/tmp/app' returned a non-zero code: 1

This is somehow strange, because can see it is defined:

image

@andre2007
Copy link
Author

I used dustmite to reduce the problem. This is the reduced testcase

File app.d

struct _GArrowArrayBuilderClass;
struct _GArrowBooleanArrayBuilderClass
{
    _GArrowArrayBuilderClass parent_class;
}

void main(){}

It throws the syntax error:

app.d(4): Error: variable app._GArrowBooleanArrayBuilderClass.parent_class no definition of struct _GArrowArrayBuilderClass

@atilaneves
Copy link
Owner

Thanks for the reduced code. That is not valid D, and I have to investigate why dpp is generating that code, especially since it's not valid C either

@ananis25
Copy link

Hi @andre2007 - did you manage to find a way around this? I don't see clearly why this is not valid C/D code.

@andre2007
Copy link
Author

@ananis25
Yes, as far as I remember I had to manually adapt a lot of struct definitions from e.g.
struct​ ​_GArrowArrayBuilderClass​;
To
struct​ ​_GArrowArrayBuilderClass{}​;

@ananis25
Copy link

Thank you @andre2007 , I can now get a simple array builder working. I couldn't really see how are opaque structs are represented.

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

3 participants