benibela / internettools

XPath/XQuery 3.1 interpreter for Pascal with compatibility modes for XPath 2.0/XQuery 1.0/3.0, custom and JSONiq extensions, pattern matching, XML/HTML/JSON parsers and classes for HTTP/S requests
http://www.benibela.de/sources_en.html#internettools
122 stars 35 forks source link

Android build problem #24

Closed Nenirey closed 3 years ago

Nenirey commented 3 years ago

I am try to use internettools in a Lazarus project with LAMW for android (ARMv6) and when i try to build the compiler fail with this code: FLRE.pas(23075,0) Error: Error while assembling exitcode 1 am just want to use an htmlparser (with templates preferible) to extract data from an html document, is always needed the FLRE library?

Nenirey commented 3 years ago

i found that you can use regexpr instead but

ERROR Default regexpr cannot be used with fpc 3.2.0 due to not accepting empty input string

if i comment this line then other error is show: xquery__parse.pas(4499,16) Error: Illegal type conversion: "LongInt" to "TXQSequenceTypeFlags"

benibela commented 3 years ago

am just want to use an htmlparser (with templates preferible) to extract data from an html document, is always needed the FLRE library?

The html parser itself does not need it, since a few days. Just do uses simplehtmltreeparser

FLRE.pas(23075,0) Error: Error while assembling exitcode 1

Have you used my version or bero's version? Might be a FPC issue, or a wrong NDK version

ERROR Default regexpr cannot be used with fpc 3.2.0 due to not accepting empty input string

I am using FreePascal's trunk from SVN, r47006, for Android

xquery__parse.pas(4499,16) Error: Illegal type conversion: "LongInt" to "TXQSequenceTypeFlags"

Did you set packset somewhere? Such an error comes with {$PackSet 1}, but it has always worked with the default or with {$PackSet 4}

Nenirey commented 3 years ago

The html parser itself does not need it, since a few days. Just do uses simplehtmltreeparser

and i can use templetes with simplehtmltreeparser?

Have you used my version or bero's version? Might be a FPC issue, or a wrong NDK version

i try with both and have the same error flag, NDK is not use yet because the compiler detect the error before the linker

Did you set packset somewhere? Such an error comes with {$PackSet 1}, but it has always worked with the default or with {$PackSet 4}

i not used, at lest intentionally, where i can find it?

i see changes on the regexp lib that's now support empty results, maybe you can update and remove the flag

benibela commented 3 years ago

and i can use templetes with simplehtmltreeparser?

No

i try with both and have the same error flag, NDK is not use yet because the compiler detect the error before the linker

I think the assembling happens after the compiling and before linking, by calling arm-linux-androideabi-as

And FreePascal might print additional error messages that are hidden by Lazarus (right click on the message window)

i not used, at lest intentionally, where i can find it?

Perhaps there is a compiler flag? But does not look like it.

You could put {$PackSet 4} at the top of the failing unit.

i see changes on the regexp lib that's now support empty results, maybe you can update and remove the flag

When they build a new version with FreePascal, they are going to call it 3.2.2, and then it will work anyways. But I have stopped that regexp because it did not support utf-8

Nenirey commented 3 years ago

But I have stopped that regexp because it did not support utf-8

so you recommend that use flre?

i must use your version or the bero's version?

what NDK version i need to build for android?

Nenirey commented 3 years ago

it work now with your {$PackSet 4} recomendation, but with regexp

benibela commented 3 years ago

so you recommend that use flre?

If you plan to use (Unicode) regular expressions

i must usle your version or the bero's version?

Bero's has some unfixed issues, e.g. https://github.com/BeRo1985/flre/issues/58

what NDK version i need to build for android?

I use this:

$ opt/android/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-as --version
GNU assembler (GNU Binutils) 2.21
Copyright 2010 Free Software Foundation, Inc.
$ opt/android/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-ld --version
GNU gold (GNU Binutils 2.27.0.20170315) 1.12
Copyright (C) 2016 Free Software Foundation, Inc.
Nenirey commented 3 years ago

Very thanks for your help and great work, but the way i see in the free pascal wiki that regexp now support unicode:

Support Unicode categories: \pL \p{L} \p{Lu}, with negative \P. Support control escape sequences: \cA ... \cZ. Support recursion: (?R) and (?0). Support subroutine calls: (?1) ... (?80), and to named groups: (?P>name). Added define FastUnicodeData, which uses additional arrays to speed-up Unicode functions in Unicode mode. Added unit regexpr_unicodedata. Added backward search possibility (ABackward parameter). Added possibility to test regex at single offset without advancing to next positions (ATryOnce parameter). Support NULL chars, both in regex and in the input string. Support Unicode bigger than U+FFFF, ie emoji symbols. Dot, \W, \S, \D etc now should correctly find 2 WideChars for 1 emoji.

benibela commented 3 years ago

but the way i see in the free pascal wiki that regexp now support unicode:

It still does not work:

var
  RegexObj: TRegExpr;
begin
  RegexObj := TRegExpr.Create;
  RegexObj.Expression := '^.$';
  if RegexObj.Exec('ä') then WriteLn('found right');
  RegexObj.Expression := '^..$';
  if RegexObj.Exec('ä') then WriteLn('found wrong' );
  RegexObj.Free;

end.                  

Looks like they ship a non-Unicode version