benibela / xidel

Command line tool to download and extract data from HTML/XML pages or JSON-APIs, using CSS, XPath 3.0, XQuery 3.0, JSONiq or pattern matching. It can also create new or transformed XML/HTML/JSON documents.
http://www.videlibri.de/xidel.html
GNU General Public License v3.0
681 stars 42 forks source link

Compiling xidel using cross compiler for mips platform ? #36

Closed Baltazar500 closed 4 years ago

Baltazar500 commented 5 years ago

Hello.

How to compile the xidel binary for the mips platform using this cross-compiler http://www.codesourcery.com/sgpp/lite/mips/portal/package4432/public/mips-linux-gnu/mips-4.3-154-mips- linux-gnu-i686-pc-linux-gnu.tar.bz2 ? I use debian and I need to build a binary file for the Dune HD media player, which is based on mips. Simple build examples using gcc or make do not cause problems, but xidel uses FreePascal and I don’t know how to build a binary :(

Need to install free pascal? Package "fpc" ? And use build.sh with command line switches ? What are the command line switches ?

Sorry, I'm newbie

benibela commented 4 years ago

You need a freepascal cross compiler. Since there is probably no package for that you need to compile freepascal first. Get it with svn clone https://svn.freepascal.org/svn/fpc/trunk

It can be compiled with something like sudo make crossinstall OS_TARGET=linux CPU_TARGET=mips. Or CPU_TARGET=mipsel for little endian

It likely needs ld, as and crt* from the package you have linked. It searchs for files like mips-linux-as and mips-linux-ld, so the easiest way is to copy them to the $PATH and rename them. You can configure the path to crt in ~/.fpc.cfg, like:

 #IFDEF mips
 -Fl/...basepath.../lib/gcc/mips-linux-gnu/4.3.3
 #endif

And use build.sh with command line switches ? What are the command line switches ?

fpc's compiler is actually called ppc*. The cross compiler probably something like ppcmips, so you need to call it with build.sh --compiler ppcmips. Then it uses the cross compiler. You might need to set -Pmips to set the target cpu, otherwise it might try to use the cross compiler to create a x86 xidel version, but the script has no option for that, then you need to put -Pmips in the script code

Baltazar500 commented 4 years ago

For me, building xidel using free pascal turned out to be impossible :(

I do not have enough experience and knowledge to compile.

Is it possible in the future that xidel will be built for mips from you?

zpimp commented 4 years ago

dont have anything useful to contribute to the discussion :) im just curious about the machine you intend to run it on, if you can share a link

Baltazar500 commented 4 years ago

im just curious about the machine you intend to run it on, if you can share a link

For mips Dune HD TV-102 media player

uname -a

Linux tangox 2.6.32.15-27-sigma #3 PREEMPT Fri Dec 19 09:26:17 UTC 2014 mips GNU/Linux

Baltazar500 commented 4 years ago

cat /proc/cpuinfo

system type : Sigma Designs TangoX SMP8XXX Chip ID : 8674 SMP8XXX Rev ID : 2 System bus frequency : 351000000 Hz CPU frequency : 702000000 Hz DSP frequency : 351000000 Hz

processor : 0 cpu model : MIPS 24Kc V7.12 FPU V0.0 BogoMIPS : 467.96 wait instruction : yes microsecond timers : yes tlb_entries : 32 extra interrupt vector : yes hardware watchpoint : yes, count: 4, address/irw mask: [0x0ffc, 0x0ffc, 0x0ffb, 0x0ffb] ASEs implemented : mips16 shadow register sets : 1 core : 0 VCED exceptions : not available VCEI exceptions : not available

gnfalex commented 4 years ago

Greetings. Sorry for bad English and ugly code.

In attachment - script for crossbuilding xidel from Debian 10 (Buster) x86 to mipsel-linux. build_xidel_mipsel.txt

Patch for synapse/ssfpc.inc based on lines 32-39 of socketsh.inc from FPC source - https://svn.freepascal.org/svn/fpc/trunk/packages/rtl-extra/src/inc/socketsh.inc

Best Regards, Alexey.

benibela commented 4 years ago

That is a good description, so if someone needs mips they can follow those instructions.