SoftwareNetwork / sw

Software Manager. Build System, Build System Generator and Package Manager. C/C++ and other languages. Tools and libraries for Software Management.
https://software-network.org
Other
115 stars 23 forks source link

Compile Tesseract beta release on AMD64 and ARM64 platforms #82

Closed janftacnik closed 1 year ago

janftacnik commented 2 years ago

I am trying to build Tesseract beta 5.0 release using sw.exe. On Intel 64 bit platform I found a way - I have downloaded source, extracted to directory and in that directory I just said: sw.exe build -static . Version tesseract-5.0.0-beta-20210916 worked fine, everything is built and also works. I wanted to repeat the same for ARM64 on Surface X, Visual Studio 2019, command line setup for amd64_arm64 "Environment initialized for: 'x64_arm64'" - there is always cross compilation on Windows on Arm on ARM64 hardware, because Visual Studio is not native arm64 yet. I tried logically same approach: sw.exe build -static -platform=arm64 . but it looks like support for ARM64 target in VS in sw.exe is not yet full - I got errors like: [1/10] Check WORDS_BIGENDIAN requires to be set up manually [5/10] Check HAVE_SIZEOF_WCHAR_T requires to be set up manually [3/10] Check HAVE_SIZEOF_SIZE_T requires to be set up manually [4/10] Check HAVE_SIZEOF_VOID_P requires to be set up manually [2/10] Check HAVE_LONG_LONG_INT requires to be set up manually I tried to fix them by hand in respective checks.3.txt.manual.txt file, but handling second library (libarchive) I got even more of those errors: [201/256] Check HAVE_OFF_T requires to be set up manually [204/256] Check HAVE_SIZEOF_UINTPTR_T requires to be set up manually [207/256] Check HAVE_DEV_T requires to be set up manually [209/256] Check HAVE_INTMAX_T requires to be set up manually [215/256] Check HAVE_SIZEOF_UNSIGNED requires to be set up manually [216/256] Check HAVE_INTPTR_T requires to be set up manually [218/256] Check HAVE_INT32_T requires to be set up manually [223/256] Check HAVE_SIZEOF_UINT32_T requires to be set up manually [227/256] Check HAVE_SIZEOF_UINTMAX_T requires to be set up manually [228/256] Check HAVE_SIZEOF_UINT16_T requires to be set up manually [229/256] Check HAVE_SIZEOF_UINT8_T requires to be set up manually [233/256] Check HAVE_INT64_T requires to be set up manually [236/256] Check HAVE_INT16_T requires to be set up manually [239/256] Check HAVE_LONG requires to be set up manually [241/256] Check HAVE_SIZEOF_UINT64_T requires to be set up manually

My question is - in swgui one can see as a possible target ARM64, Is there a way to compile tesseract beta release using sw.exe ? I managed to build ARM64 static version of tesseract using vcpkg, but it takes only released version 4.1 of tesseract and I would like to have 5.0 using beta. Thank you in advance for anny comment on this. Jan Ftacnik, jan.ftacnik@oki.cz

egorpugin commented 2 years ago

Hi,

Sw uses configuration checks to provide options to libraries. We can check size of long, for example, only on the ARM system or to provide its values manually. That is why you see such messages.

Check HAVE_LONG requires to be set up manually

To perform these checks on remote ARM host, use following options -wait-for-cc-checks -cc-checks-command some_script.bat

That script must:

  1. copy (or rsync) all files in cwd to some remote dir
  2. run ./run.sh script in that dir
  3. copy checks.3.txt.manual.txt file back

Excerpts from my macos remote checks script:

    set checksdir=sw_checks_dir

...

    ssh egor@%ip% "mkdir %checksdir%"
    bash -c "rsync -v -e \"ssh\" ./* egor@%ip%:/Users/egor/%checksdir%/1/"
    ssh egor@%ip% "cd %checksdir%/1 && ./run.sh"
    bash -c "rsync -v -e \"ssh\" egor@%ip%:/Users/egor/%checksdir%/checks.3.txt.manual.txt .."
    ssh egor@%ip% "rm -rf %checksdir%"