Re: [fpc-devel] FPC -Rintel and -alr options
Yes, you are right. I just comment out the options within fpc.cfg after I got the asm files (*.s) for study. On 8/21/2012 00:53, Sven Barth wrote: Am 21.08.2012 09:35, schrieb ABorka: This is exactly what I needed. "-alr -sr -Amasm" does it. I just put them into my "fpc.cfg" . Why did you put this into your fpc.cfg? You are aware that with the "-s" switch no binary code is generated? Or are you protecting that with an IFDEF? Regards, Sven ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] FPC -Rintel and -alr options
It would be nice to see it work with objdump also, but not a priority. With your help guys I was able to get the needed output using the fpc.cfg and the FPC parameters you guys mentioned. Thanks for the help <...snip...> On 8/21/2012 00:19, Sergei Gorelkin wrote: 21.08.2012 10:32, ABorka пишет: 1. The objdump ("objdump.exe" and "x86_64-win64-objdump.exe") utility from the binutils programs works and displays the code with the -Mintel option as Intel syntax from the "*.o" files, however when I try to see the line numbers (objdump.exe -l ...) and source code lines (objdump.exe -S ...) it does not put them in the right places within the disassembled code. As an example, I used: objdump.exe -d -Mintel -w -l -S -EL something.o > something.disassembled This may be an issue to fix (or maybe not, given that gdb usually locates source lines correctly using the same line information from the object files). <...snip...> ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] FPC -Rintel and -alr options
This is exactly what I needed. "-alr -sr -Amasm" does it. I just put them into my "fpc.cfg" . Thanks for all the help guys. On 8/21/2012 00:16, Jonas Maebe wrote: On 21 Aug 2012, at 08:32, ABorka wrote: On 8/20/2012 22:37, Sergei Gorelkin wrote: -R switch controls parsing assembler blocks in the code. The output format is set with -A (e.g. -Amasm will produce Intel syntax). That requires masm to compile the project. Only if the compiler calls the assembler. You can use the -s parameter to prevent it from doing that. Jonas___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] FPC -Rintel and -alr options
That requires masm to compile the project. What I actually want is to see the disassembled code from my project (as Intel Syntax assembly code) to look at how the win32 and win64 code is optimized and then to fine tune the pascal source. 1. The objdump ("objdump.exe" and "x86_64-win64-objdump.exe") utility from the binutils programs works and displays the code with the -Mintel option as Intel syntax from the "*.o" files, however when I try to see the line numbers (objdump.exe -l ...) and source code lines (objdump.exe -S ...) it does not put them in the right places within the disassembled code. As an example, I used: objdump.exe -d -Mintel -w -l -S -EL something.o > something.disassembled 2. The fpc "-al" flag generates a nice "*.s" assembler file during compilation, where everything is in place, except it is not Intel syntax assembly but AT&T. Anyone had experience with something like this (display the disassembled code of a project unit/object_file in Intel syntax, with source code lines)? Thanks for any help On 8/20/2012 22:37, Sergei Gorelkin wrote: 21.08.2012 5:38, ABorka пишет: Is there a way to see the generated ".s" assembly files as Intel syntax instead of the AT&T one? The -Rintel flag does not seem to work, or I am doing something wrong. Tried command line and fpc.cfg both, on win32 and win64, latest SVN . -R switch controls parsing assembler blocks in the code. The output format is set with -A (e.g. -Amasm will produce Intel syntax). Regards, Sergei ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] FPC -Rintel and -alr options
For example fpc -Rintel -alr -MObjFPC -Scgi -O1 -Twin32 -Pi386 -g -gl -WG -vewnhi -l -FuC:\...something... -FuC:\lazarus\lcl\units\i386-win32\win32 -FuC:\lazarus\lcl\units\i386-win32 -FuC:\lazarus\components\lazutils\lib\i386-win32 -FuC:\lazarus\packager\units\i386-win32 -FuC:\...something...\ -FUC:\...something...\lib\i386-win32\ -oMyProgram-win32.exe -dLCL -dLCLwin32 MyProgram.lpr The "*.s" files are there, but all are in AT&T syntax, not Intel Tried to put -Rintel and -alr into the fpc.cfg also, with the same result. On 8/20/2012 20:26, waldo kitty wrote: On 8/20/2012 21:38, ABorka wrote: Is there a way to see the generated ".s" assembly files as Intel syntax instead of the AT&T one? The -Rintel flag does not seem to work, or I am doing something wrong. Tried command line and fpc.cfg both, on win32 and win64, latest SVN . what command line, exactly, please? ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
[fpc-devel] FPC -Rintel and -alr options
Is there a way to see the generated ".s" assembly files as Intel syntax instead of the AT&T one? The -Rintel flag does not seem to work, or I am doing something wrong. Tried command line and fpc.cfg both, on win32 and win64, latest SVN . ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
[fpc-devel] 64 bit integer result in Win32 problem
Hi, Win32 .exe compiled on Win64 computer, latest SVN build. I am trying to multiply 2 Integers (Declared as LongInt but sometimes need to use it as LongWord) and put the result into a QWord (64bit unsigned) result variable on Win32. However, it seems that the result is always cut to 32bit. Checked the assembler window inside Lazarus and there is a "mull" instruction and immediately after that there is a zeroing out of the "EDX" register cutting the "EDX:EAX" result short. Simplified example: var A: LongInt; C: QWord; begin A := $12345678; C := LongWord(A) * LongWord(255); . . . end; Am I doing something wrong in the code to accomplish this? in Assembly it could be something like: asm//Intel syntax mov edx, $12345678 mov eax, 255 mul edx ...store end; which would store the 64 bit result from EDX:EAX However, the code actually generated is something like: asm//Lazarus syntax mull ... mov $0x0, %edx <- why is this here? then stores both eax and edx into the variable end; Thanks for any help, AB PS: Any way to see the assembler window in Intel assembly syntax? ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] Crosscompiling problem on Win7 64bit
SVN 22101 works Thx On 8/17/2012 00:45, Thomas Schatzl wrote: Hi, On Fri, 2012-08-17 at 00:37 -0700, ABorka wrote: The error comes during the make all OS_TARGET=win64 CPU_TARGET=x86_64 <=== error comes here [..] Can you please update to latest or make sure you're on the latest revision? There has been a change that broke cross-compilation that has been reverted recently. Thomas ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] Crosscompiling problem on Win7 64bit
The error comes during the make all OS_TARGET=win64 CPU_TARGET=x86_64 <=== error comes here not in the following "make install..." command No change after executing the fpc-2.6.0.x86_64-win64.exe installation to the original fpc-2.6.0.i386-win32.exe On 8/16/2012 23:37, Gennadiy Poryev wrote: Try that make install CROSSINSTALL=1 CPU_TARGET=x86_64 OS_TARGET=win64 SNAPSHOT=1 also make sure win64 binutils are available in the PATH. worked for me in the same scenario. -Original Message- From: fpc-devel-boun...@lists.freepascal.org [mailto:fpc-devel- boun...@lists.freepascal.org] On Behalf Of ABorka Sent: Friday, August 17, 2012 9:05 AM To: FPC developers' list Subject: [fpc-devel] Crosscompiling problem on Win7 64bit Hi, I was not able to create a cross-compiled version of the SVN trunk FPC for some reason. Win7 64bit (FPC 2.6.0 -> 2.7.1) 1. Brand new system, installed the 2.6.0 FPCOK 2. Compiled the default 32bit FPC OK 3. Tried to compile the 64bit cross library and getting the following: "Error: Illegal parameter: -Twin64" (see output at the bottom of my email) - Here is my Windows .bat file === @rem 1st clean compile PATH=C:\FPC\2.6.0\bin\i386-win32; SET FPC=C:\FPC\2.6.0\bin\i386-win32\fpc.exe cd \mydir\fpc\fpc_svn @rem 32bit make clean distclean make all make install make clean @rem 64bit make all OS_TARGET=win64 CPU_TARGET=x86_64 <=== error comes here make crossinstall OS_TARGET=win64 CPU_TARGET=x86_64 make clean OS_TARGET=win64 CPU_TARGET=x86_64 = Something like this worked with the previous FPC versions (2.4.0 -> 2.5.1) What has changed and what am I doing wrong? Thanks for any help. AB PS: Here is the end of the output of the "make all OS_TARGET=win64 CPU_TARGET=x86_64" . . . fmtbcd.pp(3845,33) Warning: Implicit string type conversion with potential data loss from "UnicodeString" to "AnsiString" signals.pp(490,44) Warning: Conversion between ordinals and pointers is not portable C:/mydir/fpc/fpc_svn/compiler/ppcrossx64.exe -Twin64 -Px86_64 -XPx86_64-win64- -Xr -Ur -Xs -O2 -n -Fi../inc -Fi../x86_64 -FE. -FUC:/mydir/fpc/fpc_svn/rtl/units/x86_64-win64 -dx86_64 -dRELEASE ../inc/macpas.pp C:/mydir/fpc/fpc_svn/compiler/ppcrossx64.exe -Twin64 - Px86_64 -XPx86_64-win64- -Xr -Ur -Xs -O2 -n -Fi../inc -Fi../x86_64 -FE. -FUC:/mydir/fpc/fpc_svn/rtl/units/x86_64-win64 -dx86_64 -dRELEASE ../inc/iso7185.pp C:/mydir/fpc/fpc_svn/compiler/ppcrossx64.exe -Twin64 - Px86_64 -XPx86_64-win64- -Xr -Ur -Xs -O2 -n -Fi../inc -Fi../x86_64 -FE. -FUC:/mydir/fpc/fpc_svn/rtl/units/x86_64-win64 -dx86_64 -dRELEASE ../inc/lineinfo.pp C:/mydir/fpc/fpc_svn/compiler/ppcrossx64.exe -Twin64 - Px86_64 -XPx86_64-win64- -Xr -Ur -Xs -O2 -n -Fi../inc -Fi../x86_64 -FE. -FUC:/mydir/fpc/fpc_svn/rtl/units/x86_64-win64 -dx86_64 -dRELEASE ../inc/lnfodwrf.pp make[3]: Leaving directory `C:/mydir/fpc/fpc_svn/rtl/win64' make[2]: Leaving directory `C:/mydir/fpc/fpc_svn/rtl' make[1]: Leaving directory `C:/mydir/fpc/fpc_svn' make packages_all FPC=C:/mydir/fpc/fpc_svn/compiler/ppcrossx64.exe RELEASE=1 make[1]: Entering directory `C:/mydir/fpc/fpc_svn' make -C packages all make[2]: Entering directory `C:/mydir/fpc/fpc_svn/packages' make -C fpmkunit bootstrap make[3]: Entering directory `C:/mydir/fpc/fpc_svn/packages/fpmkunit' C:/mydir/fpc/fpc_svn/compiler/ppc.exe src/fpmkunit.pp -n -Twin64 -Px86_64 -XPx86_64-win64- -Xr -Ur -Xs -O2 -n -FuC:/mydir/fpc/fpc_svn/rtl/units/x86_64-win64 -FuC:/mydir/fpc/fpc_svn/packages/paszlib -FuC:/mydir/fpc/fpc _svn/packages/fcl-process -FuC:/mydir/fpc/fpc_svn/packages/hash -FE. -FUunits/x86_64-win64 -dx86_64 -dRELEASE -FuC:/mydir/fpc/fpc_svn/rtl/units/i386-win32 -FuC:/mydir/fpc/fpc_svn/packages/paszlib -FuC:/mydir/fpc/fpc_ svn/packages/fcl-process -FuC:/mydir/fpc/fpc_svn/packages/hash -FUunits_bs/i386-win32 -Fu../paszlib/src -Fu../hash/src -Fi../paszlib/src - Fi../fcl-process/src/win -Fu../fcl-process/src -Fi../fcl-process/src/win32 -Fi../fcl-process/src/dummy Error: Illegal parameter: -Twin64 make[3]: *** [bootstrap] Error 1 make[3]: Leaving directory `C:/mydir/fpc/fpc_svn/packages/fpmkunit' make[2]: *** [fpmkunit_bootstrap] Error 2 make[2]: Leaving directory `C:/mydir/fpc/fpc_svn/packages' make[1]: *** [packages_all] Error 2 make[1]: Leaving directory `C:/mydir/fpc/fpc_svn' make: *** [build-stamp.x86_64-win64] Error 2 === ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
[fpc-devel] Crosscompiling problem on Win7 64bit
Hi, I was not able to create a cross-compiled version of the SVN trunk FPC for some reason. Win7 64bit (FPC 2.6.0 -> 2.7.1) 1. Brand new system, installed the 2.6.0 FPCOK 2. Compiled the default 32bit FPC OK 3. Tried to compile the 64bit cross library and getting the following: "Error: Illegal parameter: -Twin64" (see output at the bottom of my email) - Here is my Windows .bat file === @rem 1st clean compile PATH=C:\FPC\2.6.0\bin\i386-win32; SET FPC=C:\FPC\2.6.0\bin\i386-win32\fpc.exe cd \mydir\fpc\fpc_svn @rem 32bit make clean distclean make all make install make clean @rem 64bit make all OS_TARGET=win64 CPU_TARGET=x86_64 <=== error comes here make crossinstall OS_TARGET=win64 CPU_TARGET=x86_64 make clean OS_TARGET=win64 CPU_TARGET=x86_64 = Something like this worked with the previous FPC versions (2.4.0 -> 2.5.1) What has changed and what am I doing wrong? Thanks for any help. AB PS: Here is the end of the output of the "make all OS_TARGET=win64 CPU_TARGET=x86_64" . . . fmtbcd.pp(3845,33) Warning: Implicit string type conversion with potential data loss from "UnicodeString" to "AnsiString" signals.pp(490,44) Warning: Conversion between ordinals and pointers is not portable C:/mydir/fpc/fpc_svn/compiler/ppcrossx64.exe -Twin64 -Px86_64 -XPx86_64-win64- -Xr -Ur -Xs -O2 -n -Fi../inc -Fi../x86_64 -FE. -FUC:/mydir/fpc/fpc_svn/rtl/units/x86_64-win64 -dx86_64 -dRELEASE ../inc/macpas.pp C:/mydir/fpc/fpc_svn/compiler/ppcrossx64.exe -Twin64 -Px86_64 -XPx86_64-win64- -Xr -Ur -Xs -O2 -n -Fi../inc -Fi../x86_64 -FE. -FUC:/mydir/fpc/fpc_svn/rtl/units/x86_64-win64 -dx86_64 -dRELEASE ../inc/iso7185.pp C:/mydir/fpc/fpc_svn/compiler/ppcrossx64.exe -Twin64 -Px86_64 -XPx86_64-win64- -Xr -Ur -Xs -O2 -n -Fi../inc -Fi../x86_64 -FE. -FUC:/mydir/fpc/fpc_svn/rtl/units/x86_64-win64 -dx86_64 -dRELEASE ../inc/lineinfo.pp C:/mydir/fpc/fpc_svn/compiler/ppcrossx64.exe -Twin64 -Px86_64 -XPx86_64-win64- -Xr -Ur -Xs -O2 -n -Fi../inc -Fi../x86_64 -FE. -FUC:/mydir/fpc/fpc_svn/rtl/units/x86_64-win64 -dx86_64 -dRELEASE ../inc/lnfodwrf.pp make[3]: Leaving directory `C:/mydir/fpc/fpc_svn/rtl/win64' make[2]: Leaving directory `C:/mydir/fpc/fpc_svn/rtl' make[1]: Leaving directory `C:/mydir/fpc/fpc_svn' make packages_all FPC=C:/mydir/fpc/fpc_svn/compiler/ppcrossx64.exe RELEASE=1 make[1]: Entering directory `C:/mydir/fpc/fpc_svn' make -C packages all make[2]: Entering directory `C:/mydir/fpc/fpc_svn/packages' make -C fpmkunit bootstrap make[3]: Entering directory `C:/mydir/fpc/fpc_svn/packages/fpmkunit' C:/mydir/fpc/fpc_svn/compiler/ppc.exe src/fpmkunit.pp -n -Twin64 -Px86_64 -XPx86_64-win64- -Xr -Ur -Xs -O2 -n -FuC:/mydir/fpc/fpc_svn/rtl/units/x86_64-win64 -FuC:/mydir/fpc/fpc_svn/packages/paszlib -FuC:/mydir/fpc/fpc _svn/packages/fcl-process -FuC:/mydir/fpc/fpc_svn/packages/hash -FE. -FUunits/x86_64-win64 -dx86_64 -dRELEASE -FuC:/mydir/fpc/fpc_svn/rtl/units/i386-win32 -FuC:/mydir/fpc/fpc_svn/packages/paszlib -FuC:/mydir/fpc/fpc_ svn/packages/fcl-process -FuC:/mydir/fpc/fpc_svn/packages/hash -FUunits_bs/i386-win32 -Fu../paszlib/src -Fu../hash/src -Fi../paszlib/src -Fi../fcl-process/src/win -Fu../fcl-process/src -Fi../fcl-process/src/win32 -Fi../fcl-process/src/dummy Error: Illegal parameter: -Twin64 make[3]: *** [bootstrap] Error 1 make[3]: Leaving directory `C:/mydir/fpc/fpc_svn/packages/fpmkunit' make[2]: *** [fpmkunit_bootstrap] Error 2 make[2]: Leaving directory `C:/mydir/fpc/fpc_svn/packages' make[1]: *** [packages_all] Error 2 make[1]: Leaving directory `C:/mydir/fpc/fpc_svn' make: *** [build-stamp.x86_64-win64] Error 2 === ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] FPC bug tracker page is sniffing user agents?
On 9/25/2011 02:54, Felipe Monteiro de Carvalho wrote: Hello, Accessing http://bugs.freepascal.org/login_page.php Using the following user agent (Opera in Mac OS X): Opera/9.80 (Macintosh; Intel Mac OS X 10.6.1; U; en) Presto/2.9.168 Version/11.50 I get: HTTP/1.1 400 Bad Request Date: Sun, 25 Sep 2011 09:48:31 GMT Server: Apache/2.2.8 (Ubuntu) DAV/2 SVN/1.6.5 PHP/5.2.4-2ubuntu5.17 with Suhosin-Patch Vary: Accept-Encoding Content-Length: 514 Connection: close Content-Type: text/html; charset=iso-8859-1 Size=514 400 Bad Request Bad Request Your browser sent a request that this server could not understand. Request header field is missing ':' separator. Opera/9.80 (Macintosh; Intel Mac OS X 10.6.1; U; en) Presto/2.9.168 Version/11.50 Apache/2.2.8 (Ubuntu) DAV/2 SVN/1.6.5 PHP/5.2.4-2ubuntu5.17 with Suhosin-Patch Server at bugs.freepascal.org Port 80 If I use the user agent from Firefox I get the propor page. I tested with a program written in fpc which can be found here (and with the browsers too, of course): http://p-tools.svn.sourceforge.net/viewvc/p-tools/httpclient/ Any ideas? AFAIK we don't have a special version of our pages, so I suppose that we should not sniff user agents. thanks, It might be totally unrelated (not sure if the bugs site uses fpweb) but we had a bug with content length being incorrect when an error message was generated in fpweb (was fixed in revision 17597). Different browsers handle the content-length header value differently, even the same browser handles it differently on different OS-es (sometimes ignores it and uses the full response page, sometimes it cuts the response page to the content-length header value which can be a problem if the value is incorrect). AB ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
[fpc-devel] Lazarus suddenly creates all config files read only among other things
OK, I just updated to the latest SVN trunk for FPC and Lazarus, and recompiled them on Linux ("make clean all" as user, then "sudo make install"). I deleted ~./lazarus to have only the basic packages at first. After executing "startlazarus" as a user from my home dir like I did a million times before, first of all it always complains that there is no fpc.cfg for the compiler (which is not true, there is one in /etc , but even if I put one into /usr/local/bin next to the fpc program it says that). Then it always complains that /usr/local/bin/fpc does not support target linux-i386 (which is interesting considering I just compiled FPC and Lazarus with it, in any case "fpc -iTOTP gives "linux i386") Then all the files created in ~./lazarus are read only, having only r-- --- --- access rights, so every time Lazarus tries to exit, it complains that it can not save the config files because they are read only. Same happens with every .res file it tries to create for new projects, etc. What could be the problem? AB ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
[fpc-devel] SVN 17548 does not compile
sysutils.pp(243,40) Error: Identifier not found "Mode" sysutils.pp(819,3) Warning: Symbol "GetLocaleFormatSettings" is not portable sysutils.pp(1277) Fatal: There were 1 errors compiling module, stopping Fatal: Compilation aborted ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
[fpc-devel] Latest FPC SVN , package fpmkunit crosscompiling failure
Latest FPC SVN 17459: Doing a "make all OS_TARGET=win64 CPU_TARGET=x86_64" crosscompiling with 32bit FPC gives the following error: = make -C fpmkunit bootstrap make[3]: Entering directory `c:/fpc_svn/packages/fpmkunit' C:/pp/bin/i386-win32/gmkdir.exe -p units_bs/i386-win32 C:\pp\bin\i386-win32\ppcrossx64.exe src/fpmkunit.pp -n -Fuc:/fpc_svn/rtl/units/i386-win32 -Fuc:/fpc_svn/packages/hash -Fuc:/fpc_svn/packages/paszlib -Fuc:/fpc_svn/packages/fcl-process -dNO_UNIT_PROCESS -dNO_UNIT_ZIPPER -FUunits_bs/i386-win32 PPU Loading C:\fpc_svn\rtl\units\i386-win32\system.ppu PPU is compiled for another processor Fatal: Can't find unit system used by fpmkunit Fatal: Compilation aborted make[3]: Leaving directory `c:/fpc_svn/packages/fpmkunit' make[2]: Leaving directory `c:/fpc_svn/packages' make[1]: Leaving directory `c:/fpc_svn' = units_bs ?? In any case, cant crosscompile FPC at the moment. AB ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
[fpc-devel] Latest SVN - make clean gives error in /packages/fppkg
Latest FPC SVN "make clean" results in: . . . make -C fppkg distclean make[2]: Entering directory `/fpc_svn/packages/fppkg' make[2]: *** No rule to make target `distclean'. Stop. make[2]: Leaving directory `/fpc_svn/packages/fppkg' make[1]: *** [fppkg_distclean] Error 2 make[1]: Leaving directory `/fpc_svn/packages' make: *** [packages_distclean] Error 2 ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] fpweb is not showing the exception message [Found the problem]
On 4/13/2011 00:07, michael.vancann...@wisa.be wrote: On Mon, 11 Apr 2011, ABorka wrote: <...snip...> OK, found the problem: fpweb does not set the content length properly when there was an exception or error message, it uses the content length from the action event handler. For example, if we have === procedure TFPWebModule1.DefActionRequest(Sender: TObject; ARequest: TRequest; AResponse: TResponse; var Handled: Boolean); begin // Handled := true; //commented out to trigger the exception error page AResponse.Content := 'Yo! (F)CGI works!'; end; === fpweb will send the content length in the response headers as the length of the string set in the event handler which is the length of 'Yo! (F)CGI works!'#13#10 in this case, and not the length of the error response page it constructs and sends back. Headers> Status: 200 OK Content-Length: 45 Content-Type: text/html This is happening on Windows XP 32bit for me for both CGI and FCGI applications if the above example is used. I would not be surprised if this problem would be there in Linux too, maybe it is just properly displayed in the browser there, no matter what the header says. Probably it more depends on the configuration of the Webserver. As far as I know, the 'content length' header is purely optional. In each case, I'll patch fpWeb so it sets the content length (if possible) Michael. Michael, if I do an Application.ProtocolOptions := Application.ProtocolOptions + [poStripContentLength]; before the Application.Run; for the FCGI application, then it fixes the problem. Of course, this does not work for CGI apps. AB ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] fpweb is not showing the exception message
On 4/13/2011 00:07, michael.vancann...@wisa.be wrote: <...snip...> On Mon, 11 Apr 2011, ABorka wrote: OK, found the problem: fpweb does not set the content length properly when there was an exception or error message, it uses the content length from the action event handler. For example, if we have === procedure TFPWebModule1.DefActionRequest(Sender: TObject; ARequest: TRequest; AResponse: TResponse; var Handled: Boolean); begin // Handled := true; //commented out to trigger the exception error page AResponse.Content := 'Yo! (F)CGI works!'; end; === fpweb will send the content length in the response headers as the length of the string set in the event handler which is the length of 'Yo! (F)CGI works!'#13#10 in this case, and not the length of the error response page it constructs and sends back. Headers> Status: 200 OK Content-Length: 45 Content-Type: text/html This is happening on Windows XP 32bit for me for both CGI and FCGI applications if the above example is used. I would not be surprised if this problem would be there in Linux too, maybe it is just properly displayed in the browser there, no matter what the header says. Probably it more depends on the configuration of the Webserver. As far as I know, the 'content length' header is purely optional. In each case, I'll patch fpWeb so it sets the content length (if possible) Michael. You might be right. After some more testing, the content length does not seem to be consistent for some reason. So far, I was not able to figure out why the response is cut short in the client browser, and when. The received content-length header is definitely not the length for the response.content in most cases. I will do some more testing as time permits, first maybe just remove all content-length headers from the responses or something similar. I was also trying to see if deflate/gzip-ing the responses on the server side by Apache makes any difference, but so far no conclusive results found. The received result pages are just cut short. AB ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] fcl-web compilation problems summary
entered as http://bugs.freepascal.org/view.php?id=19153 ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] fpweb is not showing the exception message [Found the problem]
On 4/12/2011 01:31, ABorka wrote: On 4/12/2011 00:01, michael.vancann...@wisa.be wrote: On Mon, 11 Apr 2011, ABorka wrote: I was playing today with fpweb a little, and found a simply reproducible minor problem. When one creates a new CGI or FCGI application and creates a simple default action, but NOT setting the "handled := true;" within the event handler, then some kind of exception happens within fpweb when the action is called from the client browser, but it does not return a full response error message page. All that comes back to the client is: "APPNAME: " where the APPNAME is the title for the application. This happens at least for CGI and FCGI applications, not sure about Apache modules as I did not try that. As soon, as we have "handled := true;" there, everything is OK. If we have "handled := false;" or simply not setting it, the above issue happens. It seems, that there is a problem with displaying error messages/exceptions from within fpweb internals. /Latest FPC and Lazarus SVN, WinXP 32bit/ I cannot reproduce this at least on Linux 64 bit and Windows 2000 32bit. I am working with these things full-time at the moment, and I always get the full page. Michael. Yes, it works for me too in Linux 32bit. But not in WinXP 32bit. In fact, it seems that no matter what, the response page is cut off at 30 characters. In custweb.pp of .../fcl-web/base/ , procedure ExceptionToHTML(S: TStrings; const E: Exception; const Title, Email, Administrator: string); assembles the response page, and for some reason S is only 30 characters maximum when it arrives to the client browser. If I replace the inner part of this procedure with simply With S do begin Add('longer than 30 characters here..'); end; it is still cut at 30 characters. Odd :) AB OK, found the problem: fpweb does not set the content length properly when there was an exception or error message, it uses the content length from the action event handler. For example, if we have === procedure TFPWebModule1.DefActionRequest(Sender: TObject; ARequest: TRequest; AResponse: TResponse; var Handled: Boolean); begin // Handled := true; //commented out to trigger the exception error page AResponse.Content := 'Yo! (F)CGI works!'; end; === fpweb will send the content length in the response headers as the length of the string set in the event handler which is the length of 'Yo! (F)CGI works!'#13#10 in this case, and not the length of the error response page it constructs and sends back. Headers> Status: 200 OK Content-Length: 45 Content-Type: text/html This is happening on Windows XP 32bit for me for both CGI and FCGI applications if the above example is used. I would not be surprised if this problem would be there in Linux too, maybe it is just properly displayed in the browser there, no matter what the header says. AB ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
[fpc-devel] Debugging FCGI applications
Hi, How do we debug an FCGI application from within Lazarus? The RUN function is disabled in the RUN menu, so I can not start it up after putting some break points in the IDE. AB ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] fpweb is not showing the exception message
On 4/12/2011 00:01, michael.vancann...@wisa.be wrote: On Mon, 11 Apr 2011, ABorka wrote: I was playing today with fpweb a little, and found a simply reproducible minor problem. When one creates a new CGI or FCGI application and creates a simple default action, but NOT setting the "handled := true;" within the event handler, then some kind of exception happens within fpweb when the action is called from the client browser, but it does not return a full response error message page. All that comes back to the client is: "APPNAME: " where the APPNAME is the title for the application. This happens at least for CGI and FCGI applications, not sure about Apache modules as I did not try that. As soon, as we have "handled := true;" there, everything is OK. If we have "handled := false;" or simply not setting it, the above issue happens. It seems, that there is a problem with displaying error messages/exceptions from within fpweb internals. /Latest FPC and Lazarus SVN, WinXP 32bit/ I cannot reproduce this at least on Linux 64 bit and Windows 2000 32bit. I am working with these things full-time at the moment, and I always get the full page. Michael. Yes, it works for me too in Linux 32bit. But not in WinXP 32bit. In fact, it seems that no matter what, the response page is cut off at 30 characters. In custweb.pp of .../fcl-web/base/ , procedure ExceptionToHTML(S: TStrings; const E: Exception; const Title, Email, Administrator: string); assembles the response page, and for some reason S is only 30 characters maximum when it arrives to the client browser. If I replace the inner part of this procedure with simply With S do begin Add('longer than 30 characters here..'); end; it is still cut at 30 characters. Odd :) AB ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
[fpc-devel] fpweb is not showing the exception message
I was playing today with fpweb a little, and found a simply reproducible minor problem. When one creates a new CGI or FCGI application and creates a simple default action, but NOT setting the "handled := true;" within the event handler, then some kind of exception happens within fpweb when the action is called from the client browser, but it does not return a full response error message page. All that comes back to the client is: "APPNAME: " where the APPNAME is the title for the application. This happens at least for CGI and FCGI applications, not sure about Apache modules as I did not try that. As soon, as we have "handled := true;" there, everything is OK. If we have "handled := false;" or simply not setting it, the above issue happens. It seems, that there is a problem with displaying error messages/exceptions from within fpweb internals. /Latest FPC and Lazarus SVN, WinXP 32bit/ === Example: procedure TFPWebModule1.DefActionRequest(Sender: TObject; ARequest: TRequest; AResponse: TResponse; var Handled: Boolean); begin Handled := true; //<-- if removed, the response is always the above //and no matter what follows below AResponse.Content := 'Yo! (F)CGI works!'; end; === AB ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
[fpc-devel] fcl-web compilation problems summary
WinXP 32bit, latest FPC SVN trunk, everything is default, not cross compiling 1. "make all" creates all the units properly, into the right places. 2. "make install" gets to the fcl-web package, and the files are copied into "../.." (basically the "units/i386-win32/fcl-web" directory gets created in the main SVN checkout directory) due to the instruction ./fpmake.exe clean --localunitdir=../.. --globalunitdir=.. --os=win32 --cpu=i386 -o <...snip...> and not to the FPC directory at C:/pp/ like the other packages' units 3. "make clean" does not delete the unit files from under the fcl-web package directory, like it does for the other packages: C:/pp/bin/i386-win32/make.EXE -C fcl-web distclean make.EXE[2]: Entering directory `C:/fpc_svn/packages/fcl-web' make.EXE[2]: Nothing to be done for `distclean'. make.EXE[2]: Leaving directory `C:/fpc_svn/packages/fcl-web' Therefore, currently fcl-web does not install from the SVN trunk. AB ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] make clean does not delete the fcl-web units
On 4/9/2011 14:37, Joost van der Sluis wrote: On Sat, 2011-04-09 at 13:05 -0700, ABorka wrote: Just like the "make install" does not copy the FCL-web units to the right place, "make clean" does not remove them either. Here is the output: . . . C:/pp/bin/i386-win32/make.EXE -C fcl-web distclean make.EXE[2]: Entering directory `C:/fpc_svn/packages/fcl-web' make.EXE[2]: Nothing to be done for `distclean'. make.EXE[2]: Leaving directory `C:/fpc_svn/packages/fcl-web' make clean<> make distclean? Joost Yes, even though I enter "make clean" into the command line deom the main FPC svn checkout directory, the output is still as I indicated for this package. This "distinstall" and "distclean" are there now when one does a "make install" or "make clean". And not just for this package. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
[fpc-devel] make clean does not delete the fcl-web units
Just like the "make install" does not copy the FCL-web units to the right place, "make clean" does not remove them either. Here is the output: . . . C:/pp/bin/i386-win32/make.EXE -C fcl-web distclean make.EXE[2]: Entering directory `C:/fpc_svn/packages/fcl-web' make.EXE[2]: Nothing to be done for `distclean'. make.EXE[2]: Leaving directory `C:/fpc_svn/packages/fcl-web' . . . It leaves the "units/..." files in there. Win XP 32bit, FPC 2.5.1 SVN trunk, everything is the default ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] fcl-web is not copied by make install
On 4/9/2011 12:43, ABorka wrote: On 4/9/2011 11:26, Joost van der Sluis wrote: On Sat, 2011-04-09 at 00:22 -0700, ABorka wrote: Is it intentional that the fcl-web package is not copied when "make install" is called? "make all" compiles the units properly, they are just not copied by "make install". Are you sure? Which files do you think are not copied? Do you cross-compile? Joost. Well, Im pretty sure. Not even the directory is created for it in the c:/pp/units/i386-win32/ directory when "make install" is executed. If I create an empty directory for it there, no change, it remains empty. The other fcl packages are copied properly. For FCL-web these are the "make install" outputs: C:/pp/bin/i386-win32/make.EXE -C fcl-web distinstall make.EXE[4]: Entering directory `C:/fpc_svn/packages/fcl-web' C:/fpc_svn/compiler/ppc386.exe fpmake.pp -Ur -Xs -O2 -n -FuC:/fpc_svn/rtl/units/i386-win32 -FuC:/fpc_svn/packages/hash/units/i386-win32 -FuC:/fpc_svn/packages/paszlib/units/i386-win32 -FuC:/fpc_svn/packages/fcl-process/units/i386-win32 -FuC:/fpc_svn/packages/fpmkunit/units/i386-win32 -FE. -FUunits/i386-win32 -di386 -dRELEASE .\fpmake.exe install --localunitdir=../.. --globalunitdir=.. --os=win32 --cpu=i386 -o -Ur -o -Xs -o -O2 -o -n -o -FuC:/fpc_svn/rtl/units/i386-win32 -o -FuC:/fpc_svn/packages/hash/units/i386-win32 -o -FuC:/fpc_svn/packages/paszlib/units/i386-win32 -o -FuC:/fpc_svn/packages/fcl-process/units/i386-win32 -o -FuC:/fpc_svn/packages/fpmkunit/units/i386-win32 -o -FE. -o -FUunits/i386-win32 -o -di386 -o -dRELEASE --compiler=C:/fpc_svn/compiler/ppc386.exe --prefix= Installation package fcl-web for target i386-win32 succeeded make.EXE[4]: Leaving directory `C:/fpc_svn/packages/fcl-web' For fastcgi the "make install" lines are: C:/pp/bin/i386-win32/make.EXE -C fastcgi distinstall make.EXE[4]: Entering directory `C:/fpc_svn/packages/fastcgi' C:/fpc_svn/utils/fpcm/fpcmake.exe -p -Ti386-win32 Makefile.fpc Processing Makefile.fpc Writing Package.fpc C:/pp/bin/i386-win32/ginstall.exe -m 755 -d /pp/units/i386-win32/fastcgi C:/pp/bin/i386-win32/cp.exe -fp Package.fpc /pp/units/i386-win32/fastcgi C:/pp/bin/i386-win32/ginstall.exe -m 755 -d /pp/units/i386-win32/fastcgi C:/pp/bin/i386-win32/cp.exe -fp units/i386-win32/fastcgi.ppu /pp/units/i386-win32/fastcgi C:/pp/bin/i386-win32/cp.exe -fp units/i386-win32/fastcgi.o /pp/units/i386-win32/fastcgi make.EXE[4]: Leaving directory `C:/fpc_svn/packages/fastcgi' It seems, something is missing for FCL-web, because there is no cp.exe called at all to copy over the units. AB Actually, it seems it copies this one package to the wrong place, not to c:/pp/ like it copies the others ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] fcl-web is not copied by make install
On 4/9/2011 11:26, Joost van der Sluis wrote: On Sat, 2011-04-09 at 00:22 -0700, ABorka wrote: Is it intentional that the fcl-web package is not copied when "make install" is called? "make all" compiles the units properly, they are just not copied by "make install". Are you sure? Which files do you think are not copied? Do you cross-compile? Joost. Well, Im pretty sure. Not even the directory is created for it in the c:/pp/units/i386-win32/ directory when "make install" is executed. If I create an empty directory for it there, no change, it remains empty. The other fcl packages are copied properly. For FCL-web these are the "make install" outputs: C:/pp/bin/i386-win32/make.EXE -C fcl-web distinstall make.EXE[4]: Entering directory `C:/fpc_svn/packages/fcl-web' C:/fpc_svn/compiler/ppc386.exe fpmake.pp -Ur -Xs -O2 -n -FuC:/fpc_svn/rtl/units/i386-win32 -FuC:/fpc_svn/packages/hash/units/i386-win32 -FuC:/fpc_svn/packages/paszlib/units/i386-win32 -FuC:/fpc_svn/packages/fcl-process/units/i386-win32 -FuC:/fpc_svn/packages/fpmkunit/units/i386-win32 -FE. -FUunits/i386-win32 -di386 -dRELEASE .\fpmake.exe install --localunitdir=../.. --globalunitdir=.. --os=win32 --cpu=i386 -o -Ur -o -Xs -o -O2 -o -n -o -FuC:/fpc_svn/rtl/units/i386-win32 -o -FuC:/fpc_svn/packages/hash/units/i386-win32 -o -FuC:/fpc_svn/packages/paszlib/units/i386-win32 -o -FuC:/fpc_svn/packages/fcl-process/units/i386-win32 -o -FuC:/fpc_svn/packages/fpmkunit/units/i386-win32 -o -FE. -o -FUunits/i386-win32 -o -di386 -o -dRELEASE --compiler=C:/fpc_svn/compiler/ppc386.exe --prefix= Installation package fcl-web for target i386-win32 succeeded make.EXE[4]: Leaving directory `C:/fpc_svn/packages/fcl-web' For fastcgi the "make install" lines are: C:/pp/bin/i386-win32/make.EXE -C fastcgi distinstall make.EXE[4]: Entering directory `C:/fpc_svn/packages/fastcgi' C:/fpc_svn/utils/fpcm/fpcmake.exe -p -Ti386-win32 Makefile.fpc Processing Makefile.fpc Writing Package.fpc C:/pp/bin/i386-win32/ginstall.exe -m 755 -d /pp/units/i386-win32/fastcgi C:/pp/bin/i386-win32/cp.exe -fp Package.fpc /pp/units/i386-win32/fastcgi C:/pp/bin/i386-win32/ginstall.exe -m 755 -d /pp/units/i386-win32/fastcgi C:/pp/bin/i386-win32/cp.exe -fp units/i386-win32/fastcgi.ppu /pp/units/i386-win32/fastcgi C:/pp/bin/i386-win32/cp.exe -fp units/i386-win32/fastcgi.o /pp/units/i386-win32/fastcgi make.EXE[4]: Leaving directory `C:/fpc_svn/packages/fastcgi' It seems, something is missing for FCL-web, because there is no cp.exe called at all to copy over the units. AB ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
[fpc-devel] fcl-web is not copied by make install
Is it intentional that the fcl-web package is not copied when "make install" is called? "make all" compiles the units properly, they are just not copied by "make install". I've tried the latest SVN trunk version on WinXP 32bit. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
[fpc-devel] Delphi 64bit compiler sneak peak available now
https://forums.codegear.com/thread.jspa?threadID=52117&tstart=0 We can check it out and do some comparisons now. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] fcl-web webdata ExtJS "total" field question
...snip... The only thing I've noticed is that with XML the "text" MySQL fields are not coming over to ExtJS, they only say "(MEMO)" . Is that because XML does not allow UTF8 or something? No, this is a bug. I fixed it already in JSON (since I use that), but not yet in XML. Some non-"text" fields are also displaying strange characters with XML where with JSON everything is good. That is an encoding issue. The XML components need to know what kind of codepage you use. I think we'll have to introduce a property for this in the dataformatter. It will introduce some overhead :/ Michael. Yes, I will use JSON in my project also, it seems much better and easier, I was just testing both. XML is a lot of overhead and bloat in any project both development, execution and data-size-wise. I did some testing on the exception catching, but if I intentionally do something nasty within my Except/End part, FCL-Web replies with a web page ("Module error", or something similar), and not a JSON reply so ExtJS cannot process the response. AB ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] fcl-web webdata ExtJS "total" field question
I implemented b), see revision 15859. Tested it, and it seems to work nicely both for JSON and XML. I'm using the AfterDataToJSON and AfterDataToXML events to replace/insert the correct "total" now. The only thing I've noticed is that with XML the "text" MySQL fields are not coming over to ExtJS, they only say "(MEMO)" . Is that because XML does not allow UTF8 or something? Some non-"text" fields are also displaying strange characters with XML where with JSON everything is good. AB ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] fcl-web webdata ExtJS "total" field question
...snip... Exceptions are usually caught and transformed to the correct response. I coded an event that allows to influence this process. Michael. Yes, the ones raised within FCL-web are caught. I was thinking about the ones raised within the developer's code, when handling the actions, or checking the user input from form submit, etc. For example if I have a login form and ExtJS submits it to the server, but the login or password didn't match, we need to reply with a success=false and an error message in a proper response format. I was thinking there could be something available for the developers to help format this response properly to ExJS. It's not a big deal though, one can always just do a except on E: Exception do Response.Content := '{ "success" : false, "message" : "' + E.Message + '"}'; end AB ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] fcl-web webdata ExtJS "total" field question
...snip... I will add an 'AfterFormatResult' or so event; Likewise I will add a AfterRow event, so it is possible to append extra data to a row. I think we should do this for both XML and JSON, so the row/response elements can easily be accessed. The question is now, a) do I make this a TNotifyEvent, and make a Property Response/CurrentRow which can be used or b) do I pass Response/CurrentRow to a new event handler type for these events ? Doing a) means I can introduce it at a higher level, but b) seems more clean. Michael. Sounds good. For me personally, it does not matter either way, just need to make this work :) . If we can intercept/access these row/response elements in an easy way, I'm happy. I implemented b), see revision 15859. I also now add a 'rows' property to the error response object, so the ExtJS exception handling will work with 'remote'. I'm still doubting to implement an OnErrorResponse event. It may be useful for logging purposes, or to change the reported error, since there is no way to intercept that currently. What do you think ? Michael. I will check it in the morning to see if I can change/update the "total" field, definitely. Some kind of built-in error response possibility would be nice too. Right now I'm hard coding things like Response.Content := '{ "success" : false, "message" : "' + MyErrMsg + '"}'; when there was an exception in my code or incorrect user entry was passed from the client, etc. AB ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] fcl-web webdata ExtJS "total" field question
...snip... Well, I have no idea. As far as I know, the 'total' is only needed for display purposes in a paging grid. You'd need to run a second query which counts the number of records that would be returned if no paging was requested. Michael. I understand. However, how do we send back our own "total" we got from our second query? How do we append/update it into the response? Good point. ...snip... It seems we need to manipulate the tmemorystream that is generated by the formatter? Maybe we should make this a little bit easier for developers somehow. Yes. I don't think you should manipulate the stream; it is too slow. I will add an 'AfterFormatResult' or so event; Likewise I will add a AfterRow event, so it is possible to append extra data to a row. I think we should do this for both XML and JSON, so the row/response elements can easily be accessed. The question is now, a) do I make this a TNotifyEvent, and make a Property Response/CurrentRow which can be used or b) do I pass Response/CurrentRow to a new event handler type for these events ? Doing a) means I can introduce it at a higher level, but b) seems more clean. Michael. Sounds good. For me personally, it does not matter either way, just need to make this work :) . If we can intercept/access these row/response elements in an easy way, I'm happy. AB ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] fcl-web webdata ExtJS "total" field question
...snip... 2. How can I provide the correct "total" for the response if I only loaded exactly the records requested by ExtJS into the dataset but not the whole table? Ex: Have a table with 1000 records, I'm on page 2 of the grid that has a page limit of 50 records. Of the total 1000 records, only about one third should be visible for the person currently requesting data. Therefore, I run a SQL statement to get those next 50 records from the 333 potential ones for this person, and that will be displayed in the grid, and only those 50. This way, only I can tell in the response the correct "total", which is 333 in this case. 50 was passed to the formatter/adapter. Well, I have no idea. As far as I know, the 'total' is only needed for display purposes in a paging grid. You'd need to run a second query which counts the number of records that would be returned if no paging was requested. Michael. Hi Michael, I understand. However, how do we send back our own "total" we got from our second query? How do we append/update it into the response? With XML, FCL-web always appends a "total" so that should be overwritten somehow. I guess we can trick FCL-web to not append its own "total" with JSON by sending only the 50 records needed and saying to it that the "start" is the 1st one and "limit" per page is 51 even if those 50 come from a table of 1 million records. It seems we need to manipulate the tmemorystream that is generated by the formatter? Maybe we should make this a little bit easier for developers somehow. AB ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
[fpc-devel] fcl-web webdata ExtJS "total" field question
Hi, 1. Should not the JSON replies have a "total" returned always like the XML replies? Right now "total" is not returned if the "start"/"limit" is not passed to the formatter. 2. How can I provide the correct "total" for the response if I only loaded exactly the records requested by ExtJS into the dataset but not the whole table? Ex: Have a table with 1000 records, I'm on page 2 of the grid that has a page limit of 50 records. Of the total 1000 records, only about one third should be visible for the person currently requesting data. Therefore, I run a SQL statement to get those next 50 records from the 333 potential ones for this person, and that will be displayed in the grid, and only those 50. This way, only I can tell in the response the correct "total", which is 333 in this case. 50 was passed to the formatter/adapter. Thanks, AB ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] fcl-web webdata example(s) on Windows has some problems
..snip... We can add the "rows" for convenience, but nevertheless the error handler must also handle the 'response' case. Michael. Hi Michael, I've created an updated ExtJS error handler for the demo programs that handle all these response messages from FCL-web without the need to change the internals and play with the "rows". We just need to update the *.js files for the demos. =CODE START // Listen to errors. data.addListener('exception', function(proxy, type, action, options, res) { if (type === 'remote') { Ext.Msg.show({ title: 'REMOTE EXCEPTION', msg: res.message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK }); }else{//type === 'response' if (res.responseText !== undefined){//there is a responseText so we can process var succ = undefined; var mess = ""; try { //mark start var response = Ext.util.JSON.decode(res.responseText); succ = response.success; mess = response.message; //mark end if ((succ !== undefined)&&(!succ)){//success == false Ext.Msg.show({ title: 'REMOTE EXCEPTION/ERROR', msg: mess, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK }); }; }//try catch (err) { Ext.MessageBox.alert('ERROR', 'Could not decode server response: ' + res.responseText); };//catch }; };//else });//addListener ==CODE END For XML communication we need to change between the "mark start / mark end" to //mark start var response = document.createElement('div'); response.innerHTML = res.responseText; s = Ext.DomQuery.selectValue('success', response); switch (s.toLowerCase()) { case "true" : succ = true; case "false": succ = false; };//switch mess = Ext.DomQuery.selectValue('message', response); //mark end AB ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] fcl-web webdata example(s) on Windows has some problems
...snip... I don't 100% agree: the exception() handler must also be able to handle 'response'. If there is a server crash or so (which will result in a 500 error code) , it must also be able to handle that. We can add the "rows" for convenience, but nevertheless the error handler must also handle the 'response' case. Michael. just found this: It seems that someone had the same problem with ExtJS and even created a bug report there: http://www.sencha.com/forum/showthread.php?91903-OPEN-826-DataProxy-Exception-JsonReader-Possible-Inconsistency He did the same adding the "rows" trick to solve it. The problem is, that when the 'response' case comes, the object is not processed (because the exception is thrown from within ExtJS before the response is really processed) so we cannot access the response properties to display it to the client. Might be only a problem with JSON reader, I am not sure. AB ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] fcl-web webdata example(s) on Windows has some problems
...snip... > ExtJS however, will only have 'remote' type if the server response is proper for it (having a root /which is "rows"/ in our case), all other cases instead of 'remote' it has the type 'response', regardless of our "success" property being true or false. > >Unfortunately, the ExtJS documentation is rather terse where this is concerned. >So, if "rows" is not supplied, type='response' and the 'success' property must simply be checked ? Or do you suggest adding "rows" to the error response ? >I'm not sure if this is also the case if you are using a DirectStore ? The docs for Ext.DataProxy -> events -> exception says it in more detail. " Fires if an exception occurs in the Proxy during a remote request. This event is relayed through a corresponding Ext.data.Store.exception, so any Store instance may observe this event. ... # type : String The value of this parameter will be either 'response' or 'remote'. * 'response' : An invalid response from the server was returned: either 404, 500 or the response meta-data does not match that defined in the DataReader (e.g.: root, idProperty, successProperty). * 'remote' : A valid response was returned from the server having successProperty === false. This response might contain an error-message sent from the server. For example, the user may have failed authentication/authorization or a database validation error occurred. " We are always getting type='response' now (due to "response meta-data does not match that defined in the DataReader") with the "rows" not being there when an exception/error happens server side, so no error message we pass is processed in our ExtJS. I do not know about DirectStore, I just started with ExtJS/JSON with playing with the demo apps from fcl-web a few days ago :) Does it hurt anything if we just append a "rows":"" to our error/exception replies? I did that with the 1st demo app and it works so far, displays the errors from the server side now (like "DB field X cannot be null", "Cannot connect to DB server", "Invalid DB user", etc.). AB ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
[fpc-devel] Re: [fpc-pascal] fcl-web webdata example(s) on Windows has some problems
did some more testing: ROUND 4 1. minor note: We should not forget that field names are case sensitive in ExtJS, so any database field names need to be entered exactly: ex: fields: ["id","login","name","email", "lastlogin"] is not the same as fields: ["ID","LOGIN","NAME","EMAIL", "LASTLOGIN"] or {header: 'ID', dataIndex: "id", sortable: true, hidden: true}, is not the same as {header: 'ID', dataIndex: "ID", sortable: true, hidden: true}, In the demo projects a DBF table is used with all capital letter field names. When I tried to use MySQL, it took me some time to realize this problem. Having zero errors displayed for this didn't help either :) 2. major: It seems that the error/exception handling does not have the proper server responses for ExtJS (when read/insert/update/delete happens on the data), because with any exceptions there is nothing displayed but the empty grid with "no data to display" note. Apparently, we need to append a '"rows" : ""' to our responses in order for ExtJS to properly accept our reply with the error message (being "rows" is our root element and ExtJS requires this): ex: instead of { "success" : false, "message" : "Blahblah exception occured CGI side" } it should be '{ "success" : false, "message" : "Blahblah exception occured CGI side", "rows" : ""} (not sure how using XML instead of JSON needs this done differently) This needs to be done within our reply generation internally (fcl-web) when there is an error/exception or the message will never be displayed client side. Explanation: In our *.js we have data.addListener('exception', function(proxy, type, action, options, res) { if (type === 'remote') { Ext.Msg.show({ title: 'REMOTE EXCEPTION', msg: res.message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK }); } }); ExtJS however, will only have 'remote' type if the server response is proper for it (having a root /which is "rows"/ in our case), all other cases instead of 'remote' it has the type 'response', regardless of our "success" property being true or false. AB ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] fpWeb recursive tag replace
On 6/7/2010 16:40, Leonardo M. Ramé wrote: Hi, when I use html templates with tags that contains inner tags, the ReplaceTag event is fired only once, for the 1st order tag, but not for the inner tags. Example, a home page containing a header (a tag) and a body which contains another tag like, for example {+search_form+}. The search_form tag, also contains some {+tags+} to be replaced by the main program. Is there an "official" way to handle this use case? Leonardo M. Ramé http://leonardorame.blogspot.com An example template attached would have helped, but guessing your problem... If you use the "AllowTagParams := true;" for a template, then you cannot have recursive embedded tags. That is what the tag parameters can be used for instead. For example: {+search_form [-formheader=-] [-formbody=-] [-formfooter=-] +} Your program needs to replace the "search_form" tag by also processing the tag parameters. To see some examples for template usage, try the demo programs under ...\lazarus\components\fpweb\demo\fptemplate\... AB ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] fcl-web actions bug?
Hi, is it possible to call actions this way?: http://host/cgi-bin/myprog/action1 instead of http://host/cgi-bin/myprog?action=action1 I thougth that the designed behavior was to call any action by its name like: http://host/cgi-bin/myprog/action1 http://host/cgi-bin/myprog/action2 But that won't work. Leonardo M. Ramé http://leonardorame.blogspot.com Both should work. The second one should only work if the ActionVar property is set with the name of the query variable. If the .../myprog/action1 is not working then either there is a new bug in fcl-web or something is not done properly. What version of fpc/lazarus are you using? AB ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] Win64 FPC is in wrong download location
On 5/4/2010 11:40, Vincent Snijders wrote: Jonas Maebe schreef: On 04 May 2010, at 15:29, Graeme Geldenhuys wrote: So to be able to compile Win64 apps, we need two installations. The Win64 download (17MB) and the i386 download (35MB). * now installation is more complex than it needs to be. It now requires two FPC versions. I don't know where to add this exactly in this thread, but the win64 version of Lazarus includes a native win64 version of the compiler. It is done because I think that to make sure it can compile Lazarus correctly, it has to be able to compile itself correct and create a running executable. Vincent OT: After reading this whole thread, Vincent's reply made me LOL Is there a hope then to have a native 64bit Windows version of FPC posted (download pages, sourceforge, etc.)? ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
[fpc-devel] bug report 12594
It seems it got closed, but I'm not sure it is really fixed (can't add notes now). http://bugs.freepascal.org/view.php?id=12594 In D5 the DFM files are something like this with bitbuttons: . . . object BitBtn1: TBitBtn Left = 96 Top = 52 Width = 75 Height = 25 TabOrder = 1 Kind = bkOK end object BitBtn2: TBitBtn Left = 176 Top = 52 Width = 75 Height = 25 TabOrder = 2 Kind = bkCancel end . . . Because the "Caption" and "Modalresult" properties were not specified in there, the converter did not add them automatically for FPC using the "Kind" property (D5 did this automatically it seems). bkOK -> Caption = "OK" and Modalresult = 1 blCancel -> Caption = "Cancel" and modalresult = 2 etc. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] "Unable to open file" on Linux randomly in a CGI application when using templates
Thanks for the help. It appears that the GetLastOSError is 9 for these errors. In the errno.inc for Linux, that is ESysEBADF = 9;{ Bad file number } I'm not exactly sure what this means though. Right now as a workaround, when this happens, I do a sleep(100) and retry the page generation and it seems to work. This only happens when multiple simultaneous requests arrive to the apache server (ex: a dozen iframes hitting cgi calls from a 3rd party website, requesting the same template to be used to generate a response web page with different parameters). I would like to eliminate this problem in a more elegant way (fix) if it is possible. AB On 3/15/2010 02:58, Jonas Maebe wrote: I have a CGI application with a datamodule that is using templates to generate the response pages (accessing a MySQL database through ZEOS). Every once in a while, I'm getting an "Unable to open file" exception that points to one of the templates the website is using. What could be the problem? Maybe you run out of file handles? If that is the case, shouldn't something be in the syslog or some other log? No. It's a generic user error like any other. Is there any way I can check this for sure like last system error string or something? You can call sysutils.GetLastOSError and look up the number in errno.inc The exception message only says that "Unable to open file ". I checked the /proc/sys/fs/file-max and it shows 294692 The per-user open file handles limit is different. You can see it in the output of "ulimit -a" under bash (if it says "unlimited", it means that it uses the system limit). Maybe you leak file handles somewhere. You can look in /proc//fd from time to time to see whether the number of open files keeps growing over time. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] "Unable to open file" on Linux randomly in a CGI application when using templates
If that is the case, shouldn't something be in the syslog or some other log? Is there any way I can check this for sure like last system error string or something? The exception message only says that "Unable to open file ". I checked the /proc/sys/fs/file-max and it shows 294692 For now, I'm retrying again the page generation if an exception happens. So far seems to be working, but will need more time to really see. It was rare to happen. AB On 3/14/2010 16:08, Jonas Maebe wrote: On 14 Mar 2010, at 23:39, ABorka wrote: I have a CGI application with a datamodule that is using templates to generate the response pages (accessing a MySQL database through ZEOS). Every once in a while, I'm getting an "Unable to open file" exception that points to one of the templates the website is using. What could be the problem? Maybe you run out of file handles? Jonas___ ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
[fpc-devel] "Unable to open file" on Linux randomly in a CGI application when using templates
Hi, I have a CGI application with a datamodule that is using templates to generate the response pages (accessing a MySQL database through ZEOS). Every once in a while, I'm getting an "Unable to open file" exception that points to one of the templates the website is using. What could be the problem? The fcl-web template handling is opening the template files with the "fmOpenRead" flag so there should not be any problem, no matter how many requests arrive to the web server at the same time. Could this be some kind of Linux setting? There is nothing in the system logs. (Debian 5.04 /Lenny/, Apache 2.2.9) Any ideas or help is appreciated to help to find this problem. Thanks, AB ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
[fpc-devel] In Lazarus fpweb action procedure names no longer include the action name
When creating a web application, for example CGI Application in Lazarus, and adding an action to the web module, the automatically generated procedure name only contains a number and not the given action name. For example, creating an action with a name ABC will generate a OnRequest procedure (by double clicking in the object inspector on the Events -> OnRequest) like: TFPWebActions0Request(Sender: TObject; ARequest: TRequest; AResponse: TResponse; var Handled: Boolean); instead of TFPWebActionsABCRequest(Sender: TObject; ARequest: TRequest; AResponse: TResponse; var Handled: Boolean); If memory serves, this has worked before properly (even changing the source code when one changed the action name in the object inspector). Right now, if someone has 50 actions, it takes a while to match the Action ID numbers with the actual functionality within the event handler. Latest FPC SVN and latest Lazarus SVN, Win XP 32bit Should I create a bug report on this? AB ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] fpc 14894 svn does not compile
Thanks Jonas, using 2.4.0 for the 1st compile worked. I guess I shouldn't wait months before recompiling the latest SVN :) On 2/13/2010 02:15, Jonas Maebe wrote: On 13 Feb 2010, at 11:10, ABorka wrote: My ppc386.exe is v2.5.1 compiled back in September Building FPC svn trunk has always been and will always be only supported when starting using the compiler the latest official release (which is 2.4.0 at this time). Is there a place when I can download the newer binary files/utils needed for the compile if that is the problem? You can download the latest release from the website. Jonas___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] fpc 14894 svn does not compile
My ppc386.exe is v2.5.1 compiled back in September Is there a place when I can download the newer binary files/utils needed for the compile if that is the problem? On 2/13/2010 01:56, Jonas Maebe wrote: On 13 Feb 2010, at 03:06, ABorka wrote: gives the following error for "make all" (win xp 32bit) Are you starting the compilation with FPC 2.4.0? Jonas ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
[fpc-devel] fpc 14894 svn does not compile
gives the following error for "make all" (win xp 32bit) C:/pp/bin/i386-win32/ppc386.exe -Ur -Xs -O2 -n -Fui386 -Fusystems -FuC:/.../fpc_svn/rtl/units/i386-win32 -Fii386 -FE. -FUi386/u nits/i386-win32 -dRELEASE -di386 -dGDB -dBROWSERLOG -Fux86 pp.pas optcse.pas(166,24) Warning: Converting pointers to signed integers may result in wrong comparison results and range errors, use an u nsigned type instead. optcse.pas(232,24) Warning: Converting pointers to signed integers may result in wrong comparison results and range errors, use an u nsigned type instead. optcse.pas(256,29) Warning: Converting pointers to signed integers may result in wrong comparison results and range errors, use an u nsigned type instead. optcse.pas(270,22) Warning: Converting pointers to signed integers may result in wrong comparison results and range errors, use an u nsigned type instead. symdef.pas(5050,10) Warning: User defined: : this is completely wrong on so many levels... pp.pas(224,1) Error: Undefined symbol: FPC_WIDEINITTABLES pp.pas(224,1) Fatal: There were 1 errors compiling module, stopping Fatal: Compilation aborted make.EXE[5]: *** [ppc386.exe] Error 1 ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
[fpc-devel] FCGI example?
I am trying to make a working example for FCGI with Apache 2.2 on Windows but does not seem to be successful. Created a simple FCGI program with 1 action replying with a "hello world" as a response to the http request. However, could not find any examples as how to set up the Apache httpd.conf to make it work. LoadModule fastcgi_module "/the path to dll/mod_fastcgi-2.4.6-AP22.dll" was added successfully. Tried FastCgiExternalServer /cgi-bin/fcgiproject1.exe -host localhost:2014 -idle-timeout 3 and FastCgiServer /bobo/fpc/fcgi-try/fcgiproject1.exe -processes 2 were all tried, but could not figure out how to actually call the fcgi module or what else would be missing from the httpd.conf or what could be the port number for the external server kind of setup. Anyone was able to make fcgi actually work and return some html results? Any working example would be greatly appreciated. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
[fpc-devel] Cant compile latest Lazarus
Fresh lazarus svn checkout rev21988 on Linux Compiling lazconfigstorage.pas lresources.pp(2250,17) Error: Identifier not found "vaQWord" lresources.pp(2250,17) Error: Constant Expression expected lresources.pp(2250,17) Error: duplicate case label lresources.pp(5514) Fatal: There were 3 errors compiling module, stopping Fatal: Compilation aborted make[1]: *** [alllclunits.ppu] Error 1 Is this for me only or something is not OK in the current SVN ? ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] iphone development
Well, according to Apple the number is 50M : http://www.theiphoneblog.com/2009/09/10/apple-music-event-numbers-30m-iphones-20m-ipod-touches-75k-apps-18b-downloads/ dmitry boyarintsev wrote: But $1K is peanuts if the finished application will be presented to 30-40 million people for download. I wonder what application can make 30-40 downloads? AFAIK there're less iPhones/Touches sold all over the world. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] iphone development
You guys are correct about the pricing, of course. But $1K is peanuts if the finished application will be presented to 30-40 million people for download. Considering what I read about obj C development... I think many people/companies would happily pay the price to have some nice language for development. What is interesting that they seem to be able to really use a different language within the apple rules of iphone development. Octal, Pocket MicroTechnics wrote: "$999 per seat for the enterprise edition ..." objC and xcode are free. And at this price, I'll buy a macbook !!! -Message d'origine- De : fpc-devel-boun...@lists.freepascal.org [mailto:fpc-devel-boun...@lists.freepascal.org] De la part de dmitry boyarintsev Envoyé : mercredi 16 septembre 2009 08:03 À : FPC developers' list Objet : Re: [fpc-devel] iphone development Reading the wiki it is not really a snap to set it up to be able to develop iphone apps. There's no ready-to-use solution to start developing iPhone apps. http://arstechnica.com/open-source/news/2009/09/monotouch-drops-net-into-apples-walled-app-garden.ars "As MonoTouch necessitates static linking, users will need a commercial license. This will cost $999 per seat for the enterprise edition and $399 per seat for the personal edition and will include one year of updates. For additional details, you can refer to the MonoTouch website." imho, it's cheaper to learn obj-c. thanks, dmitry ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
[fpc-devel] iphone development
How is freepascal's iphone development compares to this latest mono way of creating native iphone apps? http://arstechnica.com/open-source/news/2009/09/monotouch-drops-net-into-apples-walled-app-garden.ars Reading the wiki it is not really a snap to set it up to be able to develop iphone apps. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] Is lnet compilation working?
lNet latest SVN revision 2316 gives . . . Target OS: Win32 for i386 Compiling ludp.pp ludp.pp(84,26) Error: Identifier not found "LADDR_BR" ludp.pp(116) Fatal: There were 1 errors compiling module, stopping Fatal: Compilation aborted . . . with the latest FPC svn rev 13686 Aleš Katona wrote: What did you change? Btw. the forward declaration bug in windows was fixed in lNet trunk, so windows users can use it with fpc fixes branch at least... (didn't try fpc trunk). NOTE: IPv6 will only work for unix atm. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] Is lnet compilation working?
No, just with the latest FPC/Lazarus SVN Vincent Snijders wrote: ABorka schreef: Hi, Trying to send emails and load web pages from Lazarus/FPC programs. Since the latest Indy cannot be compiled and used in Lazarus/Freepascal at the moment (it seems at least so), I have tried to start using lNet. Did you try with fpc 2.2.4? Vincent ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
[fpc-devel] Is lnet compilation working?
Hi, Trying to send emails and load web pages from Lazarus/FPC programs. Since the latest Indy cannot be compiled and used in Lazarus/Freepascal at the moment (it seems at least so), I have tried to start using lNet. However, it seems it does not compile either. The lNet SVN gives: . . . Compiling ...\lNet_svn\lib\lcommon.pp lcommon.pp(319,4) Warning: User defined: check these ambiguous errors lcommon.pp(121,12) Error: Forward declaration not solved "GetHostName6(const AnsiString):AnsiString;" lcommon.pp(122,12) Error: Forward declaration not solved "GetHostIP6(const AnsiString):AnsiString;" lcommon.pp(498) Fatal: There were 2 errors compiling module, stopping Fatal: Compilation aborted Error: ...\pp\bin\i386-win32\ppc386.exe returned an error exitcode (normal if you did not specify a source file to be compiled) Tried to just unzip the lnet-0.6.2.zip file of lNet and run a make there too, got the following: . . . Compiling ...\lNet\lib\lspawnfcgi.pp lwebserver.pp(645,53) Error: absolute can only be associated with a var or const lwebserver.pp(654,27) Warning: Local variable "lServerSocket" does not seem to be initialized lwebserver.pp(705,53) Error: absolute can only be associated with a var or const lwebserver.pp(729,7) Warning: Local variable "lServerSocket" does not seem to be initialized lwebserver.pp(877,52) Error: absolute can only be associated with a var or const lwebserver.pp(1119,4) Warning: User defined: TODO lwebserver.pp(1255) Fatal: There were 3 errors compiling module, stopping Fatal: Compilation aborted Any help would be appreciated. Thanks, AB ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] Lazarus Apache module crashes during concurrent requests
It should be working. You have to make sure you delete the httpd13 and httpd20 directories from your fpc units folder (where httpd.o and .ppu is stored) so only the httpd22 folder remains there. Otherwise the wrong units might be linked with your module and then crash when called. With the latest Lazarus SVN you can find some examples for web apache modules and cgi programs under the lazarus /components/fpweb/demo/ folder. AB Leonardo M. Ramé wrote: Does this was fixed? I'm trying to deploy an apache 2.2.9 module, it compiles and loads ok (it doesn't crash apache) but its exported function isn't called, I'm using the same code ABorka used in this example. This is my configuration: Free Pascal Compiler version 2.2.4-3 [2009/06/03] for i386 Copyright (c) 1993-2008 by Florian Klaempfl Linux debian 2.6.26-1-686 #1 SMP Fri Mar 13 18:08:45 UTC 2009 i686 GNU/Linux Leonardo. - Original Message From: ABorka To: FPC developers' list Sent: Tuesday, September 30, 2008 11:03:26 PM Subject: Re: [fpc-devel] Lazarus Apache module crashes during concurrent requests Nevermind, on Ubuntu the request_rec is only 384 bytes for FPC instead of 412. But that still does not explain why the handler function is not even getting called by apache. ABorka wrote: OK, after 4 days of pulling my (remaining) hair out I was able to compile a basic C apache module on Ubuntu 8.04 (apache 2.2.8). It seems both fpc/lazarus (not working apache module) and the C compiled (working apache module) one shows sizeof(request_rec) = 412 sizeof(module_struct) = 56 So the length seems to be the same for for both. Still, the Lazarus compiled apache module doesn't even load in apache (mod_hello.pp or any of the other examples included in fpc). If the exports is included then it loads but doesn't work at all: modified "mod_hello.pp" from fpc/packages/httpd22/examples/ {*** * Test library of the Apache Pascal Headers ***} library mod_hello; {*** * The mode must be objfpc on this unit because the unix code uses * some extensions introduced on Free Pascal ***} {$ifdef fpc} {$mode objfpc}{$H+} {$endif} {$IFDEF WIN32} {$DEFINE WINDOWS} {$ENDIF} {$define Apache2_2} uses SysUtils, httpd {$ifndef Apache1_3}, apr{$endif}; var test_module: module; public name 'test_module'; default_module_ptr: Pmodule; const MODULE_NAME = 'mod_hello.so'; {*** * Free Pascal only supports exporting variables on Windows ***} { $ifdef WINDOWS}//commented out, exports work in Linux now exports test_module name 'test_module'; { $endif}//commented out, exports work in Linux now . .snip . Not sure why the Lazarus/fpc apache modules do not work on apache 2.2.8 or 2.2.9 on Ubuntu. The above module is loaded, the handler registering function is called, but the handler never gets triggered when the module is called from a browser. Michael Van Canneyt wrote: Any suggestions? Yes: please print the size of the Request_rec (or TRequest_Rec) and the same record in C. Compare if they are equal. Same for the module record. If they are not equal, then we know it is a problem with the pascal definition of this record. I've had to do this exercise about 30 times myself on various platforms to get it right. Maybe they changed the size again. Michael. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] fcgi under windows
Done as http://bugs.freepascal.org/view.php?id=13965 Joost van der Sluis wrote: Op woensdag 10-06-2009 om 17:19 uur [tijdzone -0700], schreef ABorka: Adding fcgi-support was only two hours work. Other systems can be added > as wel. Next on my list is a native web-server using lnet, so that > debugging is even easier. (I'm absolutely sure that posting all messages > about fcl-web not supportinf fcgi was more work then actually adding the > support) I thought the fcgi support is still a work in progress. The other day I was trying to create a "hello world" fcgi program just to see how it works but it did not compile. Getting a "fastcgi.pp(1,1) Fatal: Can't find unit BaseUnix used by custfcgi" error. (Latest Lazarus and FPC SVN, win32 /XP/) Ah, so it doesn't work on windows. Please submit a bug for that. Joost. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] fcgi under windows
If the "custom" variants need to stay then the descriptions for each must state exactly what is the difference between the custom and not custom and when they should be used. Currently, anyone who is not an FPC/Lazarus professional developer already, cannot decide based on the description. I do not agree that the "Custom" variations will be used more BTW. Anyone who is coming from Delphi/Kylix to move a web project over or start a new one will want to use web modules, actions, etc. They are using the RAD Delphi or FPC/Lazarus for the reason that they do not need to do the basic work the "Custom" variations need. They want to focus on the development of the actual web module, it's actions, templates, web design and not the framework that is needed for them to work. What's the problem with "dragging" in the LCL parts of the web development projects? Joost van der Sluis wrote: Op donderdag 11-06-2009 om 13:39 uur [tijdzone -0700], schreef BoBo: Well, this is just my opinion - maybe others could say something too - but I think it would clear up things a bit if we do the following things: 1. I think all the "Custom" variations should be removed it just confuses new arrival people. Any pro will know how to make those anyway. I think it has to stay. I even think that the 'custom' variant will be use more then the other variant. Because its doesn't depends on Lazarus and is in fact the same functionality as - for example - php offers. It's enough for a lot of people, who do not want to drag in the whole LCL. 3. Simple CGI application should be removed since it is deprecated Hmm.. maybe. The new components are really better now. Joost. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
[fpc-devel] fcgi under windows
> Adding fcgi-support was only two hours work. Other systems can be added > as wel. Next on my list is a native web-server using lnet, so that > debugging is even easier. (I'm absolutely sure that posting all messages > about fcl-web not supportinf fcgi was more work then actually adding the > support) I thought the fcgi support is still a work in progress. The other day I was trying to create a "hello world" fcgi program just to see how it works but it did not compile. Getting a "fastcgi.pp(1,1) Fatal: Can't find unit BaseUnix used by custfcgi" error. (Latest Lazarus and FPC SVN, win32 /XP/) If it works, I would make the examples submitted in http://bugs.freepascal.org/view.php?id=13706 to work as FCGI also. BTW, there should be some explanation in Lazarus -> File -> New for people about the differences between Application - Program - Custom Program ; Simple CGI Application - CGI Application - Custom CGI Application ; FastCGI Application - Custom FastCGI Application ; I am positive, it is very confusing for a newcomer to chose between these. In fact, I'm sure it is random chance at the moment that decides which they are clicking on within one group. At least for apache modules there is only one choice (in my lazarus at least). ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
[fpc-devel] Compiler hint for uninitialized local variable minor mistake
fillchar(tmp, sizeof(tmp), #0); gives the Hint: Local variable "tmp" does not seem to be initialized message upon compilation, which should not happen because it is actually the initialization. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] Indy IdHTTP
"If you are only using Pascal code in the real program, this should all be handled transparently for you." I agree, so why it doesn't? It only shows a few strange characters but not the string, as if it is just trying to display the pointer as a string. As you say, the ShowMessage('Redirected to:' + dest); should work as is. But it does not. UTF8 and ANSI conversion problems cannot happen here because "dest" is a URL so the UTF8 and ANSI characters are the same. Jonas Maebe wrote: On 24 May 2009, at 04:32, ABorka wrote: In FPC/Lazarus: procedure TForm1.IdHTTP1Redirect(Sender: TObject; var dest: String; var NumRedirect: Integer; var Handled: Boolean; var VMethod: IdHTTPMethod); begin ShowMessage('Redirected to:' + dest); end; However, it seems that the parameter "dest" is passing a pointer to a pointer and not just a pointer to the string (displaying only some strange characters instead of the redirecting URL). It is normal that dest is (implicitly) a pointer to a pointer. A "var" parameter means that the address of some variable is passed to a function, rather than only its value. Now, an (Ansi)String is a pointer to an array of characters, with some extra data before it. So if you have a "var" parameter of the type (Ansi)String, you get a pointer to that "pointer to an array of characters". Otherwise you would be unable to change the address stored inside that pointer (you would only be able to permanently change the data in the array it points to, but not make it point to a different array in a way that persists after the function exits). If you are only using Pascal code in the real program, this should all be handled transparently for you. Jonas ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
[fpc-devel] Indy IdHTTP
Hi, I came across some strange thing while making a simple program using Indy 10. If I use an IdHTTP object to load a web page that redirects to another one, the new destination URL is not passed properly through the event handler. Whether this is an indy or fpc problem, I'm not sure. Here is the event handler in a way that it should work: Declaration in Indy: TIdHTTPOnRedirectEvent = procedure(Sender: TObject; var dest: string; var NumRedirect: Integer; var Handled: boolean; var VMethod: TIdHTTPMethod) of object; In FPC/Lazarus: procedure TForm1.IdHTTP1Redirect(Sender: TObject; var dest: String; var NumRedirect: Integer; var Handled: Boolean; var VMethod: IdHTTPMethod); begin ShowMessage('Redirected to:' + dest); end; However, it seems that the parameter "dest" is passing a pointer to a pointer and not just a pointer to the string (displaying only some strange characters instead of the redirecting URL). Therefore, the following works properly (while it should not): procedure TForm1.IdHTTP1Redirect(Sender: TObject; var dest: String; var NumRedirect: Integer; var Handled: Boolean; var VMethod: IdHTTPMethod); var p:pchar; begin asm pushad lea esi, dest mov eax, [esi] mov eax, [eax] mov p, eax popad end; ShowMessage('Redirected to:' + p);{dest} end; Am I missing something or there is a problem somewhere? Indy and FPC both was compiled from the latest source available (as well as Lazarus) Thanks for any thoughts, AB PS: I did not post this on the indy support forums because it seems that there are no questions answered (or even posted) in the past two years there (the latest indy source is form 2007 Nov). ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
[fpc-devel] To Joost on SVN 13029 fpweb.pp
Hi, In /packages/fcl-web/src/fpweb.pp line 445 Is the CheckSession(ARequest); intentionally included in the commented out part, or a new line is needed before it? Cheers ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
[fpc-devel] To Joost on 13228 and 13280
Hi Joost, Can't add notes to resolved reports so I write here instead. :) I assumed the FCL-web patches/changes I submitted will be applied in chronological order so there might be a little snag there at the moment. It seems that now 13228 and 13280 are both applied (with your modifications) but it might not be enough because 13280 needs an earlier submitted patch http://bugs.freepascal.org/view.php?id=132254 FCL-web might not work without this. Sorry about the mess of so many patches/changes submitted, it's just during the development of all the examples (submitted in 0013250 and 0013288) these bugs/shortcomings were discovered. To sum it up, here are the list of all the mantis reports for FCL-web at the moment: 1. http://bugs.freepascal.org/view.php?id=13228 Status: Closed. Done. 2. http://bugs.freepascal.org/view.php?id=13254 Status: Assigned, not applied yet. Contains the changes in 13228 (1.) and 13250 (5.) with additional fixes/changes. 3. http://bugs.freepascal.org/view.php?id=13280 Status: Closed. Done. Might not work without 13254 (2.) though 4. http://bugs.freepascal.org/view.php?id=13287 Status: Not assigned yet Session related bug fixes for apache modules. 5. http://bugs.freepascal.org/view.php?id=13250 Status: Assigned, not applied yet Contains example programs (they need the above patches to work). 6. http://bugs.freepascal.org/view.php?id=13288 {Status: Not assigned yet) Additional example programs (they need the above patches to work). 7. http://bugs.freepascal.org/view.php?id=13251 Status: Not assigned yet Lazarus fweb change for generated program stubs' "uses" clause So 2. and 4. are still needed for fcl-web (and the example programs in 5. and 6.) to work. If it would be easier for you, I can check out the current fcl-web package from the SVN trunk and create one patch using my local fcl-web changes. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] Debugger for FPC
I agree. The current ways to debug FPC/Lazarus programs are not up to the standards even compared to 10-15 years ago Delphi debugging. Most developers does not want to start digging the underlying RTL/Component, etc. source codes to figure out what they should enter into the watch window expression instead of the variable name they are trying to see. They want to focus on developing what they are working on. They want - rightfully - to double click or copy paste or mouse-over to see the variables, properties, etc. If they need to learn a translation dictionary to do (hack) it - if at all it is possible to see that variable - then it is not acceptable and significantly slows the development. Not to mention to change variable values, re-executing/jumping to parts of the code (New CS:IP), CPU window, etc. This is one of the major things that is missing from FPC/Lazarus at the moment (for many people the most important). No matter how awesomely FPC and Lazarus progresses this will be always a show stopper for the majority of developers until it is resolved. Whether it is GDB, native FPC debugger, or something else, it does not matter as far as it does the job in a satisfactory manner. Currently, it does not. AB Graeme Geldenhuys wrote: Hi everybody, . . SNIP . Like I said, I am not very knowledgeable with debugger internals, but I am willing to learn and help. Not having decent debugger support is killing me - and I am clearly not alone, as the thread in the Lazarus mailing list proves. The problem as far as I can see, is that the Free Pascal project is trying to use existing debuggers that were NOT designed to work with the Object Pascal language. So maybe we should stop using those and implement our own debugging symbol format (if that is required) and then continue with writing a debugger specific to Free Pascal. I am more that willing to put in some effort if it means we end up with a working debugger! Your thoughts? Regards, - Graeme - ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] Patch for FCL-web; bug fixes and improvements for CGI and Apache applications
Sorry Joost, but I posted 2(+1) more, much smaller ones though :) http://bugs.freepascal.org/view.php?id=13280 and http://bugs.freepascal.org/view.php?id=13287 The third I submitted contains the rest of the example CGI/Apache projects to demonstrate the use of FCL-web with templates. http://bugs.freepascal.org/view.php?id=13288 I promise these are the last bugs I found while creating these example applications for fcl-web. All started by trying to reply to some people on the forum asking questions about using fpweb :) I attached the README.txt for the whole set of examples if anyone is interested what is in there (don't panic, only about 50 something lines). AB Joost van der Sluis wrote: Op zaterdag 28-02-2009 om 22:06 uur [tijdzone -0800], schreef ABorka: I posted the following patch as http://bugs.freepascal.org/view.php?id=13254 (includes the changes posted in 13250 and 13228 too) It takes soo long before the patches are applied because they are too large. ;) Now you create more patches which are even longer and then another one which is again longer... That doesn't make it easier for us. It takes hours to look at such patches. So next time (not this time, we're already on it now) provide small patches if you can and try not to include old patches into new ones. Although I do admit that that's more work, that way we can apply faster and that way it's easier for you to make new changes... Joost. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel These examples are demonstrating some uses of templates (with FPTemplate) when generating HTML pages by CGI programs or Apache modules. The main idea is to leave the web page designing and look&feel to the web page designers. Separating the web page design from the back end CGI/Apache application makes it possible to design, change or redesign a whole website without modifying a single line of code in the CGI/Apache application. Back end programmers and web page designers can work parallel easily and neither side needs extensive knowledge of the other (doesn't hurt, just not necessary most of the time). With all this said, none of the examples are focusing on nice look and feel in their template designs, merely on demonstrating the functionality and use of templates, template tags and template tag parameters with live applications. Examples list: 1. /simpletemplate/*.* The simplest template with one template tag in it to be replaced by the CGI/Apache application when generating the response page -> {TagName1} 2. /tagparam/*.* Demonstrating the set up and use of the template tag parameter(s) -> {+DATETIME [-FORMAT=MM/DD hh:mm:ss-]+} 3. /listrecords/*.* Demonstrates the use of a template tag with multiple template tag parameters to list multiple records, tables, lists, etc. 4. /fileupload/*.* Demonstrates uploading file(s) to a web server with the help of a CGI program or Apache module by using so called "multipart" html forms. See README.txt 5. /sessions/*.* These examples demonstrate three different ways to maintain and use sessions when building web sites that need to carry over or store information to following web pages, differentiate between visitors, etc. 5.a. /sessions/cookiesessions-auto/*.* See README.txt 5.b. /sessions/cookiesessions-login/*.* See README.txt 5.c. /sessions/urlsessions-login/*.* See README.txt Note: All of the examples have both CGI and Apache subdirectories. The web modules (unit1.pas, unit1.lfm) for the paired CGI/Apache subdirectories are exactly the same showing that from a developer's standpoint there is not too much difference between writing CGI programs or Apache modules. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] Patch for FCL-web; bug fixes and improvements for CGI and Apache applications
Sorry guys, I knew I should have called them service packs, not patches :) In the future I would like to do it in the right way, but I'm not exactly sure how. Lets say I check out the latest SVN and make some changes in a few files in /FCL-web/ . I generate a patch file which contains the differences. I create a mantis report and submit the patch there. So far so good. Now, I would like to do more changes in /FCL-web/ , how do I make the SVN client to not include the previous changes in the following patch file generations until the patches are all applied to the SVN trunk? AB Joost van der Sluis wrote: Op zaterdag 28-02-2009 om 22:06 uur [tijdzone -0800], schreef ABorka: I posted the following patch as http://bugs.freepascal.org/view.php?id=13254 (includes the changes posted in 13250 and 13228 too) It takes soo long before the patches are applied because they are too large. ;) Now you create more patches which are even longer and then another one which is again longer... That doesn't make it easier for us. It takes hours to look at such patches. So next time (not this time, we're already on it now) provide small patches if you can and try not to include old patches into new ones. Although I do admit that that's more work, that way we can apply faster and that way it's easier for you to make new changes... Joost. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
[fpc-devel] Patch for FCL-web; bug fixes and improvements for CGI and Apache applications
Hi, I posted the following patch as http://bugs.freepascal.org/view.php?id=13254 (includes the changes posted in 13250 and 13228 too) 1. Added: CGI and Apache applications' temporary uploaded files will be deleted after a request is handled /html forms with file upload(s)/ so the files are not left there in the temporary directory. 2. Fixed: Temporary files are not created with a single CRLF in them for html forms where no file(s) were uploaded. 3. Added: Apache applications are now processing and passing the input parameters (QueryFields, ContentFields, uploaded files, etc.). This was only there for CGI applications. 4. THTTPHeader and descendants RemoteAddress property renamed to RemoteAddr for Delphi compatibility 5. Note: For some unknown reason for apache mods the ap_get_remote_host(FRequest^.Connection, FRequest^.Per_Dir_Config, REMOTE_HOST, Nil) call is always crashing, therefore for now this field is not populated. This would force a DNS lookup according to the HostnameLookups setting in the Apache configuration. 6. Minor changes and corrections in comments here and there in FCL-web 7. Added custom header handling to CGI and Apache applications (ex: can send "Pragma: no-cache" header now, can do redirects, etc.) 8. Added the procedure SendRedirect(const TargetURL:String) to CGI and Apache applications ("302 Found" for HTTP/1.0 and "307 Temporary Redirect" for HTTP/1.1) 9. Fixed a bug for Apache applications that returned with the same action results after any action with the use of TFPTemplate called (the FPTemplate which is a global property for a web module was not reset after an action was handled) 10. Fixed a bug for Apache applications to pass the Status Code and Content Encoding to the web server in the response. (ex: can send 'Content-Type: text/html; charset=ISO-8859-2' now to the clients, redirects need it too to pass the status code, etc.) 11. Fixed the header name/value pair passing for Apache applications (do not need the extra space for the header values, apache puts it there automatically) 12. Minor changes to the template usage example projects in some comments (the Template:TFPTemplate is a property of the web module, not the web action) 13. Changed the behaviour for CGI and Apache applications when non existing actions are called. Until now, an error message was displayed. Now the default action is called if it exists. If not, an error message is displayed. 14. fptemplate.txt is extended with more code snippets and step by step instructions on how to create apache and cgi applications that are using templates. 15. Example projects were created for the above step by step guide into /packages/fcl-web/examples/ about the usage of template files ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] fpc.cfg and apache-modules
So when someone compiles the FPC from SVN, which httpd and apr sources will be used for /packages/fcl-web/src/fpapache.pp ? There are httpd13 httpd20 and httpd22 directories with some identical unit names (httpd, apr) that are used in fpapache.pp . Joost van der Sluis wrote: Op donderdag 26-02-2009 om 21:02 uur [tijdzone +0100], schreef Jonas Maebe: I don't know if the compiler always searches the provided paths backwards, It does. Otherwise it would be impossible to override default search paths. That's what I thought. But then this did never work? I'll commit a patch. Joost. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
[fpc-devel] Lazarus mixes the mouse-over source files
Hi, I stumped into a little confusing part regarding how it is determined what source and unit files are used by Lazarus and the FPC compiler. By moving my mouse over a function/procedure call, Lazarus displays the source code file where that item is declared. However, it seems that if there are multiple declarations exist for that item in the packages/fpc source/etc. directories then the editor can select different files to show in the hint even within the same editor file. The attached screenshots are two hints displayed for the same source code file for two calls and Lazarus shows two different source code files for both. 1. the call "apr_table_get(" shows the httpd20 directory 2. a few lines later the call "ap_get_remote_host(" shows the httpd13 directory from the FPC SVN sources. The question is how to make Lazarus/FPC use the httpd22 directory both for the mouse over hints and during compilation? (usually one is developing something for only one Apache version at a time) Thank You. <><>___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] Rebuild Lazarus fails for some reason
Hi Michael, Yes it was compiled when "make all" was called the first time, because c:\lazarus\ideintf\units\i386-win32\ contains componenttreeview.ppu and componenttreeview.o and both has the same date/time as all the other units there (obviously, because all of them were created with the "make all" command at once in step 5). That is why it is very strange why this is happening. It is a totally clean svn checkout and compilation, and without doing anything within Lazarus, Im just trying to do a Tools->Rebuild Lazarus from menu after Lazarus is first started. Of course, I got the error originally when tried to add a package so I tried to track back what the problem is. But even with a clean FPC/Lazarus SVN checkout and build this problem is there. I have no idea why it wants to recompile this unit, when nothing changed, no packages added or removed, its just a simple rebuild Lazarus from the Tools menu after a clean install. Michael Van Canneyt wrote: On Wed, 18 Feb 2009, ABorka wrote: Hi, I'm getting "componenttreeview.pas(41,18) Fatal: Can't find unit ComponentTreeView used by ObjectInspector" On this computer (win32, XP) rebuilding Lazarus does not work. Steps: 1. Clear all lazarus/fpc directories (except the c:\pp\bin\i386-win32\ so there's a working FPC compiler left to build again, included in the PATH global environment variable) 2. Check out FPC from SVN (or svn update) into c:\fpc_svn\ 3. cd c:\fpc_svn\ , make clean, make all, make install works OK 4. Check out Lazarus from SVN (or svn update) into c:\lazarus_svn\ 5. cd c:\lazarus_svn\ , make clean, make all, make install works OK 6. Start up Lazarus 7. Tools -> Build Lazarus produces the above error Therefore cannot add any packages. in the Environment options Lazarus Directory = c:\lazarus Compiler path = c:\pp\bin\i386-win32\fpc.exe FPC Source dir = c:\fpc_svn\ Seems to be something like ** http://bugs.freepascal.org/view.php?id=10433 Any thoughts? At first sight I would say that the path to the ComponentTreeView is simply not set. Without more info it's hard to tell. You would need to supply more of the error message, for instance why does the compiler want to recompile the ComponentTreeView unit ? Did it compile it before or not ? Michael. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
[fpc-devel] Rebuild Lazarus fails for some reason
Hi, I'm getting "componenttreeview.pas(41,18) Fatal: Can't find unit ComponentTreeView used by ObjectInspector" On this computer (win32, XP) rebuilding Lazarus does not work. Steps: 1. Clear all lazarus/fpc directories (except the c:\pp\bin\i386-win32\ so there's a working FPC compiler left to build again, included in the PATH global environment variable) 2. Check out FPC from SVN (or svn update) into c:\fpc_svn\ 3. cd c:\fpc_svn\ , make clean, make all, make install works OK 4. Check out Lazarus from SVN (or svn update) into c:\lazarus_svn\ 5. cd c:\lazarus_svn\ , make clean, make all, make install works OK 6. Start up Lazarus 7. Tools -> Build Lazarus produces the above error Therefore cannot add any packages. in the Environment options Lazarus Directory = c:\lazarus Compiler path = c:\pp\bin\i386-win32\fpc.exe FPC Source dir = c:\fpc_svn\ Seems to be something like http://bugs.freepascal.org/view.php?id=10433 Any thoughts? ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] Re: Unicode support (again)
Nice thread - as always when unicode handling is brought up :) There should really be a decision and feature list as soon as possible so the implementation can go on. There is really no need to spend a year on these decisions. Proper unicode handling strategy/implementation with backward and Delphi compatibility as well as a useable Lazarus debugger (Property watch, CPU window, etc.) should be the #1 priority now. Marco van de Voort wrote: In our previous episode, Jonas Maebe said: So could somebody from the core FPC team summarize or give some roadmap as to what is happing or planned for FPC + Unicode support? If anyone can, it's Florian, since he has done all the work in this area until now. There is no roadmap document or official planning or so. I summarized some earlier summer discussions here: http://www.stack.nl/~marcov/unicode.pdf but I haven't it updated since that date. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
[fpc-devel] Zero terminated strings
Hi, Are strings not zero terminated? I have a function declared: function myfunc(s :String; i: Integer):String; When going through the string "s" with asm instructions, it does not seem to have a zero byte at the end. Is this normal or something is not OK (maybe now with utf8 strings as defaults it is not there any longer)? I got around this by doing a StrPCopy into a buffer of bytes, so just asking. Thanks for any feedback ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] asm offset question
True, but if the programs only run on PCs (Windows and Linux on Intel processors in this case) it should work. Not everyone who considers using FPC/Lazarus wants to run the compiled programs on 15 platforms. Sometimes all that is needed is 1 platform. There are some encrypting/decrypting functions that would be hard to write in other than asm, especially if they are already done. Some projects I just wanted to try to compile strictly on Windows without wanting to go to other OS-es. Just to see if it is possible at all to move projects over to FPC/Lazarus from Delphi with a reasonable amount of work. Until that doesn't work, going to other OS-es is not really viable anyway. Not having a debugger in Lazarus with a properly working watch window and CPU window doesn't help either to do these tasks. The "offset", "aam" and "aad" asm instructions are not working as they are in Delphi, but there are workarounds fortunately, until they will be fixed in FPC, if ever. http://bugs.freepascal.org/view.php?id=12595 aam 16 (or aam 8, etc.) aad 16 (or aad 8, etc.) Both give compiler errors and points to the wrong source line. Need to use "db" instructions to put the machine code there to circumvent it. move esi, offset variable Gives compiler error but the functionality can be replaced with the "lea esi, variable" instruction instead as a workaround. Michael Schnell wrote: IMHO, it's not a good idea to "port" ASM code to TP (as TP's purpose is platform independence). So at best you should rewrite this in Pascal. Normally with modern PCs the performance decrease is not noticeable. -Michael ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] asm offset question
Thanks. It seems that mov al, dl as well as xor al, dl gives error too. I created a bug report http://bugs.freepascal.org/view.php?id=12595 Daniël Mantione wrote: Op Sat, 8 Nov 2008, schreef ABorka: Hi, I'm converting a Delphi program to FPC/lazarus and I did hit a snag with an asm code part (win32, latest fpc and lazarus svn trunk is used). I know it is probably simple to fix, but I cannot seem to be able to figure it out: function something(s :String; i: Integer):String; var tmp:Array[0..32768]of byte; begin . . {$ASMMODE intel} asm pushad mov edi, offset tmp add edi, ebp . . popad end; end; The compiler gives "Error: Cannot use local variable or parameters here" at line "mov edi, offset tmp" . How can I get the offset of a local variable into a register? This seems like an incompatibility you might want to report. However, you can replace the mov & add by: lea edi,tmp ... whould should be accepted by FPC. Daniël ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
[fpc-devel] asm offset question
Hi, I'm converting a Delphi program to FPC/lazarus and I did hit a snag with an asm code part (win32, latest fpc and lazarus svn trunk is used). I know it is probably simple to fix, but I cannot seem to be able to figure it out: function something(s :String; i: Integer):String; var tmp:Array[0..32768]of byte; begin . . {$ASMMODE intel} asm pushad mov edi, offset tmp add edi, ebp . . popad end; end; The compiler gives "Error: Cannot use local variable or parameters here" at line "mov edi, offset tmp" . How can I get the offset of a local variable into a register? Thanks for any help. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
[fpc-devel] Apache module fixes (fcl-web, httpd22 and Lazarus apache modules)
It seems everything works now with the latest apache servers both on Windows and Linux. Submitted 3 patches: fcl-web patch : http://bugs.freepascal.org/view.php?id=12373 fcl/packages/fcl-web/ httpd22 patch : http://bugs.freepascal.org/view.php?id=12374 fcl/packages/httpd22/ lazarus patch : http://bugs.freepascal.org/view.php?id=12375 lazarus/components/fpweb/ With the above patches apache modules are working and can handle multiple simultaneous requests on both platforms (tested with apache 2.2.8 Linux and apache 2.2.9 Windows). AB ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] library export in Linux
> Does it also work (instead of only loading) without the ifdef and > without you debuging code? The mod_hello most basic example works (apache 2.2.3 and 2.2.8). But for now, not any vanilla apache module created with file->new->apache module in Lazarus on Linux works (apache 2.2.8, didn't test on 2.2.3) even with the exports changes. Even with only 1 default action in the web module saying "hello world" when called. Felipe Monteiro de Carvalho wrote: On 10/5/08, ABorka <[EMAIL PROTECTED]> wrote: If the assignfile is called, it already screws the DefaultHandler execution even if the lines after it are commented out in the procedure. Any suggestion why? I've tried to use streams, same result. wow, this is really strange. I cannot think of a reason why this would happen ... if noone else here has an idea I would ask in a apache mailling list. There may be some reason connected to the internal apache structure. Yes, it is strange. And modules created through Lazarus on Linux have the same problem of returning an empty page no matter what. And there is no debugging log file writing in there. Not sure about stream useage though. We need to fix it in the hello_mod example first - since the little library is so simple - , I think it'll fix the apache modules created with Lazarus too. There is also the problem of WaitForThreadTerminate(BeginThread(@__dummythread), 300); never returning for me on Linux apache module library. This fixed the multiple simultaneous calls on windows, but on Linux it does not return. Might not even be needed, but for now cannot test it before the above is fixed. Just commented it out for now on Linux. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] Lazarus Apache module crashes during concurrent requests
Hi Jonas, This seems to work on Windows (and solves the problem), but on Linux WaitForThreadTerminate waits forever. WaitForThreadTerminate(BeginThread(@__dummythread), 300); apache just waits and doesn't start until I stop the apache loading with ctrl+c, as if it is in an infinite loop and waiting. Any thoughts? AB Jonas Maebe wrote: On 24 Sep 2008, at 10:58, ABorka wrote: I'm not sure that something is changed to make it incompatible. The apache modules compiled on windows are only crashing if multiple requests are coming at the same time, and they are crushing at function/procedure returns (Yes, on Linux it is even worse, since no module gets even loaded by apache. That might be some C API translation problem). Maybe you have to initialise the threading system so all the necessary locks in the system unit get activated. Something like {$ifdef unix} uses cthreads; {$endif} ... function dummythread(p: pointer): ptrint; begin end; initialisation WaitForThreadTerminate(BeginThread(@dummythread)); end. Jonas ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] library export in Linux
Hi Felipe, The problem is only there (checked now on apache 2.2.3 also with the latest svn fpc /11864/ and lazarus /16875/ trunk) if {$ifdef WINDOWS}//!! not needed exports test_module name 'test_module1'; {$endif}//!! not needed is there. If the ifdef is removed and the exports instruction is there, then apache loads the module without any errors on Linux. An additional problem for me was that I've used a procedure to write to a log file for debugging purposes. It is working on Windows but on Linux it somehow puts the apache module execution into a black hole after it is called within the defaulthandler function (it is ok if it is called in the initialization section or in the RegisterHooks procedure): procedure WriteToLogFile(MessageStr:String); var f: textfile; LogFile:String; begin LogFile := '/HTTPDebugLogFile.log'; assignfile(f, LogFile); if not FileExists(LogFile) then ReWrite(f) else Append(f); writeln(f, FormatDateTime('/mm/dd hh:mm:ss.zzz', Now) + ':' + MessageStr); closefile(f); end; If the assignfile is called, it already screws the DefaultHandler execution even if the lines after it are commented out in the procedure. Any suggestion why? I've tried to use streams, same result. AB Felipe Monteiro de Carvalho wrote: Ok, I go back to my previous idea. Test it with an older apache (specially good would be 2.2.3). ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] library export in Linux
:) The C example still works with ap_hook_handler, maybe they made it a macro or something? I believe the translation was for apache 2.2.3 header files, based on the ap_mmn.inc included in fpc/packages/httpd22 In the comments there we can see * 20051115.2 (2.2.2) added inreslist member to proxy_conn_rec (minor) * 20051115.3 (2.2.3) Added server_scheme member to server_rec (minor) } as last entry. The same file for apache 2.2.9 continues with more entries to * 20051115.2 (2.2.2) added inreslist member to proxy_conn_rec (minor) * 20051115.3 (2.2.3) Added server_scheme member to server_rec (minor) * 20051115.4 (2.2.4) Added ap_get_server_banner() and * ap_get_server_description() (minor) * 20051115.5 (2.2.5) Added ap_mpm_safe_kill() (minor) * 20051115.6 (2.2.7) Added retry_set to proxy_worker (minor) * 20051115.7 (2.2.7) Added conn_rec::clogging_input_filters (minor) * 20051115.8 (2.2.7) Added flags to proxy_alias (minor) * 20051115.9 (2.2.7) Add ap_send_interim_response API * 20051115.10(2.2.7) Added ap_mod_status_reqtail (minor) * 20051115.11(2.2.7) Add *ftp_directory_charset to proxy_dir_conf * 20051115.12(2.2.8) Add optional function ap_logio_add_bytes_in() to mog_logio * 20051115.13(2.2.9) Add disablereuse and disablereuse_set * to proxy_worker struct (minor) * 20051115.14(2.2.9) Add ap_proxy_ssl_connection_cleanup and * add *scpool, *r and need_flush to proxy_conn_rec * structure * 20051115.15(2.2.9) Add interpolate_env to proxy_dir_conf and * introduce proxy_req_conf. * */ So from the MODULE_MAGIC_NUMBER_MINOR = 3;// 0...n we can see it was 2.2.3 when translated for FPC for apache 2.2.9, the MODULE_MAGIC_NUMBER_MINOR is 15 But the question is, if they changed it so much how come all this works for Windows then? Felipe Monteiro de Carvalho wrote: wow, I just downloaded the source code of apache 2.2.9 and I can't even find ap_hook_handler! o.O I think they removed the function. I just looked at the apache 2.2 fpc headers, and the version info is missing. I somehow forgot to write in which apache version the translation was based. based on the huge difference between our headers and the c headers that I see, I think that the entire fpc apache 2.2 headers need to be reviewed. But I am really confused. How could apache 2.2 change so much? Maybe it was still experimental when I did the initial translation? And what substitutes ap_hook_handler? ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] library export in Linux
OK, I'll see what can I do to get some older apache into a Linux install to test it. Did some more tests meanwhile, if the ap_hook_handler is executed below, all the modules loaded after this one in the apache2.conf, are stop working (always returning an empty page). If it is commented out, they are OK. So something is probably wrong with the Defaulthandler function declaration on Linux - or something - that breaks the module chain after the fpc compiled module. Also, the Defaulthandler is not called (not even the first instruction is executed in it ever). function DefaultHandler(r: PRequest_Rec): Integer; cdecl; ...snip... procedure RegisterHooks(p: Papr_pool_t); cdecl; begin ap_hook_handler(@DefaultHandler, nil, nil, APR_HOOK_MIDDLE); end; The module_struct declaration is OK theoretically because the Registerhooks procedure is called after the module is loaded by apache. Felipe Monteiro de Carvalho wrote: On Thu, Oct 2, 2008 at 10:53 PM, ABorka <[EMAIL PROTECTED]> wrote: It works under Windows with apache 2.2.9 which is even newer version, but not on Linux with apache 2.2.8 . Is it still needed to be checked on older Apache versions? Yes, it's a linux specific problem. You need to compare versions running in Linux. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] library export in Linux
It works under Windows with apache 2.2.9 which is even newer version, but not on Linux with apache 2.2.8 . Is it still needed to be checked on older Apache versions? Felipe Monteiro de Carvalho wrote: On Thu, Oct 2, 2008 at 10:14 PM, ABorka <[EMAIL PROTECTED]> wrote: Any suggestion why apache 2.2.8 does not want to load the FPC compiled apache modules (ex: mod_hello.pp in packages/httpd2/examples) on Linux? Some time ago I suggested for you to test older apache versions. I still suggest that. Also try Apache 2.0. If older versions work, then we should start looking for what changed. If not even that works then look for something more basic. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] library export in Linux
Thanks, Jonas. Any suggestion why apache 2.2.8 does not want to load the FPC compiled apache modules (ex: mod_hello.pp in packages/httpd2/examples) on Linux? . .snip . {$define Apache2_2} uses SysUtils, httpd {$ifndef Apache1_3}, apr{$endif}; var test_module: module; public name 'test_module'; {*** * Free Pascal only supports exporting variables on Windows ***} {$ifdef WINDOWS} exports test_module name 'test_module'; {$endif} . .snip . begin default_module_ptr := @test_module; FillChar(default_module_ptr^, SizeOf(default_module_ptr^), 0); STANDARD20_MODULE_STUFF(test_module); with test_module do begin name := MODULE_NAME; register_hooks := @RegisterHooks; end; end. does not work ("Can't locate API module structure"). The length of module_struct (module = module_struct) is correct compared to the C compiled working apache modules. Did these example programs work before fpc supported "exports test_module"? Jonas Maebe wrote: > > On 28 Sep 2008, at 10:15, ABorka wrote: > >> Is the "exports" now supported in Linux or it's a glitch that apache loads the modules with the exports in them? > > It is now supported, as long as the "exports" name is the same as the original variable's name. > > > Jonas > ___ > fpc-devel maillist - fpc-devel@lists.freepascal.org > http://lists.freepascal.org/mailman/listinfo/fpc-devel > Jonas Maebe wrote: On 28 Sep 2008, at 10:15, ABorka wrote: Is the "exports" now supported in Linux or it's a glitch that apache loads the modules with the exports in them? It is now supported, as long as the "exports" name is the same as the original variable's name. Jonas ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] Strange things with the apache header files on Linux
I am using the latest checkout for both fpc and lazarus (well, 2 or 3 days old checkout now). Bug 11460 only fixes the apr_off_t to be int64 which is already in the checked out code. It does not fix the problem currently for apache modules. Compiled apache modules are not working (example programs included in the fcl package directory httpd22/examples) The record length for module_struct and request_rec are the same for the fpc compiled apache module and a C compiled module, still the fpc compiled one does not work. Marco van de Voort wrote: In our previous episode, ABorka said: On Linux (Ubuntu 8.04), latest SVN, in fpc/packages/httpd22/... If you use 2.2.3 branch, I had a feeling I had seen something like this before and found bug 11460, so I merged the fixes for bug 11460 from 2.3.1 to 2.2.1 ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] Strange things with the apache header files on Linux
When copying the files from httpd22 dir to my project directory and recompiling them with my project the record sizes are OK and same as the C compiled apache module. Yet, the apache module compiled with FPC/Lazarus is not working. The hooked DefaultHandler function is never called, just an empty web page is returned. Everything works under Windows, but not on Linux. ABorka wrote: On Linux (Ubuntu 8.04), latest SVN, in fpc/packages/httpd22/... in httpd.inc inside request_rec: { body byte count, for easy access } bytes_sent: apr_off_t; { Last modified time of the requested resource } mtime: apr_time_t; in apr.pas : apr_off_t = Int64; apr_int64_t = Int64; in apr_time.inc : apr_time_t = apr_int64_t; Using an example apache module compiled with FPC/Lazarus (the initialization part is executed when apache loads): sizeof(apr_int64_t) gives 4 sizeof(apr_off_t) gives 4 sizeof(apr_time_t) gives 8 sizeof(request_rec.bytes_sent) gives 4 sizeof(request_rec.mtime) gives 8 Shouldn't all be 8 bytes? Or am I missing something? And why apr_time_t is the correct 8 if the others are 4? One of the reasons that the C compiled apache modules have 412 bytes (correctly) in "request_rec" instead of the 384 bytes (incorrectly) in the FPC compiled ones is that sizeof(apr_off_t) is 4 instead of 8. This might be the reason that apache modules are not working on Linux compiled with FPC/lazarus, unless I'm way off track... Any thoughts? ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
[fpc-devel] Strange things with the apache header files on Linux
On Linux (Ubuntu 8.04), latest SVN, in fpc/packages/httpd22/... in httpd.inc inside request_rec: { body byte count, for easy access } bytes_sent: apr_off_t; { Last modified time of the requested resource } mtime: apr_time_t; in apr.pas : apr_off_t = Int64; apr_int64_t = Int64; in apr_time.inc : apr_time_t = apr_int64_t; Using an example apache module compiled with FPC/Lazarus (the initialization part is executed when apache loads): sizeof(apr_int64_t) gives 4 sizeof(apr_off_t) gives 4 sizeof(apr_time_t) gives 8 sizeof(request_rec.bytes_sent) gives 4 sizeof(request_rec.mtime) gives 8 Shouldn't all be 8 bytes? Or am I missing something? And why apr_time_t is the correct 8 if the others are 4? One of the reasons that the C compiled apache modules have 412 bytes (correctly) in "request_rec" instead of the 384 bytes (incorrectly) in the FPC compiled ones is that sizeof(apr_off_t) is 4 instead of 8. This might be the reason that apache modules are not working on Linux compiled with FPC/lazarus, unless I'm way off track... Any thoughts? ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] Lazarus Apache module crashes during concurrent requests
Nevermind, on Ubuntu the request_rec is only 384 bytes for FPC instead of 412. But that still does not explain why the handler function is not even getting called by apache. ABorka wrote: OK, after 4 days of pulling my (remaining) hair out I was able to compile a basic C apache module on Ubuntu 8.04 (apache 2.2.8). It seems both fpc/lazarus (not working apache module) and the C compiled (working apache module) one shows sizeof(request_rec) = 412 sizeof(module_struct) = 56 So the length seems to be the same for for both. Still, the Lazarus compiled apache module doesn't even load in apache (mod_hello.pp or any of the other examples included in fpc). If the exports is included then it loads but doesn't work at all: modified "mod_hello.pp" from fpc/packages/httpd22/examples/ {*** * Test library of the Apache Pascal Headers ***} library mod_hello; {*** * The mode must be objfpc on this unit because the unix code uses * some extensions introduced on Free Pascal ***} {$ifdef fpc} {$mode objfpc}{$H+} {$endif} {$IFDEF WIN32} {$DEFINE WINDOWS} {$ENDIF} {$define Apache2_2} uses SysUtils, httpd {$ifndef Apache1_3}, apr{$endif}; var test_module: module; public name 'test_module'; default_module_ptr: Pmodule; const MODULE_NAME = 'mod_hello.so'; {*** * Free Pascal only supports exporting variables on Windows ***} { $ifdef WINDOWS}//commented out, exports work in Linux now exports test_module name 'test_module'; { $endif}//commented out, exports work in Linux now . .snip . Not sure why the Lazarus/fpc apache modules do not work on apache 2.2.8 or 2.2.9 on Ubuntu. The above module is loaded, the handler registering function is called, but the handler never gets triggered when the module is called from a browser. Michael Van Canneyt wrote: Any suggestions? Yes: please print the size of the Request_rec (or TRequest_Rec) and the same record in C. Compare if they are equal. Same for the module record. If they are not equal, then we know it is a problem with the pascal definition of this record. I've had to do this exercise about 30 times myself on various platforms to get it right. Maybe they changed the size again. Michael. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] Lazarus Apache module crashes during concurrent requests
OK, after 4 days of pulling my (remaining) hair out I was able to compile a basic C apache module on Ubuntu 8.04 (apache 2.2.8). It seems both fpc/lazarus (not working apache module) and the C compiled (working apache module) one shows sizeof(request_rec) = 412 sizeof(module_struct) = 56 So the length seems to be the same for for both. Still, the Lazarus compiled apache module doesn't even load in apache (mod_hello.pp or any of the other examples included in fpc). If the exports is included then it loads but doesn't work at all: modified "mod_hello.pp" from fpc/packages/httpd22/examples/ {*** * Test library of the Apache Pascal Headers ***} library mod_hello; {*** * The mode must be objfpc on this unit because the unix code uses * some extensions introduced on Free Pascal ***} {$ifdef fpc} {$mode objfpc}{$H+} {$endif} {$IFDEF WIN32} {$DEFINE WINDOWS} {$ENDIF} {$define Apache2_2} uses SysUtils, httpd {$ifndef Apache1_3}, apr{$endif}; var test_module: module; public name 'test_module'; default_module_ptr: Pmodule; const MODULE_NAME = 'mod_hello.so'; {*** * Free Pascal only supports exporting variables on Windows ***} { $ifdef WINDOWS}//commented out, exports work in Linux now exports test_module name 'test_module'; { $endif}//commented out, exports work in Linux now . .snip . Not sure why the Lazarus/fpc apache modules do not work on apache 2.2.8 or 2.2.9 on Ubuntu. The above module is loaded, the handler registering function is called, but the handler never gets triggered when the module is called from a browser. Michael Van Canneyt wrote: Any suggestions? Yes: please print the size of the Request_rec (or TRequest_Rec) and the same record in C. Compare if they are equal. Same for the module record. If they are not equal, then we know it is a problem with the pascal definition of this record. I've had to do this exercise about 30 times myself on various platforms to get it right. Maybe they changed the size again. Michael. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
[fpc-devel] library export in Linux
In the apache module examples in /fpc/packages/httpd22/examples/ all of them has a "Free Pascal only supports exporting variables on Windows" note there and something like {$ifdef WINDOWS} exports test_module name 'test_module'; {$endif} With Apache 2.2.8 and 2.2.9 (the two I can test) on Linux the apache modules compiled with fpc/lazarus all give the "Can't locate API module structure" error when trying to load them at apache startup. I noticed that if I remove the ifdef above and leave the exports there it compiles and apache actually loads the module (doesn't work though for me yet when trying to do a request). At least there is no error message when apache starts up. Is the "exports" now supported in Linux or it's a glitch that apache loads the modules with the exports in them? Thanks, AB ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] Lazarus Apache module crashes during concurrent requests
For me in Windows XP 32bit/ FPC (apache modules load properly): sizeof(request_rec)=416 sizeof(module_struct)=56 For me in Ubuntu 8.04 32bit/ FPC (apache modules don't load): sizeof(request_rec)=412 sizeof(module_struct)=56 Used exactly the same files to compile a project on Ubuntu but for some reason it is 4 bytes shorter there for request_rec. This shouldn't effect the module loading at apache2 startup, right? Only module_struct incompatibility should give the "...Can't locate API module structure `mod_apache1' in file ..." error. Michael Van Canneyt wrote: Yes: please print the size of the Request_rec (or TRequest_Rec) and the same record in C. Compare if they are equal. Same for the module record. If they are not equal, then we know it is a problem with the pascal definition of this record. I've had to do this exercise about 30 times myself on various platforms to get it right. Maybe they changed the size again. Michael. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] Lazarus Apache module crashes during concurrent requests
Well, it seems we have some progress now. The WaitForThreadTerminate(BeginThread(@__dummythread), 300); seems to fix it on Windows. At least for 2 concurrent requests. For some reason Apache cannot seem to want to run more than 2 requests at a time. If more comes in at a time, the first 2 starts running and the rest have to wait till at least 1 current request is handled. Even when MaxConnectionsPerServer is set to higher than 2 in the registry. uses cmem; did not fix the crash on Windows. I will try to make apache modules load in Linux next so some tests can be done there too. AB Jonas Maebe wrote: On 24 Sep 2008, at 13:02, Michael Van Canneyt wrote: On Wed, 24 Sep 2008, Jonas Maebe wrote: On 24 Sep 2008, at 12:35, Michael Van Canneyt wrote: This is a known problem; the heap manager does not function correctly in a DLL when an external program (apache, in this case) creates new threads. The heap manager is simply not thread safe until the FPC threading system has been initialised (by starting a thread). It is not that simple. The heap manager cannot handle situations where threads have been started by code that is not aware of the FPC threading mechanisms - such as apache. Ah yes, that's indeed a problem with the new 2.3.x heap manager. I don't think the 2.2.x heap manager cares though, since it uses a regular critical section/mutex. Jonas ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] Lazarus Apache module crashes during concurrent requests
I'm not sure that something is changed to make it incompatible. The apache modules compiled on windows are only crashing if multiple requests are coming at the same time, and they are crushing at function/procedure returns (Yes, on Linux it is even worse, since no module gets even loaded by apache. That might be some C API translation problem). Even if reduced to this small code it crushes (but only if multiple calls are inside this code) on windows: === Function TCustomApacheApplication.ProcessRequest(P: PRequest_Rec) : Integer; Var Req : TApacheRequest; Resp : TApacheResponse; i:integer; begin Req:=TApacheRequest.CreateReq(Self,P); Try Resp:=TApacheResponse.CreateApache(Req); Try for i := 0 to maxint do ;//Time wasting for multiple requests at the same time to run this code // HandleRequest(Req,Resp); // If Not Resp.ContentSent then //Resp.SendContent; Finally Result:=OK; Resp.Free;//<= crashes after here randomly for 2nd simultaneous caller end; Finally Req.Free; end; end; == Sometimes when removing all the try/finally pairs from the function it works. But then adding more code, even as simple as DateTimeToStr(Now), makes it crash. Sometimes more code can be added but then it will crash inside that code somewhere at function/procedure returns. AB Felipe Monteiro de Carvalho wrote: Try installing an older Apache. I installed here with XAMMP, Apache 2.2.9 and it just quits without any error message when loading my Pascal module. But when using the standard Apache 2.2.6 in Mandriva 2008 it works. Actually I can't get it to show the page (some config problem?), but it loads without problems, apache keeps working. I think something changed in an incompatible way. This is pretty unexpected, as I hoped that they would keep compatibility between all 2.2.x series. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] Lazarus Apache module crashes during concurrent requests
Hi Michael, Unfortunately, I do not have any C compilers - nor the knowledge to compile something with the apache header files in C. I manually compared the .h/.inc and the translated pascal structures/records for the two you have mentioned (module_struct and request_rec) and they seem to have the same fields, nothing added to them so far till Apache 2.2.9 . For me in Windows XP 32bit/ FPC: sizeof(request_rec)=416 sizeof(module_struct)=56 Not sure if it is a full list but in the apr header files (ap_mmn.h) there's a change list: . .snip I believe the translation happened for 2.2.3 so those are included . +* 20051115.4 (2.2.4) Added ap_get_server_banner() and * ap_get_server_description() (minor) * 20051115.5 (2.2.5) Added ap_mpm_safe_kill() (minor) * 20051115.6 (2.2.7) Added retry_set to proxy_worker (minor) +* 20051115.7 (2.2.7) Added conn_rec::clogging_input_filters (minor) * 20051115.8 (2.2.7) Added flags to proxy_alias (minor) +* 20051115.9 (2.2.7) Add ap_send_interim_response API * 20051115.10(2.2.7) Added ap_mod_status_reqtail (minor) * 20051115.11(2.2.7) Add *ftp_directory_charset to proxy_dir_conf * 20051115.12(2.2.8) Add optional function ap_logio_add_bytes_in() to mog_logio * 20051115.13(2.2.9) Add disablereuse and disablereuse_set * to proxy_worker struct (minor) * 20051115.14(2.2.9) Add ap_proxy_ssl_connection_cleanup and * add *scpool, *r and need_flush to proxy_conn_rec * structure * 20051115.15(2.2.9) Add interpolate_env to proxy_dir_conf and * introduce proxy_req_conf. The ones marked with '+' I added to my httpd.inc and httpd_protocol.inc files. The rest were for apache mods (mod_proxy, etc.) so ignored them. The crash did not go away. At least on Windows, Apache loads the module and executes it sometimes. On Linux the apache modules compiled don't even load. AB Michael Van Canneyt wrote: On Mon, 22 Sep 2008, ABorka wrote: After some more debugging the result is even stranger: If I reduce the code to the bare minimum there is still a crash most of the time. 1. works always for 2 concurrent requests: procedure TCustomApacheApplication.HandleRequest(ARequest: TRequest; AResponse: TResponse); Var MC : TCustomHTTPModuleClass; M : TCustomHTTPModule; MN : String; MI : TModuleItem; i:Integer; begin MI:=ModuleFactory[0]; MC:=MI.ModuleClass; M:=MC.Create(Self); M.Name := ''; aresponse.content := 'Hello'; for i := 0 to Maxint do;//time wasting loop, about 5 secs end; 2. crashes randomly: begin MI:=ModuleFactory[0]; MC:=MI.ModuleClass; M:=MC.Create(Self); M.Name := ''; M.HandleRequest(ARequest,AResponse); for i := 0 to Maxint do;//time wasting loop, about 5 secs end;//<= sometimes crash after here but before returning to caller function 3. always crashes: begin try MI:=ModuleFactory[0]; MC:=MI.ModuleClass; M:=MC.Create(Self); M.Name := ''; aresponse.content := 'Hello'; for i := 0 to Maxint do;//time wasting loop, about 5 secs except On E : Exception do ShowRequestException(AResponse,E); end; end;//<= guaranteed crash after here but before returning to caller function When M.HandleRequest(ARequest,AResponse); is used instead of aresponse.content := 'Hello'; the crash is random at procedure return for the 2nd simultaneous caller. When the procedure contains any try/except it is guaranteed not returning (crashing) after the work is finished for the 2nd caller (2nd simultaneaous request). The first simultaneous caller always works without a problem. Any suggestions? Yes: please print the size of the Request_rec (or TRequest_Rec) and the same record in C. Compare if they are equal. Same for the module record. If they are not equal, then we know it is a problem with the pascal definition of this record. I've had to do this exercise about 30 times myself on various platforms to get it right. Maybe they changed the size again. Michael. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] Lazarus Apache module crashes during concurrent requests
After some more debugging the result is even stranger: If I reduce the code to the bare minimum there is still a crash most of the time. 1. works always for 2 concurrent requests: procedure TCustomApacheApplication.HandleRequest(ARequest: TRequest; AResponse: TResponse); Var MC : TCustomHTTPModuleClass; M : TCustomHTTPModule; MN : String; MI : TModuleItem; i:Integer; begin MI:=ModuleFactory[0]; MC:=MI.ModuleClass; M:=MC.Create(Self); M.Name := ''; aresponse.content := 'Hello'; for i := 0 to Maxint do;//time wasting loop, about 5 secs end; 2. crashes randomly: begin MI:=ModuleFactory[0]; MC:=MI.ModuleClass; M:=MC.Create(Self); M.Name := ''; M.HandleRequest(ARequest,AResponse); for i := 0 to Maxint do;//time wasting loop, about 5 secs end;//<= sometimes crash after here but before returning to caller function 3. always crashes: begin try MI:=ModuleFactory[0]; MC:=MI.ModuleClass; M:=MC.Create(Self); M.Name := ''; aresponse.content := 'Hello'; for i := 0 to Maxint do;//time wasting loop, about 5 secs except On E : Exception do ShowRequestException(AResponse,E); end; end;//<= guaranteed crash after here but before returning to caller function When M.HandleRequest(ARequest,AResponse); is used instead of aresponse.content := 'Hello'; the crash is random at procedure return for the 2nd simultaneous caller. When the procedure contains any try/except it is guaranteed not returning (crashing) after the work is finished for the 2nd caller (2nd simultaneaous request). The first simultaneous caller always works without a problem. Any suggestions? ABorka wrote: win32, latest Lazarus and FPC Any single web request call works OK, returning the content. When 2 browsers are open and calling the web module at the same time there is a crash happening after the 2nd one finishes working (just made a loop in the web action which lasts a few seconds to have both requests inside the server at the same time). Details: in /fpc/packages/fcl-web/src/fpapache.pp Function TCustomApacheApplication.ProcessRequest(P: PRequest_Rec) : Integer; Var Req : TApacheRequest; Resp : TApacheResponse; begin Req:=TApacheRequest.CreateReq(Self,P); Try Resp:=TApacheResponse.CreateApache(Req); Try HandleRequest(Req,Resp); <== call happens here OK but 2nd concurrent request does not return, gets lost in the ether Finally Result:=OK; Resp.Free; end; Finally Req.Free; end; end; procedure TCustomApacheApplication.HandleRequest(ARequest: TRequest; AResponse: TResponse); Var MC : TCustomHTTPModuleClass; M : TCustomHTTPModule; MN : String; MI : TModuleItem; begin try MC:=Nil; If (OnGetModule<>Nil) then OnGetModule(Self,ARequest,MC); If (MC=Nil) then begin MN:=GetModuleName(ARequest); If (MN='') and Not AllowDefaultModule then Raise EFPApacheError.Create(SErrNoModuleNameForRequest); MI:=ModuleFactory.FindModule(MN); If (MI=Nil) and (ModuleFactory.Count=1) then MI:=ModuleFactory[0]; if (MI=Nil) then begin Raise EFPApacheError.CreateFmt(SErrNoModuleForRequest,[MN]); end; MC:=MI.ModuleClass; end; M:=FindModule(MC); // Check if a module exists already If (M=Nil) then begin M:=MC.Create(Self); M.Name := '';//without this there's a crash due to same name end; M.HandleRequest(ARequest,AResponse);//calls the web action here, works OK for both concurrent requests except On E : Exception do ShowRequestException(AResponse,E); end; end; <== everything works, but the 2nd concurrent request crashes after here but before returning to the caller function A little bit strange that this happens. The return content is prepared in both simultaneous calls properly. Any thoughts what could be the cause? AB ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel