Recent

Author Topic: [Solved] Problem extending FPC  (Read 5036 times)

Mike.Cornflake

  • Hero Member
  • *****
  • Posts: 1248
[Solved] Problem extending FPC
« on: June 28, 2014, 11:43:10 am »
I'm trying my hand at extending fpc trunk.  Simple changes (final code will be slightly different, I'm aware that at the moment the user can pass undesired options to TProcess)

process.pp
Code: [Select]
//old
function RunCommand(const exename:string;const commands:array of string;var outputstring:string):boolean;
function RunCommand(const cmdline:string;var outputstring:string):boolean; deprecated;

//new
function RunCommand(const exename:string;const commands:array of string;var outputstring:string;const AExtraProcessOptions:TProcessOptions=[]):boolean;
function RunCommand(const cmdline:string;var outputstring:string;const AExtraProcessOptions:TProcessOptions=[]):boolean; deprecated;

My development environment is Lazarus Trunk.
I rebuild fpc with make clean all, and I've good confidence that's working.  If I introduce syntax errors into my process.pp, then this rebuild bombs out at the expected place.
I then rebuild lazarus with clean all as well.  And finally try to rebuild my test app with "clean up build files"

No matter what I try, I always end up with...
Quote
FormMain.pas(161,7) Error: Wrong number of parameters specified for call to "RunCommand"
Error: Found declaration: RunCommand(const AnsiString;const {Open} Array Of AnsiString;var AnsiString):Boolean;
Error: Found declaration: RunCommand(const AnsiString;var AnsiString):Boolean;

Line 167 is
Code: [Select]
      RunCommand(MplayerControl1.MPlayerPath, arrCommands, sOutput, [poNoConsole]);
ctrl-clicking on RunCommand in my form takes me to the modified process.pp, and as I said, I've clean rebuilt everything I can think of.

All paths defined in Lazarus - Tools - Options are pointing to the trunk fpc that I'm modifiying.

What step am I missing, or where I can look to find to another path that might be incorrect?
« Last Edit: June 28, 2014, 12:19:40 pm by Mike.Cornflake »
Lazarus Trunk/FPC Trunk on Windows [7, 10]
  Have you tried searching this forum or the wiki?:   http://wiki.lazarus.freepascal.org/Alternative_Main_Page
  BOOKS! (Free and otherwise): http://wiki.lazarus.freepascal.org/Pascal_and_Lazarus_Books_and_Magazines

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: Problem extending FPC
« Reply #1 on: June 28, 2014, 11:45:23 am »
Wild guess (haven't read closely) Tools/Rescan FPC source directory in Lazarus after rebuild
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

Mike.Cornflake

  • Hero Member
  • *****
  • Posts: 1248
Re: Problem extending FPC
« Reply #2 on: June 28, 2014, 11:47:46 am »
Many thanks for the ultra quick reply, but no go I'm afraid...

UPDATE:  Hmmm.  If I introduce syntax errors into process.pp, then the Lazarus rebuild doesn't fail, it just continues right on :-(
« Last Edit: June 28, 2014, 11:51:51 am by Mike.Cornflake »
Lazarus Trunk/FPC Trunk on Windows [7, 10]
  Have you tried searching this forum or the wiki?:   http://wiki.lazarus.freepascal.org/Alternative_Main_Page
  BOOKS! (Free and otherwise): http://wiki.lazarus.freepascal.org/Pascal_and_Lazarus_Books_and_Magazines

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: Problem extending FPC
« Reply #3 on: June 28, 2014, 11:52:01 am »
Mmm, a bit
I rebuild fpc with make clean all, and I've good confidence that's working.  If I introduce syntax errors into my process.pp, then this rebuild bombs out at the expected place.
I then rebuild lazarus with clean all as well.  And finally try to rebuild my test app with "clean up build files"
Ah... building fpc with make clean all will rebuild FPC but not copy the compiled units into the (fpcdir)\units directory.
I'd suggest doing make clean all install or if that doesn't work make clean all followed by make install.
Then rebuild Lazarus.
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: Problem extending FPC
« Reply #4 on: June 28, 2014, 11:54:19 am »
Or, of course <cue drumroll> fpcup using settings like this:
Code: [Select]
[buildonly]
; no checkout/update
binutilsdir=c:\development\fpcbootstrap
fpcbootstrapdir=c:\development\fpcbootstrap
fpcdir=c:\development\fpctrunk
fpcurl=http://svn.freepascal.org/svn/fpc/trunk
lazdir=c:\development\lazarus
primary-config-path=c:\development\lazarussettings
;fpcopt=""
fpcopt="-gw2 -gl -O-1"
;fpcrevision=27774
fpcuplinkname=""
lazlinkname=Laz32FPCTrunk
lazopt="-gw2 -gl -O-1"
noconfirm=true
keeplocalchanges=true
synapsetrunk=1
only=FPCBuildOnly,LazarusBuildOnly,useride
skip=FPCCleanOnly,FPCGetOnly,LazarusCleanOnly,LazarusGetOnly,crosswin32-64
Basically copy over your existing settings and add the only= and skip= lines to just rebuild FPC and Lazarus
Then run fpcup --inifile=whateveryou'reusing.ini --inisection=buildonly
... or use fpcupgui to select the ini section you want.

</advertisement>
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

Mike.Cornflake

  • Hero Member
  • *****
  • Posts: 1248
Re: Problem extending FPC
« Reply #5 on: June 28, 2014, 12:09:32 pm »
Nice one  :D  I suspect make clean all install will be the bit I was missing.  Many thanks  :)

I also thought fpcup, and am currently in the middle of running this with the -keeplocalchanges parameter.  I was hoping to avoid this as fpcup takes a while to run (around 5 to 10 minutes), and didn't want to have to do incrememtal development (it's how I work) with a long build process in the middle each time.   Once fpcup has finished it's current run I'll give make clean all install a go :-)
Lazarus Trunk/FPC Trunk on Windows [7, 10]
  Have you tried searching this forum or the wiki?:   http://wiki.lazarus.freepascal.org/Alternative_Main_Page
  BOOKS! (Free and otherwise): http://wiki.lazarus.freepascal.org/Pascal_and_Lazarus_Books_and_Magazines

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: Problem extending FPC
« Reply #6 on: June 28, 2014, 12:12:05 pm »
I also thought fpcup, and am currently in the middle of running this with the -keeplocalchanges parameter.  I was hoping to avoid this as fpcup takes a while to run (around 5 to 10 minutes)
Sure, that's why I have that buildonly ini section myself: by specifying those only= and skip= lines, you skip the svn update, make clean (ok, that's a bit naughty but speeds things up), just does the build and done.
It basically does what you're doing by hand but I'm so lazy/careless, I can't be bothered to type that all the time when developing fpc stuff myself ;)
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

Mike.Cornflake

  • Hero Member
  • *****
  • Posts: 1248
Re: Problem extending FPC
« Reply #7 on: June 28, 2014, 12:19:25 pm »
I missed the existence of -buildonly, many thanks for pointing it out.

The full run of fpcup indeed solved my problem.    Now to experiment with make clean all install (just so I understand what's going on), and then I'll make a new shortcut for fpcup for -buildonly :-)

Many thanks again

[UPDATE]  Just re-read your post.   I'll add the [buildonly] section to my inifile and create a new shortcut that calls fpcup with the --inisection...   :-)
« Last Edit: June 28, 2014, 12:23:02 pm by Mike.Cornflake »
Lazarus Trunk/FPC Trunk on Windows [7, 10]
  Have you tried searching this forum or the wiki?:   http://wiki.lazarus.freepascal.org/Alternative_Main_Page
  BOOKS! (Free and otherwise): http://wiki.lazarus.freepascal.org/Pascal_and_Lazarus_Books_and_Magazines

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: Problem extending FPC
« Reply #8 on: June 28, 2014, 12:54:09 pm »
[UPDATE]  Just re-read your post.   I'll add the [buildonly] section to my inifile and create a new shortcut that calls fpcup with the --inisection...   :-)
Just for clarity to others who might be going through this thread - these are the relevant lines:
Code: [Select]
only=FPCBuildOnly,LazarusBuildOnly,useride
skip=FPCCleanOnly,FPCGetOnly,LazarusCleanOnly,LazarusGetOnly,crosswin32-64
Thanks
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified