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

Add new preset for libecl library #947

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open

Conversation

matteodg
Copy link
Member

I started to add the files to add libecl as another preset in JavaCPP Presets.

I'm not a C/C++ expert, but I managed to have something working, I still have not reach the point to completely compile the jnilibecl library though... I need some help.

@saudet
Copy link
Member

saudet commented Sep 22, 2020

What's the error that you're getting?

@matteodg
Copy link
Member Author

OK, sorry for the delay, I tried to better organize the commits to clarify the steps I took.

First I got a bunch of "illegal forward reference" on the generated javacpp-presets/libecl/src/gen/java/org/bytedeco/libecl/global/libecl.java.
Thus I topologically sorted all include files, so they were in the expected order and I commented out the basic includes like "stdio.h", etc. and some include that does not exist... I needed to add some "private" include paths at runtime too.

Then I started fixing issues, so at the end I was able to compile the generated libecl.java.
In the last commit you find all the generated .java files.

Now I got a lot of errors compiling jnilibecl.cpp: partially due not to the jnilibecl.cpp itself, but to the include files of libecl, and other errors I really do not know how to fix...

Here is the latest output:
maven-build.txt

And here is the generated jnilibecl.cpp:
jnilibecl.cpp.txt

Let me know if you need something else, thanks in advance for any help!

@saudet
Copy link
Member

saudet commented Sep 24, 2020

In file included from /home/matteo/code/javacpp-presets/current/libecl/target/native/org/bytedeco/libecl/linux-x86_64/jnilibecl.cpp:184:
/home/matteo/code/javacpp-presets/current/libecl/cppbuild/linux-x86_64/include/ert/ecl/ecl_kw_grdecl.hpp:35:3: error: ‘ecl_kw_type’ does not name a type
   35 |   ecl_kw_type  *  ecl_kw_fscanf_alloc_grdecl_dynamic__( FILE * stream , const char * kw , bool strict , ecl_data_type );

Doesn't look like a library that is usable. There's probably something broken about it...

@matteodg
Copy link
Member Author

matteodg commented Sep 26, 2020

I guess the main reason is that there are circular dependencies among the include files... In fact the topological sorting is only partial...

@matteodg
Copy link
Member Author

@saudet, in my last commits I changed by hand the order of the include files: now it seems there is no circular dependencies anymore.

Now I'm facing other errors when compiling: see the resulting JNI .cpp file jnilibecl.cpp.txt and the output from the compilation in using Maven maven-build-output.txt.

These are the lines with "error: ":

/home/matteo/code/javacpp-presets/current/libecl/target/native/org/bytedeco/libecl/linux-x86_64/jnilibecl.cpp:5293:53: error: use of deleted function ‘ecl_type_struct::ecl_type_struct()’
/home/matteo/code/javacpp-presets/current/libecl/cppbuild/linux-x86_64/include/ert/ecl/ecl_type.hpp:72:8: error: uninitialized const member in ‘struct ecl_type_struct’
/home/matteo/code/javacpp-presets/current/libecl/cppbuild/linux-x86_64/include/ert/ecl/ecl_type.hpp:72:8: error: uninitialized const member in ‘struct ecl_type_struct’
/home/matteo/code/javacpp-presets/current/libecl/target/native/org/bytedeco/libecl/linux-x86_64/jnilibecl.cpp:5320:57: error: use of deleted function ‘ecl_type_struct::ecl_type_struct()’
/home/matteo/code/javacpp-presets/current/libecl/cppbuild/linux-x86_64/include/ert/util/type_macros.hpp:136:44: error: expected primary-expression before ‘int’
/home/matteo/code/javacpp-presets/current/libecl/target/native/org/bytedeco/libecl/linux-x86_64/jnilibecl.cpp:10451:12: error: scalar object ‘rval’ requires one element in initializer
/home/matteo/code/javacpp-presets/current/libecl/cppbuild/linux-x86_64/include/ert/ecl/ecl_type.hpp:55:1: error: expected unqualified-id before ‘{’ token
/home/matteo/code/javacpp-presets/current/libecl/cppbuild/linux-x86_64/include/ert/ecl/ecl_type.hpp:55:41: error: expected primary-expression before ‘,’ token
/home/matteo/code/javacpp-presets/current/libecl/cppbuild/linux-x86_64/include/ert/ecl/ecl_type.hpp:56:1: error: expected primary-expression before ‘{’ token
/home/matteo/code/javacpp-presets/current/libecl/cppbuild/linux-x86_64/include/ert/ecl/ecl_type.hpp:56:41: error: expected primary-expression before ‘,’ token
/home/matteo/code/javacpp-presets/current/libecl/cppbuild/linux-x86_64/include/ert/ecl/ecl_type.hpp:57:1: error: expected primary-expression before ‘{’ token
/home/matteo/code/javacpp-presets/current/libecl/cppbuild/linux-x86_64/include/ert/ecl/ecl_type.hpp:57:38: error: expected primary-expression before ‘,’ token
/home/matteo/code/javacpp-presets/current/libecl/cppbuild/linux-x86_64/include/ert/ecl/ecl_type.hpp:58:1: error: expected primary-expression before ‘{’ token
/home/matteo/code/javacpp-presets/current/libecl/cppbuild/linux-x86_64/include/ert/ecl/ecl_type.hpp:58:39: error: expected primary-expression before ‘,’ token
/home/matteo/code/javacpp-presets/current/libecl/cppbuild/linux-x86_64/include/ert/ecl/ecl_type.hpp:59:1: error: expected primary-expression before ‘{’ token
/home/matteo/code/javacpp-presets/current/libecl/cppbuild/linux-x86_64/include/ert/ecl/ecl_type.hpp:59:39: error: expected primary-expression before ‘,’ token
/home/matteo/code/javacpp-presets/current/libecl/cppbuild/linux-x86_64/include/ert/ecl/ecl_type.hpp:60:1: error: expected primary-expression before ‘{’ token
/home/matteo/code/javacpp-presets/current/libecl/cppbuild/linux-x86_64/include/ert/ecl/ecl_type.hpp:79:17: error: cannot convert ‘ecl_data_type’ {aka ‘ecl_type_struct’} to ‘int’ in initialization
/home/matteo/code/javacpp-presets/current/libecl/cppbuild/linux-x86_64/include/ert/ecl/ecl_type.hpp:80:19: error: cannot convert ‘ecl_data_type’ {aka ‘ecl_type_struct’} to ‘int’ in initialization
/home/matteo/code/javacpp-presets/current/libecl/cppbuild/linux-x86_64/include/ert/ecl/ecl_type.hpp:81:20: error: cannot convert ‘ecl_data_type’ {aka ‘ecl_type_struct’} to ‘int’ in initialization
/home/matteo/code/javacpp-presets/current/libecl/cppbuild/linux-x86_64/include/ert/ecl/ecl_type.hpp:82:18: error: cannot convert ‘ecl_data_type’ {aka ‘ecl_type_struct’} to ‘int’ in initialization
/home/matteo/code/javacpp-presets/current/libecl/cppbuild/linux-x86_64/include/ert/ecl/ecl_type.hpp:84:18: error: cannot convert ‘ecl_data_type’ {aka ‘ecl_type_struct’} to ‘int’ in initialization
/home/matteo/code/javacpp-presets/current/libecl/target/native/org/bytedeco/libecl/linux-x86_64/jnilibecl.cpp:10487:12: error: scalar object ‘rval’ requires one element in initializer
/home/matteo/code/javacpp-presets/current/libecl/cppbuild/linux-x86_64/include/ert/ecl/ecl_util.hpp:96:69: error: expected unqualified-id before ‘{’ token
/home/matteo/code/javacpp-presets/current/libecl/cppbuild/linux-x86_64/include/ert/ecl/ecl_util.hpp:96:108: error: expected primary-expression before ‘,’ token
/home/matteo/code/javacpp-presets/current/libecl/cppbuild/linux-x86_64/include/ert/ecl/ecl_util.hpp:96:110: error: expected primary-expression before ‘{’ token
/home/matteo/code/javacpp-presets/current/libecl/target/native/org/bytedeco/libecl/linux-x86_64/jnilibecl.cpp:10493:12: error: scalar object ‘rval’ requires one element in initializer
/home/matteo/code/javacpp-presets/current/libecl/cppbuild/linux-x86_64/include/ert/ecl/ecl_file.hpp:41:3: error: expected unqualified-id before ‘{’ token
/home/matteo/code/javacpp-presets/current/libecl/target/native/org/bytedeco/libecl/linux-x86_64/jnilibecl.cpp:33009:47: error: invalid conversion from ‘jlong (*)(jlong)’ {aka ‘long long int (*)(long long int)’} to ‘long int (*)(long int)’ [-fpermissive]
/home/matteo/code/javacpp-presets/current/libecl/target/native/org/bytedeco/libecl/linux-x86_64/jnilibecl.cpp:34248:74: error: invalid conversion from ‘jint’ {aka ‘int’} to ‘int (*)(const void*)’ [-fpermissive]
/home/matteo/code/javacpp-presets/current/libecl/target/native/org/bytedeco/libecl/linux-x86_64/jnilibecl.cpp:49072:38: error: cannot convert ‘char*’ to ‘void (*)(void*)’
/home/matteo/code/javacpp-presets/current/libecl/target/native/org/bytedeco/libecl/linux-x86_64/jnilibecl.cpp:49091:51: error: cannot convert ‘char*’ to ‘void (*)(void*)’
/home/matteo/code/javacpp-presets/current/libecl/cppbuild/linux-x86_64/include/ert/ecl/ecl_type.hpp:83:18: error: cannot convert ‘ecl_data_type’ {aka ‘ecl_type_struct’} to ‘int’ in initialization

Any clue is welcome, thanks in advance!

@saudet
Copy link
Member

saudet commented Oct 20, 2020

Looks like abstract classes that JavaCPP isn't detecting properly, see:
https://github.com/bytedeco/javacpp/wiki/Mapping-Recipes#dealing-with-abstract-classes-and-virtual-methods

@matteodg matteodg marked this pull request as ready for review November 24, 2020 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants