libpostal

929 views
Skip to first unread message

Maurice Betzel

unread,
Dec 14, 2017, 9:11:37 AM12/14/17
to javacpp
Dear community,

i am trying to get libpostal build running within the great javacpp presets but i get stuck on the bootstrap.sh containing:

#!/bin/sh
autoreconf -fi --warning=no-portability


the default instruction work:

git clone https://github.com/openvenues/libpostal
cd libpostal
cp -rf windows/* ./
./bootstrap.sh
./configure --disable-data-download
make -j4
make install

cpp build.sh sofar:

#!/bin/bash
# This file is meant to be included by the parent cppbuild.sh script
if [[ -z "$PLATFORM" ]]; then
pushd ..
bash cppbuild.sh "$@" libpostal
popd
exit
fi

echo "downloading libpostal"

LIBPOSTAL_VERSION=master
download https://github.com/openvenues/libpostal/archive/$LIBPOSTAL_VERSION.tar.gz libpostal-$LIBPOSTAL_VERSION.tar.gz

echo "unpacking libpostal"

mkdir -p $PLATFORM
cd $PLATFORM
tar -xzvf ../libpostal-$LIBPOSTAL_VERSION.tar.gz
cd libpostal-$LIBPOSTAL_VERSION


case $PLATFORM in
windows-x86_64)
export CC="gcc -m64"
echo "Starting windows-x86_64 build"
cp -rf windows/* ./
echo $PWD
./bootstrap.sh
#./configure --datadir=/c
#./configure --disable-data-download
#make -j4
#make install
;;
*)
echo "Error: Platform \"$PLATFORM\" is not supported"
;;
esac

cd ../..

Maurice Betzel

unread,
Dec 14, 2017, 9:14:51 AM12/14/17
to javacpp
Forgotten the stacktrace:

Starting windows-x86_64 build
/home/betzm/javacpp-presets/libpostal/cppbuild/windows-x86_64/libpostal-master
aclocal-1.15: error: aclocal: file '/msys64/usr/share/aclocal/xsize.m4' does not exist
autoreconf: aclocal failed with exit status: 1
[ERROR] Command execution failed.
org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
    at org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:404)
    at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:166)
    at org.codehaus.mojo.exec.ExecMojo.executeCommandLine(ExecMojo.java:764)

Samuel Audet

unread,
Dec 14, 2017, 8:03:33 PM12/14/17
to javacpp

2017/12/14 23:14 "Maurice Betzel" <betze...@gmail.com>:
--
You received this message because you are subscribed to the Google Groups "javacpp" group.
To unsubscribe from this group and stop receiving emails from it, send an email to javacpp-project+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Maurice Betzel

unread,
Dec 15, 2017, 3:05:35 AM12/15/17
to javacpp
I followed these instructions, even started my IDEA editor from msys, and i can build other presets successfully, even from my IDE on windows 10.

Samuel Audet

unread,
Dec 15, 2017, 3:08:43 AM12/15/17
to javacpp-project@googlegroups.com >> javacpp
Try it from the command line. IntelliJ IDEA uses its own version of Maven...

Maurice Betzel

unread,
Dec 15, 2017, 3:16:29 AM12/15/17
to javacpp
IDEA is setup with an external maven via the system PATH, MSYS console gives the same output:

Maurice Betzel

unread,
Dec 15, 2017, 3:18:14 AM12/15/17
to javacpp
If i dot the C build as documented by libpostal from my msys all works well.

Samuel Audet

unread,
Dec 15, 2017, 3:19:54 AM12/15/17
to javacpp-project@googlegroups.com >> javacpp
That's an issue with libpostal. Make sure to install all packages here:
https://github.com/openvenues/libpostal#installation-windows

Samuel Audet

unread,
Dec 15, 2017, 3:21:05 AM12/15/17
to javacpp...@googlegroups.com
Like I said, cppbuild.sh is just a build script. It doesn't do anything
special. Just don't use it, install libpostal on your system, and use it
like that.

Maurice Betzel

unread,
Dec 15, 2017, 3:24:32 AM12/15/17
to javacpp
I did thought of that, but it is not very slick :)
Seems you do not have any interest in libpostal entering the presets?

Samuel Audet

unread,
Dec 15, 2017, 3:28:54 AM12/15/17
to javacpp...@googlegroups.com
Sorry for the misunderstanding. That's a different story then. Yes,
we'll need a build script for that. There's probably some package that
is missing, for example:
https://github.com/kwhat/jnativehook/issues/89#issuecomment-181098558

Maurice Betzel

unread,
Dec 15, 2017, 3:32:27 AM12/15/17
to javacpp
Seems that the path somehow bend within the preset build, the file '/msys64/usr/share/aclocal/xsize.m4'  does exist.

Maurice Betzel

unread,
Dec 15, 2017, 3:43:03 AM12/15/17
to javacpp
I did the pacman update, restarted msys and did mvn clean install on my libpostal modul on the console with the same result :(

Maurice Betzel

unread,
Dec 15, 2017, 5:53:31 AM12/15/17
to javacpp
I completely reinstalled all components as admin, just to be sure, with the same result. I am out of ideas why this excisting file is not found:

Maurice Betzel

unread,
Dec 15, 2017, 6:19:23 AM12/15/17
to javacpp
If i do the build until it exists on ./bootstrap.sh, do this manually on the console, and then do a maven install for the rest of the build, the build succeeds.

Maurice Betzel

unread,
Dec 15, 2017, 7:23:47 AM12/15/17
to javacpp
Verbose mvn error:
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force --warnings=no-portability

aclocal-1.15: error: aclocal: file '/msys64/usr/share/aclocal/xsize.m4' does not exist
autoreconf: aclocal failed with exit status: 1

Verbose console working:
$ ./bootstrap.sh
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force --warnings=no-portability
autoreconf: configure.ac: tracing
autoreconf: running: libtoolize --copy --force
libtoolize: putting auxiliary files in '.'.
libtoolize: copying file './ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'.
libtoolize: copying file 'm4/libtool.m4'
libtoolize: copying file 'm4/ltoptions.m4'
libtoolize: copying file 'm4/ltsugar.m4'
libtoolize: copying file 'm4/ltversion.m4'
libtoolize: copying file 'm4/lt~obsolete.m4'
libtoolize: Consider adding '-I m4' to ACLOCAL_AMFLAGS in Makefile.am.
autoreconf: running: /usr/bin/autoconf --force --warnings=no-portability
autoreconf: running: /usr/bin/autoheader --force --warnings=no-portability
autoreconf: running: automake --add-missing --copy --force-missing --warnings=no-portability
configure.ac:14: installing './compile'
configure.ac:14: installing './config.guess'
configure.ac:14: installing './config.sub'
configure.ac:12: installing './install-sh'
configure.ac:12: installing './missing'
src/Makefile.am: installing './depcomp'
parallel-tests: installing './test-driver'
autoreconf: Leaving directory `.'


Samuel Audet

unread,
Dec 15, 2017, 7:38:07 AM12/15/17
to javacpp
So this happens only when executing from Maven? Maven runs outside
MSYS2, and by default executes "bash" from the system PATH, so if you
have a "bash" other than MSYS2 on your system, that will cause problems...

Maurice Betzel

unread,
Dec 15, 2017, 8:24:41 AM12/15/17
to javacpp
Yes, it happens only from within the maven build, autoreconfig debug output:

Detected platform "windows-x86_64"
Building for platform "windows-x86_64"
Installing "libpostal"
~/javacpp-presets/libpostal/cppbuild ~/javacpp-presets
downloading libpostal
unpacking libpostal
Starting windows-x86_64 build
/home/betzm/javacpp-presets/libpostal/cppbuild/windows-x86_64/libpostal-master
autoreconf: running: /usr/bin/autoconf --version | sed 1q >&2
autoconf (GNU Autoconf) 2.69

autoreconf: running: /usr/bin/autoheader --version | sed 1q >&2
autoheader (GNU Autoconf) 2.69

autoreconf: running: automake --version | sed 1q >&2
automake (GNU automake) 1.15.1

autoreconf: running: aclocal --version | sed 1q >&2
aclocal (GNU automake) 1.15.1

autoreconf: running: autopoint --version | sed 1q >&2
/usr/bin/autopoint (GNU gettext-tools) 0.19.8.1

autoreconf: running: libtoolize --version | sed 1q >&2
libtoolize (GNU libtool) 2.4.6


autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force --verbose --warnings=no-portability
aclocal-1.15: found macro AM_PROG_VALAC in /usr/share/aclocal-1.15/vala.m4: 21
aclocal-1.15: found macro AM_PROG_UPC in /usr/share/aclocal-1.15/upc.m4: 9
aclocal-1.15: found macro _AM_PROG_TAR in /usr/share/aclocal-1.15/tar.m4: 23
aclocal-1.15: found macro _AM_SUBST_NOTMAKE in /usr/share/aclocal-1.15/substnot.m4: 12
aclocal-1.15: found macro AM_SUBST_NOTMAKE in /usr/share/aclocal-1.15/substnot.m4: 17
aclocal-1.15: found macro AM_PROG_INSTALL_STRIP in /usr/share/aclocal-1.15/strip.m4: 17
aclocal-1.15: found macro AM_SILENT_RULES in /usr/share/aclocal-1.15/silent.m4: 12
aclocal-1.15: found macro AM_SANITY_CHECK in /usr/share/aclocal-1.15/sanity.m4: 11
aclocal-1.15: found macro AM_RUN_LOG in /usr/share/aclocal-1.15/runlog.m4: 12
aclocal-1.15: found macro AM_PATH_PYTHON in /usr/share/aclocal-1.15/python.m4: 35
aclocal-1.15: found macro AM_PYTHON_CHECK_VERSION in /usr/share/aclocal-1.15/python.m4: 230
aclocal-1.15: found macro _AM_PROG_CC_C_O in /usr/share/aclocal-1.15/prog-cc-c-o.m4: 12
aclocal-1.15: found macro AM_PROG_CC_C_O in /usr/share/aclocal-1.15/prog-cc-c-o.m4: 47
aclocal-1.15: found macro _AM_MANGLE_OPTION in /usr/share/aclocal-1.15/options.m4: 11
aclocal-1.15: found macro _AM_SET_OPTION in /usr/share/aclocal-1.15/options.m4: 17
aclocal-1.15: found macro _AM_SET_OPTIONS in /usr/share/aclocal-1.15/options.m4: 23
aclocal-1.15: found macro _AM_IF_OPTION in /usr/share/aclocal-1.15/options.m4: 29
aclocal-1.15: found macro AM_CONFIG_HEADER in /usr/share/aclocal-1.15/obsolete.m4: 11
aclocal-1.15: found macro AM_PROG_CC_STDC in /usr/share/aclocal-1.15/obsolete.m4: 17
aclocal-1.15: found macro AM_C_PROTOTYPES in /usr/share/aclocal-1.15/obsolete.m4: 26
aclocal-1.15: found macro fp_C_PROTOTYPES in /usr/share/aclocal-1.15/obsolete.m4: 28
aclocal-1.15: found macro AM_PROG_MKDIR_P in /usr/share/aclocal-1.15/mkdirp.m4: 11
aclocal-1.15: found macro AM_MISSING_PROG in /usr/share/aclocal-1.15/missing.m4: 11
aclocal-1.15: found macro AM_MISSING_HAS_RUN in /usr/share/aclocal-1.15/missing.m4: 20
aclocal-1.15: found macro AM_MAKE_INCLUDE in /usr/share/aclocal-1.15/make.m4: 12
aclocal-1.15: found macro AM_MAINTAINER_MODE in /usr/share/aclocal-1.15/maintainer.m4: 16
aclocal-1.15: found macro AM_PATH_LISPDIR in /usr/share/aclocal-1.15/lispdir.m4: 14
aclocal-1.15: found macro AM_PROG_LEX in /usr/share/aclocal-1.15/lex.m4: 13
aclocal-1.15: found macro AM_SET_LEADING_DOT in /usr/share/aclocal-1.15/lead-dot.m4: 10
aclocal-1.15: found macro AM_PROG_INSTALL_SH in /usr/share/aclocal-1.15/install-sh.m4: 11
aclocal-1.15: found macro AM_INIT_AUTOMAKE in /usr/share/aclocal-1.15/init.m4: 29
aclocal-1.15: found macro _AC_AM_CONFIG_HEADER_HOOK in /usr/share/aclocal-1.15/init.m4: 186
aclocal-1.15: found macro AM_PROG_GCJ in /usr/share/aclocal-1.15/gcj.m4: 10
aclocal-1.15: found macro AM_EXTRA_RECURSIVE_TARGETS in /usr/share/aclocal-1.15/extra-recurs.m4: 16
aclocal-1.15: found macro AM_WITH_DMALLOC in /usr/share/aclocal-1.15/dmalloc.m4: 12
aclocal-1.15: found macro _AM_OUTPUT_DEPENDENCY_COMMANDS in /usr/share/aclocal-1.15/depout.m4: 12
aclocal-1.15: found macro AM_OUTPUT_DEPENDENCY_COMMANDS in /usr/share/aclocal-1.15/depout.m4: 71
aclocal-1.15: found macro _AM_DEPENDENCIES in /usr/share/aclocal-1.15/depend.m4: 26
aclocal-1.15: found macro AM_SET_DEPDIR in /usr/share/aclocal-1.15/depend.m4: 163
aclocal-1.15: found macro AM_DEP_TRACK in /usr/share/aclocal-1.15/depend.m4: 171
aclocal-1.15: found macro AM_CONDITIONAL in /usr/share/aclocal-1.15/cond.m4: 12
aclocal-1.15: found macro AM_COND_IF in /usr/share/aclocal-1.15/cond-if.m4: 23
aclocal-1.15: found macro AM_AUX_DIR_EXPAND in /usr/share/aclocal-1.15/auxdir.m4: 47
aclocal-1.15: found macro AM_PROG_AS in /usr/share/aclocal-1.15/as.m4: 11
aclocal-1.15: found macro AM_PROG_AR in /usr/share/aclocal-1.15/ar-lib.m4: 13
aclocal-1.15: found macro AM_AUTOMAKE_VERSION in /usr/share/aclocal-1.15/amversion.m4: 14
aclocal-1.15: found macro AM_SET_CURRENT_AUTOMAKE_VERSION in /usr/share/aclocal-1.15/amversion.m4: 33

aclocal-1.15: error: aclocal: file '/msys64/usr/share/aclocal/xsize.m4' does not exist
autoreconf: aclocal failed with exit status: 1
[ERROR] Command execution failed.
org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
        at org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:404)
        at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:166)
        at org.codehaus.mojo.exec.ExecMojo.executeCommandLine(ExecMojo.java:764)
        at org.codehaus.mojo.exec.ExecMojo.executeCommandLine(ExecMojo.java:711)
        at org.codehaus.mojo.exec.ExecMojo.execute(ExecMojo.java:289)

Maurice Betzel

unread,
Dec 15, 2017, 8:27:36 AM12/15/17
to javacpp
No BASH in windows installed or in my windows PATH

Samuel Audet

unread,
Dec 15, 2017, 8:35:04 AM12/15/17
to javacpp...@googlegroups.com
I remember having issues like that, but I've fixed it a long time ago.
Your fork is a few months old. Please try again with a more recent
version of JavaCPP.

Maurice Betzel

unread,
Dec 15, 2017, 9:56:54 AM12/15/17
to javacpp
I found A solution, i run the maven build in the msys shell and not the mingw64 shell. Then the build runs perfectly.

Samuel Audet

unread,
Dec 15, 2017, 8:51:35 PM12/15/17
to javacpp
Ok, good, there's still something wrong with your MSYS2, but if that works...

2017/12/15 23:56 "Maurice Betzel" <betze...@gmail.com>:
I found A solution, i run the maven build in the msys shell and not the mingw64 shell. Then the build runs perfectly.

Maurice Betzel

unread,
Dec 17, 2017, 10:42:05 AM12/17/17
to javacpp
 Not quite, it produces a dll with a dependency on the msys2 dll. I have no idea how to solve this besides adding the finished ddl.

Maurice Betzel

unread,
Dec 17, 2017, 11:33:43 AM12/17/17
to javacpp
I tries 1.3.4-SNAPSHOT with the same result:


Detected platform "windows-x86_64"
Building for platform "windows-x86_64"
Installing "libpostal"
~/javacpp-presets/libpostal/cppbuild ~/javacpp-presets
Cloning into 'libpostal-master'...
remote: Counting objects: 32229, done.
remote: Compressing objects: 100% (58/58), done.
remote: Total 32229 (delta 24), reused 39 (delta 13), pack-reused 32158
Receiving objects: 100% (32229/32229), 36.55 MiB | 242.00 KiB/s, done.
Resolving deltas: 100% (20249/20249), done.

aclocal-1.15: error: aclocal: file '/msys64/usr/share/aclocal/xsize.m4' does not exist
autoreconf: aclocal failed with exit status: 1
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 02:45 min
[INFO] Finished at: 2017-12-17T17:31:20+01:00
[INFO] Final Memory: 17M/309M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.bytedeco:javacpp:1.3.4-SNAPSHOT:build (javacpp.cppbuild.install) on project libpostal: Execution javacpp.cppbuild.install of goal org.bytedeco:javacpp:1.3.4-SNAPSHOT:build failed: Process exited with an error: 1 -> [Help 1]

Maurice Betzel

unread,
Dec 17, 2017, 1:07:32 PM12/17/17
to javacpp
I added a zip file containing the build files, but now i am hitting the JNI compiler
Could you take a look if i am not doing anything realy stupid?
https://github.com/Maurice-Betzel/javacpp-presets/tree/javacpp-presets-libpostal

cl /IC:\msys64\home\betzm\javacpp-presets-libpostal\libpostal/cppbuild/windows-x86_64/include/ /IC:\Users\betzm\Development\jdk\jdk1.8.0_144\include /IC:\Users\betzm\Development\jdk\jdk1.8.0_144\include\win32 C:\msys64\home\betzm\javacpp-presets-libpostal\libpostal\target\classes\org\bytedeco\javacpp\jnijavacpp.cpp C:\msys64\home\betzm\javacpp-presets-libpostal\libpostal\target\classes\org\bytedeco\javacpp\jnilibpostal.cpp /Oi /O2 /EHsc /Gy /GL /MD /LD /W3 /link /OUT:jnilibpostal.dll libpostaldll.lib psapi.lib
jnijavacpp.cpp
Microsoft (R) C/C++ Optimizing Compiler Version 19.12.25830.2 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

C:\msys64\home\betzm\javacpp-presets-libpostal\libpostal\target\classes\org\bytedeco\javacpp\jnijavacpp.cpp(501): warning C4267: 'argument': conversion from 'size_t' to 'jsize', possible loss of data
C:\msys64\home\betzm\javacpp-presets-libpostal\libpostal\target\classes\org\bytedeco\javacpp\jnijavacpp.cpp(502): warning C4267: 'argument': conversion from 'size_t' to 'jsize', possible loss of data
C:\msys64\home\betzm\javacpp-presets-libpostal\libpostal\target\classes\org\bytedeco\javacpp\jnijavacpp.cpp(543): warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt\string.h(132): note: see declaration of 'strcpy'
C:\msys64\home\betzm\javacpp-presets-libpostal\libpostal\target\classes\org\bytedeco\javacpp\jnijavacpp.cpp(545): warning C4996: 'strncpy': This function or variable may be unsafe. Consider using strncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt\string.h(337): note: see declaration of 'strncpy'
C:\msys64\home\betzm\javacpp-presets-libpostal\libpostal\target\classes\org\bytedeco\javacpp\jnijavacpp.cpp(1200): warning C4996: 'strncat': This function or variable may be unsafe. Consider using strncat_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt\string.h(265): note: see declaration of 'strncat'
C:\msys64\home\betzm\javacpp-presets-libpostal\libpostal\target\classes\org\bytedeco\javacpp\jnijavacpp.cpp(1244): warning C4996: 'strtok': This function or variable may be unsafe. Consider using strtok_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt\string.h(439): note: see declaration of 'strtok'
C:\msys64\home\betzm\javacpp-presets-libpostal\libpostal\target\classes\org\bytedeco\javacpp\jnijavacpp.cpp(1266): warning C4996: 'strcat': This function or variable may be unsafe. Consider using strcat_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt\string.h(89): note: see declaration of 'strcat'
C:\msys64\home\betzm\javacpp-presets-libpostal\libpostal\target\classes\org\bytedeco\javacpp\jnijavacpp.cpp(1294): warning C4996: 'strerror': This function or variable may be unsafe. Consider using strerror_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt\string.h(181): note: see declaration of 'strerror'
C:\msys64\home\betzm\javacpp-presets-libpostal\libpostal\target\classes\org\bytedeco\javacpp\jnijavacpp.cpp(1353): warning C4996: 'strncpy': This function or variable may be unsafe. Consider using strncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt\string.h(337): note: see declaration of 'strncpy'
C:\msys64\home\betzm\javacpp-presets-libpostal\libpostal\target\classes\org\bytedeco\javacpp\jnijavacpp.cpp(1423): warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt\string.h(132): note: see declaration of 'strcpy'
jnilibpostal.cpp
C:\msys64\home\betzm\javacpp-presets-libpostal\libpostal\target\classes\org\bytedeco\javacpp\jnilibpostal.cpp(234): warning C4267: 'argument': conversion from 'size_t' to 'jsize', possible loss of data
C:\msys64\home\betzm\javacpp-presets-libpostal\libpostal\target\classes\org\bytedeco\javacpp\jnilibpostal.cpp(235): warning C4267: 'argument': conversion from 'size_t' to 'jsize', possible loss of data
C:\msys64\home\betzm\javacpp-presets-libpostal\libpostal\target\classes\org\bytedeco\javacpp\jnilibpostal.cpp(244): warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt\string.h(132): note: see declaration of 'strcpy'
C:\msys64\home\betzm\javacpp-presets-libpostal\libpostal\target\classes\org\bytedeco\javacpp\jnilibpostal.cpp(246): warning C4996: 'strncpy': This function or variable may be unsafe. Consider using strncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt\string.h(337): note: see declaration of 'strncpy'
C:\msys64\home\betzm\javacpp-presets-libpostal\libpostal\target\classes\org\bytedeco\javacpp\jnilibpostal.cpp(1322): error C2440: '=': cannot convert from 'libpostal_address_parser_response_t *' to 'int *'
C:\msys64\home\betzm\javacpp-presets-libpostal\libpostal\target\classes\org\bytedeco\javacpp\jnilibpostal.cpp(1322): note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
C:\msys64\home\betzm\javacpp-presets-libpostal\libpostal\target\classes\org\bytedeco\javacpp\jnilibpostal.cpp(1351): error C2440: '=': cannot convert from 'libpostal_address_parser_response_t *' to 'int *'
C:\msys64\home\betzm\javacpp-presets-libpostal\libpostal\target\classes\org\bytedeco\javacpp\jnilibpostal.cpp(1351): note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
C:\msys64\home\betzm\javacpp-presets-libpostal\libpostal\target\classes\org\bytedeco\javacpp\jnilibpostal.cpp(1354): warning C4244: 'argument': conversion from 'jlong' to 'jsize', possible loss of data
C:\msys64\home\betzm\javacpp-presets-libpostal\libpostal\target\classes\org\bytedeco\javacpp\jnilibpostal.cpp(1355): warning C4244: 'argument': conversion from 'jlong' to 'jsize', possible loss of data
C:\msys64\home\betzm\javacpp-presets-libpostal\libpostal\target\classes\org\bytedeco\javacpp\jnilibpostal.cpp(1389): error C2440: '=': cannot convert from 'libpostal_address_parser_response_t *' to 'int *'
C:\msys64\home\betzm\javacpp-presets-libpostal\libpostal\target\classes\org\bytedeco\javacpp\jnilibpostal.cpp(1389): note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
C:\msys64\home\betzm\javacpp-presets-libpostal\libpostal\target\classes\org\bytedeco\javacpp\jnilibpostal.cpp(1546): error C2440: 'initializing': cannot convert from 'void' to 'int'
C:\msys64\home\betzm\javacpp-presets-libpostal\libpostal\target\classes\org\bytedeco\javacpp\jnilibpostal.cpp(1546): note: Expressions of type void cannot be converted to other types
C:\msys64\home\betzm\javacpp-presets-libpostal\libpostal\target\classes\org\bytedeco\javacpp\jnilibpostal.cpp(1561): error C2440: 'initializing': cannot convert from 'void' to 'int'
C:\msys64\home\betzm\javacpp-presets-libpostal\libpostal\target\classes\org\bytedeco\javacpp\jnilibpostal.cpp(1561): note: Expressions of type void cannot be converted to other types
C:\msys64\home\betzm\javacpp-presets-libpostal\libpostal\target\classes\org\bytedeco\javacpp\jnilibpostal.cpp(1631): error C2440: 'initializing': cannot convert from 'char **' to 'int **'
C:\msys64\home\betzm\javacpp-presets-libpostal\libpostal\target\classes\org\bytedeco\javacpp\jnilibpostal.cpp(1631): note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
C:\msys64\home\betzm\javacpp-presets-libpostal\libpostal\target\classes\org\bytedeco\javacpp\jnilibpostal.cpp(1669): error C2440: 'initializing': cannot convert from 'char **' to 'int **'
C:\msys64\home\betzm\javacpp-presets-libpostal\libpostal\target\classes\org\bytedeco\javacpp\jnilibpostal.cpp(1669): note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
C:\msys64\home\betzm\javacpp-presets-libpostal\libpostal\target\classes\org\bytedeco\javacpp\jnilibpostal.cpp(1678): warning C4244: 'argument': conversion from 'jlong' to 'jsize', possible loss of data
C:\msys64\home\betzm\javacpp-presets-libpostal\libpostal\target\classes\org\bytedeco\javacpp\jnilibpostal.cpp(1679): warning C4244: 'argument': conversion from 'jlong' to 'jsize', possible loss of data
C:\msys64\home\betzm\javacpp-presets-libpostal\libpostal\target\classes\org\bytedeco\javacpp\jnilibpostal.cpp(1695): error C2440: 'initializing': cannot convert from 'libpostal_normalize_options_t' to 'int'
C:\msys64\home\betzm\javacpp-presets-libpostal\libpostal\target\classes\org\bytedeco\javacpp\jnilibpostal.cpp(1695): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
C:\msys64\home\betzm\javacpp-presets-libpostal\libpostal\target\classes\org\bytedeco\javacpp\jnilibpostal.cpp(1726): error C2440: 'initializing': cannot convert from 'void' to 'int'
C:\msys64\home\betzm\javacpp-presets-libpostal\libpostal\target\classes\org\bytedeco\javacpp\jnilibpostal.cpp(1726): note: Expressions of type void cannot be converted to other types
C:\msys64\home\betzm\javacpp-presets-libpostal\libpostal\target\classes\org\bytedeco\javacpp\jnilibpostal.cpp(1752): error C2440: 'initializing': cannot convert from 'void' to 'int'
C:\msys64\home\betzm\javacpp-presets-libpostal\libpostal\target\classes\org\bytedeco\javacpp\jnilibpostal.cpp(1752): note: Expressions of type void cannot be converted to other types
C:\msys64\home\betzm\javacpp-presets-libpostal\libpostal\target\classes\org\bytedeco\javacpp\jnilibpostal.cpp(1771): error C2440: 'initializing': cannot convert from 'void' to 'int'
C:\msys64\home\betzm\javacpp-presets-libpostal\libpostal\target\classes\org\bytedeco\javacpp\jnilibpostal.cpp(1771): note: Expressions of type void cannot be converted to other types
C:\msys64\home\betzm\javacpp-presets-libpostal\libpostal\target\classes\org\bytedeco\javacpp\jnilibpostal.cpp(1791): error C2440: 'initializing': cannot convert from 'void' to 'int'
C:\msys64\home\betzm\javacpp-presets-libpostal\libpostal\target\classes\org\bytedeco\javacpp\jnilibpostal.cpp(1791): note: Expressions of type void cannot be converted to other types
C:\msys64\home\betzm\javacpp-presets-libpostal\libpostal\target\classes\org\bytedeco\javacpp\jnilibpostal.cpp(1824): error C2440: 'initializing': cannot convert from 'void' to 'int'
C:\msys64\home\betzm\javacpp-presets-libpostal\libpostal\target\classes\org\bytedeco\javacpp\jnilibpostal.cpp(1824): note: Expressions of type void cannot be converted to other types
C:\msys64\home\betzm\javacpp-presets-libpostal\libpostal\target\classes\org\bytedeco\javacpp\jnilibpostal.cpp(1839): error C2440: 'initializing': cannot convert from 'libpostal_address_parser_options_t' to 'int'
C:\msys64\home\betzm\javacpp-presets-libpostal\libpostal\target\classes\org\bytedeco\javacpp\jnilibpostal.cpp(1839): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
C:\msys64\home\betzm\javacpp-presets-libpostal\libpostal\target\classes\org\bytedeco\javacpp\jnilibpostal.cpp(1854): error C2440: 'initializing': cannot convert from 'void' to 'int'
C:\msys64\home\betzm\javacpp-presets-libpostal\libpostal\target\classes\org\bytedeco\javacpp\jnilibpostal.cpp(1854): note: Expressions of type void cannot be converted to other types
C:\msys64\home\betzm\javacpp-presets-libpostal\libpostal\target\classes\org\bytedeco\javacpp\jnilibpostal.cpp(1943): error C2059: syntax error: '__declspec(dllimport)'

Samuel Audet

unread,
Dec 17, 2017, 7:01:49 PM12/17/17
to javacpp...@googlegroups.com
Don't worry about that, we can bundle that DLL if needed.

Samuel Audet

unread,
Dec 17, 2017, 7:03:08 PM12/17/17
to javacpp...@googlegroups.com
What happens if you run "bash cppbuild.sh install", without Maven?

Samuel Audet

unread,
Dec 17, 2017, 7:05:24 PM12/17/17
to javacpp-project@googlegroups.com >> javacpp
You'll need to include other header files than "libpostal.h" that
contain necessary definitions. This isn't done automatically to avoid
including system files.

Maurice Betzel

unread,
Dec 18, 2017, 3:06:21 AM12/18/17
to javacpp
>What happens if you run "bash cppbuild.sh install", without Maven?
It builds just fine, also the produced executable is functional.

Maurice Betzel

unread,
Dec 18, 2017, 3:14:34 AM12/18/17
to javacpp
>You'll need to include other header files than "libpostal.h" that
>contain necessary definitions.

If i take a look at jpostal it only includes the jPostal, jni, and default headers:


#include <stdlib.h>
#include <string.h>
#include <jni.h>
#include <libpostal/libpostal.h>

Where do i find what headers to include?

Samuel Audet

unread,
Dec 18, 2017, 3:30:14 AM12/18/17
to javacpp
Right, looks like it doesn't include anything else:
https://github.com/openvenues/libpostal/blob/master/src/libpostal.h

Ok, next thing, you'll need to add the following so that it doesn't try
to consider it as a constant variable:
new Info("LIBPOSTAL_EXPORT").cppTypes().annotations()

Samuel

On 12/18/2017 05:14 PM, Maurice Betzel wrote:
> >You'll need to include other header files than "libpostal.h" that
> >contain necessary definitions.
>
> If i take a look at jpostal
> <https://github.com/openvenues/jpostal/tree/master/src/main> it only

Maurice Betzel

unread,
Dec 18, 2017, 5:39:22 AM12/18/17
to javacpp
I added you sugestion and it removed all errors from the build, leaving only warnings. But now i am facing a file that is missing: jnilibpostal.dll


[INFO] Detected platform "windows-x86_64"
[INFO] Building for platform "windows-x86_64"
[INFO] Generating C:\msys64\home\betzm\javacpp-presets\libpostal\target\classes\org\bytedeco\javacpp\jnijavacpp.cpp
[INFO] Generating C:\msys64\home\betzm\javacpp-presets\libpostal\target\classes\org\bytedeco\javacpp\jnilibpostal.cpp
[INFO] Compiling C:\msys64\home\betzm\javacpp-presets\libpostal\target\classes\org\bytedeco\javacpp\windows-x86_64\jnilibpostal.dll
[INFO] cl /IC:\msys64\home\betzm\javacpp-presets\libpostal/cppbuild/windows-x86_64/include/ /IC:\Users\betzm\Development\jdk\jdk1.8.0_144\include /IC:\Users\betzm\Development\jdk\jdk1.8.0_144\include\win32 C:\msys64\home\betzm\javacpp-presets\libpostal\target\classes\org\bytedeco\javacpp\jnilibpostal.cpp C:\msys64\home\betzm\javacpp-presets\libpostal\target\classes\org\bytedeco\javacpp\jnijavacpp.cpp /Oi /O2 /EHsc /Gy /GL /MD /LD /W3 /link /OUT:jnilibpostal.dll libpostaldll.lib psapi.lib
jnilibpostal.cpp

Microsoft (R) C/C++ Optimizing Compiler Version 19.12.25830.2 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

C:\msys64\home\betzm\javacpp-presets\libpostal\target\classes\org\bytedeco\javacpp\jnilibpostal.cpp(233): warning C4267: 'argument': conversion from 'size_t' to 'jsize', possible loss of data
C:\msys64\home\betzm\javacpp-presets\libpostal\target\classes\org\bytedeco\javacpp\jnilibpostal.cpp(234): warning C4267: 'argument': conversion from 'size_t' to 'jsize', possible loss of data
C:\msys64\home\betzm\javacpp-presets\libpostal\target\classes\org\bytedeco\javacpp\jnilibpostal.cpp(243): warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.

C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt\string.h(132): note: see declaration of 'strcpy'
C:\msys64\home\betzm\javacpp-presets\libpostal\target\classes\org\bytedeco\javacpp\jnilibpostal.cpp(245): warning C4996: 'strncpy': This function or variable may be unsafe. Consider using strncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.

C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt\string.h(337): note: see declaration of 'strncpy'
C:\msys64\home\betzm\javacpp-presets\libpostal\target\classes\org\bytedeco\javacpp\jnilibpostal.cpp(1860): warning C4244: 'argument': conversion from 'jlong' to 'jsize', possible loss of data
C:\msys64\home\betzm\javacpp-presets\libpostal\target\classes\org\bytedeco\javacpp\jnilibpostal.cpp(1861): warning C4244: 'argument': conversion from 'jlong' to 'jsize', possible loss of data
jnijavacpp.cpp
C:\msys64\home\betzm\javacpp-presets\libpostal\target\classes\org\bytedeco\javacpp\jnijavacpp.cpp(501): warning C4267: 'argument': conversion from 'size_t' to 'jsize', possible loss of data
C:\msys64\home\betzm\javacpp-presets\libpostal\target\classes\org\bytedeco\javacpp\jnijavacpp.cpp(502): warning C4267: 'argument': conversion from 'size_t' to 'jsize', possible loss of data
C:\msys64\home\betzm\javacpp-presets\libpostal\target\classes\org\bytedeco\javacpp\jnijavacpp.cpp(543): warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.

C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt\string.h(132): note: see declaration of 'strcpy'
C:\msys64\home\betzm\javacpp-presets\libpostal\target\classes\org\bytedeco\javacpp\jnijavacpp.cpp(545): warning C4996: 'strncpy': This function or variable may be unsafe. Consider using strncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.

C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt\string.h(337): note: see declaration of 'strncpy'
C:\msys64\home\betzm\javacpp-presets\libpostal\target\classes\org\bytedeco\javacpp\jnijavacpp.cpp(1275): warning C4996: 'strerror': This function or variable may be unsafe. Consider using strerror_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.

C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt\string.h(181): note: see declaration of 'strerror'
C:\msys64\home\betzm\javacpp-presets\libpostal\target\classes\org\bytedeco\javacpp\jnijavacpp.cpp(1302): warning C4996: 'strncat': This function or variable may be unsafe. Consider using strncat_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.

C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt\string.h(265): note: see declaration of 'strncat'
C:\msys64\home\betzm\javacpp-presets\libpostal\target\classes\org\bytedeco\javacpp\jnijavacpp.cpp(1341): warning C4996: 'strcat': This function or variable may be unsafe. Consider using strcat_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.

C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt\string.h(89): note: see declaration of 'strcat'
C:\msys64\home\betzm\javacpp-presets\libpostal\target\classes\org\bytedeco\javacpp\jnijavacpp.cpp(1411): warning C4996: 'strncpy': This function or variable may be unsafe. Consider using strncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.

C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt\string.h(337): note: see declaration of 'strncpy'
C:\msys64\home\betzm\javacpp-presets\libpostal\target\classes\org\bytedeco\javacpp\jnijavacpp.cpp(1455): warning C4996: 'strtok': This function or variable may be unsafe. Consider using strtok_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.

C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt\string.h(439): note: see declaration of 'strtok'
C:\msys64\home\betzm\javacpp-presets\libpostal\target\classes\org\bytedeco\javacpp\jnijavacpp.cpp(1477): warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.

C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt\string.h(132): note: see declaration of 'strcpy'
Microsoft (R) Incremental Linker Version 14.12.25830.2

Copyright (C) Microsoft Corporation.  All rights reserved.

/out:jnilibpostal.dll
/ltcg
/dll
/implib:jnilibpostal.lib
/OUT:jnilibpostal.dll
libpostaldll.lib
psapi.lib
jnilibpostal.obj
jnijavacpp.obj
LINK : fatal error LNK1181: cannot open input file 'libpostaldll.lib'

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.119 s
[INFO] Finished at: 2017-12-18T11:37:00+01:00
[INFO] Final Memory: 22M/256M

Maurice Betzel

unread,
Dec 18, 2017, 5:57:25 AM12/18/17
to javacpp
Trying to run the cl command from the mingw shell

Maurice Betzel

unread,
Dec 18, 2017, 6:11:16 AM12/18/17
to javacpp
From the native tools cmd promt:

C:\Users\betzm\source>cl /IC:\msys64\home\betzm\javacpp-presets\libpostal/cppbuild/windows-x86_64/include/ /IC:\Users\betzm\Development\jdk\jdk1.8.0_144\include /IC:\Users\betzm\Development\jdk\jdk1.8.0_144\include\win32 C:\msys64\home\betzm\javacpp-presets\libpostal\target\classes\org\bytedeco\javacpp\jnilibpostal.cpp C:\msys64\home\betzm\javacpp-presets\libpostal\target\classes\org\bytedeco\javacpp\jnijavacpp.cpp /Oi /O2 /EHsc /Gy /GL /MD /LD /W3 /link /OUT:jnilibpostal.dll libpostaldll.lib psapi.lib

Microsoft (R) C/C++ Optimizing Compiler Version 19.12.25830.2 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

jnilibpostal.cpp

C:\msys64\home\betzm\javacpp-presets\libpostal\target\classes\org\bytedeco\javacpp\jnilibpostal.cpp(233): warning C4267: 'argument': conversion from 'size_t' to 'jsize', possible loss of data
C:\msys64\home\betzm\javacpp-presets\libpostal\target\classes\org\bytedeco\javacpp\jnilibpostal.cpp(234): warning C4267: 'argument': conversion from 'size_t' to 'jsize', possible loss of data
C:\msys64\home\betzm\javacpp-presets\libpostal\target\classes\org\bytedeco\javacpp\jnilibpostal.cpp(243): warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt\string.h(132): note: see declaration of 'strcpy'
C:\msys64\home\betzm\javacpp-presets\libpostal\target\classes\org\bytedeco\javacpp\jnilibpostal.cpp(245): warning C4996: 'strncpy': This function or variable may be unsafe. Consider using strncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt\string.h(337): note: see declaration of 'strncpy'
C:\msys64\home\betzm\javacpp-presets\libpostal\target\classes\org\bytedeco\javacpp\jnilibpostal.cpp(1414): warning C4244: 'argument': conversion from 'jlong' to 'jsize', possible loss of data
C:\msys64\home\betzm\javacpp-presets\libpostal\target\classes\org\bytedeco\javacpp\jnilibpostal.cpp(1415): warning C4244: 'argument': conversion from 'jlong' to 'jsize', possible loss of data

jnijavacpp.cpp
C:\msys64\home\betzm\javacpp-presets\libpostal\target\classes\org\bytedeco\javacpp\jnijavacpp.cpp(501): warning C4267: 'argument': conversion from 'size_t' to 'jsize', possible loss of data
C:\msys64\home\betzm\javacpp-presets\libpostal\target\classes\org\bytedeco\javacpp\jnijavacpp.cpp(502): warning C4267: 'argument': conversion from 'size_t' to 'jsize', possible loss of data
C:\msys64\home\betzm\javacpp-presets\libpostal\target\classes\org\bytedeco\javacpp\jnijavacpp.cpp(543): warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt\string.h(132): note: see declaration of 'strcpy'
C:\msys64\home\betzm\javacpp-presets\libpostal\target\classes\org\bytedeco\javacpp\jnijavacpp.cpp(545): warning C4996: 'strncpy': This function or variable may be unsafe. Consider using strncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt\string.h(337): note: see declaration of 'strncpy'
C:\msys64\home\betzm\javacpp-presets\libpostal\target\classes\org\bytedeco\javacpp\jnijavacpp.cpp(1229): warning C4996: 'strcat': This function or variable may be unsafe. Consider using strcat_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.

C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt\string.h(89): note: see declaration of 'strcat'
C:\msys64\home\betzm\javacpp-presets\libpostal\target\classes\org\bytedeco\javacpp\jnijavacpp.cpp(1263): warning C4996: 'strncat': This function or variable may be unsafe. Consider using strncat_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.

C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt\string.h(265): note: see declaration of 'strncat'
C:\msys64\home\betzm\javacpp-presets\libpostal\target\classes\org\bytedeco\javacpp\jnijavacpp.cpp(1324): warning C4996: 'strtok': This function or variable may be unsafe. Consider using strtok_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.

C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt\string.h(439): note: see declaration of 'strtok'
C:\msys64\home\betzm\javacpp-presets\libpostal\target\classes\org\bytedeco\javacpp\jnijavacpp.cpp(1340): warning C4996: 'strerror': This function or variable may be unsafe. Consider using strerror_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.

C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt\string.h(181): note: see declaration of 'strerror'
C:\msys64\home\betzm\javacpp-presets\libpostal\target\classes\org\bytedeco\javacpp\jnijavacpp.cpp(1421): warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.

C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt\string.h(132): note: see declaration of 'strcpy'
C:\msys64\home\betzm\javacpp-presets\libpostal\target\classes\org\bytedeco\javacpp\jnijavacpp.cpp(1477): warning C4996: 'strncpy': This function or variable may be unsafe. Consider using strncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.

C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt\string.h(337): note: see declaration of 'strncpy'
Microsoft (R) Incremental Linker Version 14.12.25830.2
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:jnilibpostal.dll
/ltcg
/dll
/implib:jnilibpostal.lib
/OUT:jnilibpostal.dll
libpostaldll.lib
psapi.lib
jnilibpostal.obj
jnijavacpp.obj
LINK : fatal error LNK1181: cannot open input file 'libpostaldll.lib'

C:\Users\betzm\source>dir

Samuel Audet

unread,
Dec 18, 2017, 6:42:25 AM12/18/17
to javacpp
The easiest thing to do is copy that file into cppbuild/lib after the build in cppbuild.sh.

2017/12/18 20:11 "Maurice Betzel" <betze...@gmail.com>:
--

Maurice Betzel

unread,
Dec 18, 2017, 6:51:01 AM12/18/17
to javacpp
I do not understand, it seems that the microsoft compiler is not generating the needed jni dll. and it is not throwing any exceptions.

Maurice Betzel

unread,
Dec 18, 2017, 6:52:32 AM12/18/17
to javacpp

Ah, you mean the libpostal.lib file...

Maurice Betzel

unread,
Dec 18, 2017, 6:57:43 AM12/18/17
to javacpp
So far so good:


[INFO] Detected platform "windows-x86_64"
[INFO] Building for platform "windows-x86_64"
[INFO] Generating C:\msys64\home\betzm\javacpp-presets\libpostal\target\classes\org\bytedeco\javacpp\jnijavacpp.cpp
[INFO] Generating C:\msys64\home\betzm\javacpp-presets\libpostal\target\classes\org\bytedeco\javacpp\jnilibpostal.cpp
[INFO] Compiling C:\msys64\home\betzm\javacpp-presets\libpostal\target\classes\org\bytedeco\javacpp\windows-x86_64\jnilibpostal.dll
[INFO] cl /IC:\msys64\home\betzm\javacpp-presets\libpostal/cppbuild/windows-x86_64/include/ /IC:\Users\betzm\Development\jdk\jdk1.8.0_144\include /IC:\Users\betzm\Development\jdk\jdk1.8.0_144\include\win32 C:\msys64\home\betzm\javacpp-presets\libpostal\target\classes\org\bytedeco\javacpp\jnilibpostal.cpp C:\msys64\home\betzm\javacpp-presets\libpostal\target\classes\org\bytedeco\javacpp\jnijavacpp.cpp /Oi /O2 /EHsc /Gy /GL /MD /LD /W3 /link /OUT:jnilibpostal.dll /LIBPATH:C:\msys64\home\betzm\javacpp-presets\libpostal/cppbuild/windows-x86_64/lib/ libpostal.lib psapi.lib
jnilibpostal.cpp

Microsoft (R) C/C++ Optimizing Compiler Version 19.12.25830.2 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

C:\msys64\home\betzm\javacpp-presets\libpostal\target\classes\org\bytedeco\javacpp\jnilibpostal.cpp(233): warning C4267: 'argument': conversion from 'size_t' to 'jsize', possible loss of data
C:\msys64\home\betzm\javacpp-presets\libpostal\target\classes\org\bytedeco\javacpp\jnilibpostal.cpp(234): warning C4267: 'argument': conversion from 'size_t' to 'jsize', possible loss of data
C:\msys64\home\betzm\javacpp-presets\libpostal\target\classes\org\bytedeco\javacpp\jnilibpostal.cpp(243): warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt\string.h(132): note: see declaration of 'strcpy'
C:\msys64\home\betzm\javacpp-presets\libpostal\target\classes\org\bytedeco\javacpp\jnilibpostal.cpp(245): warning C4996: 'strncpy': This function or variable may be unsafe. Consider using strncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt\string.h(337): note: see declaration of 'strncpy'
C:\msys64\home\betzm\javacpp-presets\libpostal\target\classes\org\bytedeco\javacpp\jnilibpostal.cpp(1798): warning C4244: 'argument': conversion from 'jlong' to 'jsize', possible loss of data
C:\msys64\home\betzm\javacpp-presets\libpostal\target\classes\org\bytedeco\javacpp\jnilibpostal.cpp(1799): warning C4244: 'argument': conversion from 'jlong' to 'jsize', possible loss of data

jnijavacpp.cpp
C:\msys64\home\betzm\javacpp-presets\libpostal\target\classes\org\bytedeco\javacpp\jnijavacpp.cpp(501): warning C4267: 'argument': conversion from 'size_t' to 'jsize', possible loss of data
C:\msys64\home\betzm\javacpp-presets\libpostal\target\classes\org\bytedeco\javacpp\jnijavacpp.cpp(502): warning C4267: 'argument': conversion from 'size_t' to 'jsize', possible loss of data
C:\msys64\home\betzm\javacpp-presets\libpostal\target\classes\org\bytedeco\javacpp\jnijavacpp.cpp(543): warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt\string.h(132): note: see declaration of 'strcpy'
C:\msys64\home\betzm\javacpp-presets\libpostal\target\classes\org\bytedeco\javacpp\jnijavacpp.cpp(545): warning C4996: 'strncpy': This function or variable may be unsafe. Consider using strncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt\string.h(337): note: see declaration of 'strncpy'
C:\msys64\home\betzm\javacpp-presets\libpostal\target\classes\org\bytedeco\javacpp\jnijavacpp.cpp(1171): warning C4996: 'strcat': This function or variable may be unsafe. Consider using strcat_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.

C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt\string.h(89): note: see declaration of 'strcat'
C:\msys64\home\betzm\javacpp-presets\libpostal\target\classes\org\bytedeco\javacpp\jnijavacpp.cpp(1223): warning C4996: 'strncat': This function or variable may be unsafe. Consider using strncat_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.

C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt\string.h(265): note: see declaration of 'strncat'
C:\msys64\home\betzm\javacpp-presets\libpostal\target\classes\org\bytedeco\javacpp\jnijavacpp.cpp(1307): warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.

C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt\string.h(132): note: see declaration of 'strcpy'
C:\msys64\home\betzm\javacpp-presets\libpostal\target\classes\org\bytedeco\javacpp\jnijavacpp.cpp(1404): warning C4996: 'strtok': This function or variable may be unsafe. Consider using strtok_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.

C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt\string.h(439): note: see declaration of 'strtok'
C:\msys64\home\betzm\javacpp-presets\libpostal\target\classes\org\bytedeco\javacpp\jnijavacpp.cpp(1453): warning C4996: 'strncpy': This function or variable may be unsafe. Consider using strncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.

C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt\string.h(337): note: see declaration of 'strncpy'
C:\msys64\home\betzm\javacpp-presets\libpostal\target\classes\org\bytedeco\javacpp\jnijavacpp.cpp(1481): warning C4996: 'strerror': This function or variable may be unsafe. Consider using strerror_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.

C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt\string.h(181): note: see declaration of 'strerror'
Microsoft (R) Incremental Linker Version 14.12.25830.2
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:jnilibpostal.dll
/ltcg
/dll
/implib:jnilibpostal.lib
/OUT:jnilibpostal.dll
/LIBPATH:C:\msys64\home\betzm\javacpp-presets\libpostal/cppbuild/windows-x86_64/lib/
libpostal.lib
psapi.lib
jnilibpostal.obj
jnijavacpp.obj
   Creating library jnilibpostal.lib and object jnilibpostal.exp
Generating code
Finished generating code
[INFO] Deleting C:\msys64\home\betzm\javacpp-presets\libpostal\target\classes\org\bytedeco\javacpp\jnilibpostal.cpp
[INFO] Deleting C:\msys64\home\betzm\javacpp-presets\libpostal\target\classes\org\bytedeco\javacpp\jnijavacpp.cpp
[INFO] Copying C:\msys64\mingw64\bin\libpostal-1.dll
[INFO] Copying C:\msys64\home\betzm\javacpp-presets\libpostal\cppbuild\windows-x86_64\bin\libpostal.dll
[INFO]
[INFO] --- maven-resources-plugin:2.7:testResources (default-testResources) @ libpostal ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\msys64\home\betzm\javacpp-presets\libpostal\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.3:testCompile (default-testCompile) @ libpostal ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ libpostal ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-jar-plugin:3.0.2:jar (default-jar) @ libpostal ---
[INFO] Building jar: C:\msys64\home\betzm\javacpp-presets\libpostal\target\libpostal.jar
[INFO]
[INFO] --- maven-jar-plugin:3.0.2:jar (windows-x86_64) @ libpostal ---
[INFO] Building jar: C:\msys64\home\betzm\javacpp-presets\libpostal\target\libpostal-windows-x86_64.jar
[INFO]
[INFO] --- maven-source-plugin:3.0.1:jar-no-fork (attach-source) @ libpostal ---
[INFO] Building jar: C:\msys64\home\betzm\javacpp-presets\libpostal\target\libpostal-sources.jar
[INFO]
[INFO] --- maven-javadoc-plugin:2.10.4:jar (attach-javadocs) @ libpostal ---
[INFO]
Loading source files for package org.bytedeco.javacpp...
Loading source files for package org.bytedeco.javacpp.presets...
Constructing Javadoc information...
Standard Doclet version 1.8.0_144
Building tree for all the packages and classes...
Generating C:\msys64\home\betzm\javacpp-presets\libpostal\target\apidocs\org\bytedeco\javacpp\libpostal.html...
Generating C:\msys64\home\betzm\javacpp-presets\libpostal\target\apidocs\org\bytedeco\javacpp\libpostal.libpostal_address_parser_options_t.html...
Generating C:\msys64\home\betzm\javacpp-presets\libpostal\target\apidocs\org\bytedeco\javacpp\libpostal.libpostal_address_parser_response_t.html...
Generating C:\msys64\home\betzm\javacpp-presets\libpostal\target\apidocs\org\bytedeco\javacpp\libpostal.libpostal_normalize_options_t.html...
Generating C:\msys64\home\betzm\javacpp-presets\libpostal\target\apidocs\org\bytedeco\javacpp\presets\libpostal.html...
Generating C:\msys64\home\betzm\javacpp-presets\libpostal\target\apidocs\overview-frame.html...
Generating C:\msys64\home\betzm\javacpp-presets\libpostal\target\apidocs\org\bytedeco\javacpp\package-frame.html...
Generating C:\msys64\home\betzm\javacpp-presets\libpostal\target\apidocs\org\bytedeco\javacpp\package-summary.html...
Generating C:\msys64\home\betzm\javacpp-presets\libpostal\target\apidocs\org\bytedeco\javacpp\package-tree.html...
Generating C:\msys64\home\betzm\javacpp-presets\libpostal\target\apidocs\org\bytedeco\javacpp\presets\package-frame.html...
Generating C:\msys64\home\betzm\javacpp-presets\libpostal\target\apidocs\org\bytedeco\javacpp\presets\package-summary.html...
Generating C:\msys64\home\betzm\javacpp-presets\libpostal\target\apidocs\org\bytedeco\javacpp\presets\package-tree.html...
Generating C:\msys64\home\betzm\javacpp-presets\libpostal\target\apidocs\constant-values.html...
Generating C:\msys64\home\betzm\javacpp-presets\libpostal\target\apidocs\org\bytedeco\javacpp\class-use\libpostal.html...
Generating C:\msys64\home\betzm\javacpp-presets\libpostal\target\apidocs\org\bytedeco\javacpp\class-use\libpostal.libpostal_normalize_options_t.html...
Generating C:\msys64\home\betzm\javacpp-presets\libpostal\target\apidocs\org\bytedeco\javacpp\class-use\libpostal.libpostal_address_parser_response_t.html...
Generating C:\msys64\home\betzm\javacpp-presets\libpostal\target\apidocs\org\bytedeco\javacpp\class-use\libpostal.libpostal_address_parser_options_t.html...
Generating C:\msys64\home\betzm\javacpp-presets\libpostal\target\apidocs\org\bytedeco\javacpp\presets\class-use\libpostal.html...
Generating C:\msys64\home\betzm\javacpp-presets\libpostal\target\apidocs\org\bytedeco\javacpp\package-use.html...
Generating C:\msys64\home\betzm\javacpp-presets\libpostal\target\apidocs\org\bytedeco\javacpp\presets\package-use.html...
Building index for all the packages and classes...
Generating C:\msys64\home\betzm\javacpp-presets\libpostal\target\apidocs\overview-tree.html...
Generating C:\msys64\home\betzm\javacpp-presets\libpostal\target\apidocs\index-all.html...
Generating C:\msys64\home\betzm\javacpp-presets\libpostal\target\apidocs\deprecated-list.html...
Building index for all classes...
Generating C:\msys64\home\betzm\javacpp-presets\libpostal\target\apidocs\allclasses-frame.html...
Generating C:\msys64\home\betzm\javacpp-presets\libpostal\target\apidocs\allclasses-noframe.html...
Generating C:\msys64\home\betzm\javacpp-presets\libpostal\target\apidocs\index.html...
Generating C:\msys64\home\betzm\javacpp-presets\libpostal\target\apidocs\overview-summary.html...
Generating C:\msys64\home\betzm\javacpp-presets\libpostal\target\apidocs\help-doc.html...
[WARNING] Javadoc Warnings
[WARNING] Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
[INFO] Building jar: C:\msys64\home\betzm\javacpp-presets\libpostal\target\libpostal-javadoc.jar
[INFO]
[INFO] --- maven-install-plugin:2.5.2:install (default-install) @ libpostal ---
[INFO] Installing C:\msys64\home\betzm\javacpp-presets\libpostal\target\libpostal.jar to C:\Users\betzm\.m2\repository\org\bytedeco\javacpp-presets\libpostal\1.0.0-$PROJECT.PARENT.VERSION$\libpostal-1.0.0-$PROJECT.PARENT.VERSION$.jar
[INFO] Installing C:\msys64\home\betzm\javacpp-presets\libpostal\pom.xml to C:\Users\betzm\.m2\repository\org\bytedeco\javacpp-presets\libpostal\1.0.0-$PROJECT.PARENT.VERSION$\libpostal-1.0.0-$PROJECT.PARENT.VERSION$.pom
[INFO] Installing C:\msys64\home\betzm\javacpp-presets\libpostal\target\libpostal-windows-x86_64.jar to C:\Users\betzm\.m2\repository\org\bytedeco\javacpp-presets\libpostal\1.0.0-$PROJECT.PARENT.VERSION$\libpostal-1.0.0-$PROJECT.PARENT.VERSION$-windows-x86_64.jar
[INFO] Installing C:\msys64\home\betzm\javacpp-presets\libpostal\target\libpostal-sources.jar to C:\Users\betzm\.m2\repository\org\bytedeco\javacpp-presets\libpostal\1.0.0-$PROJECT.PARENT.VERSION$\libpostal-1.0.0-$PROJECT.PARENT.VERSION$-sources.jar
[INFO] Installing C:\msys64\home\betzm\javacpp-presets\libpostal\target\libpostal-javadoc.jar to C:\Users\betzm\.m2\repository\org\bytedeco\javacpp-presets\libpostal\1.0.0-$PROJECT.PARENT.VERSION$\libpostal-1.0.0-$PROJECT.PARENT.VERSION$-javadoc.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------

Maurice Betzel

unread,
Dec 18, 2017, 7:02:27 AM12/18/17
to javacpp
In libpostal-windows-x86_64.jar i now have libpostal.dll and jnilibpostal.dll

Maurice Betzel

unread,
Dec 19, 2017, 3:45:15 AM12/19/17
to javacpp
Setup sofar works, all returned booleans are true but i get a access violation on libpostal_expand_address:

#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0000000023f25b3f, pid=1008, tid=0x0000000000000240

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  org.bytedeco.javacpp.libpostal.libpostal_expand_address([BLorg/bytedeco/javacpp/libpostal$libpostal_normalize_options_t;Lorg/bytedeco/javacpp/SizeTPointer;)[B+0
j  eu.abeel.email.pdf.Main5.main([Ljava/lang/String;)V+65
v  ~StubRoutines::call_stub
J 2107  sun.reflect.NativeMethodAccessorImpl.invoke0(Ljava/lang/reflect/Method;Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object; (0 bytes) @ 0x000000000391987f [0x0000000003919800+0x7f]
J 2106 C1 sun.reflect.NativeMethodAccessorImpl.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object; (104 bytes) @ 0x000000000391e63c [0x000000000391d440+0x11fc]
J 1937 C1 sun.reflect.DelegatingMethodAccessorImpl.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object; (10 bytes) @ 0x00000000038cc3cc [0x00000000038cc2c0+0x10c]
J 1936 C1 java.lang.reflect.Method.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object; (62 bytes) @ 0x00000000038cbdf4 [0x00000000038cba00+0x3f4]
j  org.codehaus.mojo.exec.ExecJavaMojo$1.run()V+93
j  java.lang.Thread.run()V+11
v  ~StubRoutines::call_stub

I think the SizeTpointer gives a allergic reaction?


boolean setup1 = libpostal.libpostal_setup();
boolean setup2 = libpostal.libpostal_setup_language_classifier();
boolean setup3 = libpostal.libpostal_setup_datadir("C:/libpostal".getBytes(Charset.forName("UTF-8")));
boolean setup4 = libpostal.libpostal_setup_language_classifier_datadir("C:/libpostal".getBytes(Charset.forName("UTF-8")));
libpostal.libpostal_normalize_options_t options = libpostal.libpostal_get_default_options();
SizeTPointer sizeTPointer = new SizeTPointer();
Object object = libpostal.libpostal_expand_address("Quatre vingt douze Ave des Champs-Elysees".getBytes(Charset.forName("UTF-8")), options, sizeTPointer);
libpostal.libpostal_teardown_language_classifier();
libpostal.libpostal_teardown();

Maurice Betzel

unread,
Dec 19, 2017, 4:52:43 AM12/19/17
to javacpp
If i put in the string as Bytepointer i get a response for parse address:

boolean setup1 = libpostal.libpostal_setup();
boolean setup3 = libpostal.libpostal_setup_datadir("C:/libpostal".getBytes(Charset.forName("UTF-8")));
boolean setup2 = libpostal.libpostal_setup_parser();
libpostal.libpostal_address_parser_options_t options = libpostal.libpostal_get_address_parser_default_options();
String address = "781 Franklin Ave Crown Heights Brooklyn NYC NY 11216 USA";
BytePointer bytePointer = new BytePointer(address, "UTF-8");
libpostal.libpostal_address_parser_response_t response = libpostal.libpostal_parse_address(bytePointer, options);
libpostal.libpostal_teardown();
libpostal.libpostal_teardown_parser();

Maurice Betzel

unread,
Dec 19, 2017, 5:49:22 AM12/19/17
to javacpp
Got it working now:

boolean setup1 = libpostal.libpostal_setup();
BytePointer trainingDataPath = new BytePointer("C:/libpostal", "UTF-8");
boolean setup3 = libpostal.libpostal_setup_datadir(trainingDataPath);
boolean setup2 = libpostal.libpostal_setup_language_classifier();
libpostal.libpostal_normalize_options_t options = libpostal.libpostal_get_default_options();
SizeTPointer sizeTPointer = new SizeTPointer(0);
BytePointer address = new BytePointer("Quatre vingt douze Ave des Champs-Elysees", "UTF-8");
PointerPointer pointerPointer = libpostal.libpostal_expand_address(address, options, sizeTPointer);
long t_size = sizeTPointer.get(0);
for (long i = 0; i < t_size; i++) {
System.out.println(pointerPointer.getString(i));
}
libpostal.libpostal_teardown();
libpostal.libpostal_teardown_language_classifier();

Maurice Betzel

unread,
Dec 19, 2017, 5:54:25 AM12/19/17
to javacpp
And:

boolean setup1 = libpostal.libpostal_setup();
BytePointer trainingDataPath = new BytePointer("C:/libpostal", "UTF-8");
boolean setup3 = libpostal.libpostal_setup_datadir(trainingDataPath);
boolean setup2 = libpostal.libpostal_setup_parser();
libpostal.libpostal_address_parser_options_t options = libpostal.libpostal_get_address_parser_default_options();
BytePointer address = new BytePointer("781 Franklin Ave Crown Heights Brooklyn NYC NY 11216 USA", "UTF-8");
libpostal.libpostal_address_parser_response_t response = libpostal.libpostal_parse_address(address, options);
long count = response.num_components();
for (int i = 0; i < count; i++) {
System.out.println(response.labels(i).getString() + " " + response.components(i).getString());
}
libpostal.libpostal_teardown();
libpostal.libpostal_teardown_parser();

Maurice Betzel

unread,
Dec 19, 2017, 5:58:57 AM12/19/17
to javacpp
How do i cleanup this api, with helper classes within the org.bytedeco.javacpp package?

Samuel Audet

unread,
Dec 19, 2017, 6:00:14 AM12/19/17
to javacpp
You could, but there should already be overloaded methods using String.

Maurice Betzel

unread,
Dec 19, 2017, 6:09:46 AM12/19/17
to javacpp
Nope, no String but byte[] and JavaCCP types. Just committed the last version: libpostal

Maurice Betzel

unread,
Dec 19, 2017, 6:52:31 AM12/19/17
to javacpp
If i use the byte[] methodes it hangs or produces a access violation. How can i suppress generating these methods in javacpp-presets?

Samuel Audet

unread,
Dec 19, 2017, 8:06:42 AM12/19/17
to javacpp...@googlegroups.com
We can add more Info for that. By default it maps `const char*` to
String, but we can do the same with `char*`:
https://github.com/bytedeco/javacpp/blob/master/src/main/java/org/bytedeco/javacpp/tools/InfoMap.java#L89

Note that String is immutable, so you don't want to get rid of the
BytePointer and byte[] ones.

Maurice Betzel

unread,
Dec 19, 2017, 8:52:11 AM12/19/17
to javacpp
Following result, i am to stupid for this:

public void map(InfoMap infoMap) {
infoMap.put(new Info("LIBPOSTAL_EXPORT").cppTypes().annotations())
.put(new Info("char").valueTypes("byte").pointerTypes("@Cast(\"char*\") BytePointer", "String"));
}

C:\msys64\home\betzm\javacpp-presets-libpostal\libpostal\target\classes\org\bytedeco\javacpp\jnilibpostal.cpp(2445): error C2664: 'libpostal_address_parser_response_t *libpostal_parse_address(char *,libpostal_address_parser_options_t)': cannot convert argument 1 from 'const char *' to 'char *'

Samuel Audet

unread,
Dec 19, 2017, 10:46:43 PM12/19/17
to javacpp
We'll need a cast for the String as well in the case, so this should work:
.put(new Info("char").cast().valueTypes("byte").pointerTypes("BytePointer", "String"))

Maurice Betzel

unread,
Dec 20, 2017, 2:55:35 AM12/20/17
to javacpp
The compiler says:
 
C:\msys64\home\betzm\javacpp-presets-libpostal\libpostal\target\classes\org\bytedeco\javacpp\jnilibpostal.cpp(2606): error C2440: '=': cannot convert from 'char **' to 'const char *'
C:\msys64\home\betzm\javacpp-presets-libpostal\libpostal\target\classes\org\bytedeco\javacpp\jnilibpostal.cpp(2606): note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast

Something more got stuck...

Samuel Audet

unread,
Dec 20, 2017, 3:14:22 AM12/20/17
to javacpp
Can you show me the Java declaration this corresponds to?

Maurice Betzel

unread,
Dec 20, 2017, 3:22:48 AM12/20/17
to javacpp

Maurice Betzel

unread,
Dec 20, 2017, 4:33:16 AM12/20/17
to javacpp
It is targeted on the following methods where instead of byte array there should be a cast to String to replace byte[] input and byte[] address:

public static native @Cast("char**") PointerPointer libpostal_expand_address(@Cast("char*") BytePointer input, @ByVal libpostal_normalize_options_t options, @Cast("size_t*") SizeTPointer n);
public static native @Cast("char**") @ByPtrPtr ByteBuffer libpostal_expand_address(@Cast("char*") ByteBuffer input, @ByVal libpostal_normalize_options_t options, @Cast("size_t*") SizeTPointer n);
public static native @Cast("char**") @ByPtrPtr byte[] libpostal_expand_address(@Cast("char*") byte[] input, @ByVal libpostal_normalize_options_t options, @Cast("size_t*") SizeTPointer n);


public static native libpostal_address_parser_response_t libpostal_parse_address(@Cast("char*") BytePointer address, @ByVal libpostal_address_parser_options_t options);
public static native libpostal_address_parser_response_t libpostal_parse_address(@Cast("char*") ByteBuffer address, @ByVal libpostal_address_parser_options_t options);
public static native libpostal_address_parser_response_t libpostal_parse_address(@Cast("char*") byte[] address, @ByVal libpostal_address_parser_options_t options);

Samuel Audet

unread,
Dec 20, 2017, 7:30:27 AM12/20/17
to javacpp
Could you post the details of that along with the other issue you're having with autoconf on the GitHub issue page to make that easier to track?

Thanks!

2017/12/20 18:33 "Maurice Betzel" <betze...@gmail.com>:
--

Maurice Betzel

unread,
Dec 20, 2017, 10:03:34 AM12/20/17
to javacpp
Just added the preset in a OSGi service and working great sofar: WOHOOOOO!
Issue is posted, thanks for your help so far, i will setup the build for Linux in the next few days.

Maurice Betzel

unread,
Dec 25, 2017, 6:09:46 AM12/25/17
to javacpp
Trying to make things work for this build i now get a:

java.lang.UnsatisfiedLinkError: no jnilibpostal in java.library.path
    at java
.lang.ClassLoader.loadLibrary(ClassLoader.java:1867)
    at java
.lang.Runtime.loadLibrary0(Runtime.java:870)
    at java
.lang.System.loadLibrary(System.java:1122)
    at org
.bytedeco.javacpp.Loader.loadLibrary(Loader.java:976)
    at org
.bytedeco.javacpp.Loader.load(Loader.java:777)
    at org
.bytedeco.javacpp.Loader.load(Loader.java:684)
    at org
.bytedeco.javacpp.libpostal.<clinit>(libpostal.java:10)
    at eu
.abeel.email.pdf.Main5.main(Main5.java:31)
    at sun
.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun
.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun
.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java
.lang.reflect.Method.invoke(Method.java:498)
    at org
.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:282)
    at java
.lang.Thread.run(Thread.java:748)
Caused by: java.lang.UnsatisfiedLinkError: C:\Users\betzm\.javacpp\cache\libpostal-1.0.0-1.3-windows-x86_64.jar\org\bytedeco\javacpp\windows-x86_64\jnilibpostal.dll: Can't find dependent libraries
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941)
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1824)
    at java.lang.Runtime.load0(Runtime.java:809)
    at java.lang.System.load(System.java:1086)
    at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:956)
    ... 10 more

Trying not to swear, it is Christmas after all.

Samuel Audet

unread,
Dec 25, 2017, 7:12:14 AM12/25/17
to javacpp
How is it different from the previous build?

Maurice Betzel

unread,
Dec 25, 2017, 8:07:21 AM12/25/17
to javacpp
The libpostal-1.dll was not in the jar. I now do a rename of the dll like this:

cp src/.libs/libpostal-1.dll ../bin/libpostal.dll

But now i am getting null pointers on return values in my test project.
Somehow my build produces a invalid library as opposed to the downloaded appveyor build:

windows-x86_64)
cp -rf windows/* ./
cwd=$(pwd)
bash -lc "cd $cwd && autoreconf -fi --warning=no-portability"
#./configure --datadir=/c [...some dir with a few GB of space...]
./configure --disable-data-download
make -j4
make install
lib.exe /def:libpostal.def /out:libpostal.lib /machine:x64
mkdir -p ../bin
mkdir -p ../lib
mkdir -p ../include
cp src/.libs/libpostal-1.dll ../bin/libpostal.dll
cp libpostal.lib ../lib
cp src/libpostal.h ../include
;;
*)

Maurice Betzel

unread,
Dec 25, 2017, 8:41:45 AM12/25/17
to javacpp
I did a rebuild with .configure --datadir=/c to test the executables from the console and now all is fine. Console is working and my maven test project also. I am not found of such behavior.
Reply all
Reply to author
Forward
0 new messages