Recent

Author Topic: making 2.7 compiler with 2.6.4 release  (Read 8623 times)

pm

  • Newbie
  • Posts: 5
making 2.7 compiler with 2.6.4 release
« on: March 27, 2014, 04:59:05 pm »
Hi, I am very interested in testing non-gui Free Pascal with UTF16 UnicodeStrings.  I think I need to use the v2.7 svn branch of the compiler -- which is okay -- but I am struck finding current instructions for making it.

I have 2.6.4 release installed. 
I have the 2.7 svn files.

I have lots of experience with Delphi 1.0 through XE5 and none with the 'make' process used by FPC.

I read about a flag that could be used to toggle the definition of 'string' between Ansi and Unicode. Is that already obsolete in 2.6.4?  I saw compiler messages about it being depecated or ignored or something like that.

Some guidance would be very much appreciated.

-Ann

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11639
  • FPC developer.
Re: making 2.7 compiler with 2.6.4 release
« Reply #1 on: March 27, 2014, 06:07:55 pm »
Have a look at  http://www.stack.nl/~marcov/buildfaq.pdf.

But more importantly, will 2.7.x deliver what you expect? Since it is not copy and paste and recompile D2009, just the early beginnings.

Currently trunk (2.7.x) adds to 2.6.x:

  • the ansistring type now also supports multiple encodings like D2009+
  • The support for unicodestring is slightly more evolved.
  • Most routines in system and sysutils that deal with files and directories now accept unicodestring (and on Windows call the "-W" calls).
  • a mode delphunicode exists where string=unicodestring
  • unit Windows now has the -W variants default

Most notably NOT done:

  • rework classes unit (and everything that depends on it, which is nearly everything that uses classes in general) to work with unicodestring default

kapibara

  • Hero Member
  • *****
  • Posts: 610
Re: making 2.7 compiler with 2.6.4 release
« Reply #2 on: March 27, 2014, 09:11:48 pm »
I produced this a while ago. Its laz/fpc installation in general.
If you can follow, then after that probably anything goes.
No one has proof read it yet though, but that might happen now.  ;)

We will recompile Lazarus sources with FPC 2.7.1 and also
use FPC 2.7.1 to build all applications that Lazarus produces.

To smoothly get updated versions of Lazarus and FPC you should
have a SVN client installed. I use Tortoise.

[1] Get Tortoise: http://tortoisesvn.net/downloads.html
     Install with COMMANDLINE TOOLS option checked so
     Lazarus AboutBox will show the correct SVN number.

[2] You need the release version of fpc to build the development
    versions of fpc. For 64 bit versions of fpc, the is no official
    release. But Lazarus 64bit provides such a 64 bit fpc version.

    Install latest official Lazarus version to c:\lazarus\release
    http://www.lazarus.freepascal.org/index.php?page=downloads
    Before you start Lazarus, edit the shortcut:
    c:\lazarus\release\startlazarus.exe --pcp=c:\lazarus\release\configdir
    That means the settings will be isolated from other Lazarus installations.

[3] Install the source for FPC 2.71 by doing a Tortoise SVN Checkout:
    http://svn.freepascal.org/svn/fpc/trunk
    I suggest 'c:\fpc\trunk' as source directory. Rightclick it in the
    explorer and do Checkout with Tortoise. Choose the head version.
    All FPC sources will be downloaded to this directory.

[4] Now build fpc 2.7.1 using the fpc 2.6.2 binaries from Lazarus.
    Start a commandprompt at c:\fpc\trunk and issue these commands:

    PATH=c:\lazarus\release\fpc\2.6.2\bin\x86_64-win64\
    SET FPC=c:\lazarus\release\fpc\2.6.2\bin\x86_64-win64\fpc.exe
    make all
    make install INSTALL_PREFIX=C:\fpc\2.7.1

    (INSTALL_PREFIX represents the TARGET path for the
     newly compiled version)

    Whatever you have in your system path doesnt matter since you
    set your own temporary path from the prompt. Later we'll change
    the system path permanently.

    Exit/Close this commandprompt after make has finished!
    Dont reuse it because the path will point to wrong fpc version.

    When MAKE finishes you will have a new directory: C:\fpc\2.7.1
    with the fpc 2.7.1 binaries in it. Because Lazarus uses the
    source files from fpc, you need to put a copy of \packages and
    \rtl directories and their content in the c:\fpc\2.7.1 directory.

    (If you dont do that you cant update the trunk version without
    affecting the current 2.7.1 fpc installation. Because when you
    update the trunk you will get some new sourcefiles and they will of
    course not match the binaries of your old installation without
    a recompile. So just copy packages and rtl. This way you can update
    the trunk fpc and install other versions of fpc in new dirs following
    the steps above).

    Since this is a fresh install of fpc, you have no fpc.cfg.
    Copy c:\lazarus\release\fpc\2.6.2\bin\x86_64-win64\fpc.cfg to
    c:\fpc\2.7.1\bin\x86_64-win64 and edit the paths. Lines starting
    with # means they are commented out. Just leave such lines as they
    are.

    If a line looks like this:
    -Fuc:\lazarus\release\fpc\$FPCVERSION/units/$fpctarget

    You should change it to:
    -Fuc:\fpc\2.7.1\$FPCVERSION/units/$fpctarget

    Or use fpcmkcfg to create fpc.cfg:
    fpcmkcfg -d basepath=c:\fpc\2.7.1 -o c:\fpc\2.7.1\bin\x86_64-win64\fpc.cfg

    (The first dir is the path that will be used for the content of the config file, the second
      dir is what directory to put the resulting fpc.cfg in)

    We are actually done with fpc 2.6.2 for now!
    But dont delete the release version of Lazarus or the
    2.6.2 fpc that comes with it because you always need it
    to recompile new fpc versions with it. New SVN versions
    must always be compiled with the release version of fpc.
    Plus Lazarus release can use it.

    Now Add c:\fpc\2.7.1\bin\x86_64-win64 to your system PATH:
    * In Explorer, Rightclick Computer: choose Properties.
    * Choose Advanced system settings
    * Click the Environment Variables button
    * In System Variables Listbox, scroll down to the Path variable
    and doubleclick it. Add c:\fpc\2.7.1\bin\x86_64-win64; at the
    BEGINNING of the line, before everything else and dont forget the
    semicolon.

    Now REBOOT! Yes. Otherwise there can be a mismatch between release version
    of fpc and the freshly compiled fpc.

[5] Install the source for the Lazarus development version by doing a
    Tortoise SVN Checkout: http://svn.freepascal.org/svn/lazarus/trunk

[6] Build Lazarus. From a NEW commandprompt, go to c:\lazarus\LazSVN and run:
    make clean bigide

[7] Go to the desktop and make yourself a shortcut to start Lazarus from.
    Choose startlazarus.exe as programfile:
    c:\lazarus\lazSVN startlazarus.exe --pcp=c:\lazarus\lazSVN\configdir

    Configdir is automatically created when you start Lazarus.
    If you dont supply a -pcp (primary config path) Lazarus will create
    a directory under C:\Users\Elvis\AppData\Local\lazarus

    When you start Lazarus for the first time you must fill in file locations
    for fpc.exe, fpc sources, make.exe and gdb.exe so Lazarus knows what
    compiler etc to use.

[8] Optional: Install latest binw64 binaries to c:\fpc\binw64 by doing a
    Tortoise SVN Checkout:
    http://svn.freepascal.org/svn/fpcbuild/trunk/install/binw64/


To summarize this. You now have a fpc trunk directory
with the development sources. With Tortoise you can update
fpc as often as you like. When you do that you must
follow the steps under [4], except for the fpc.cfg.

Also Lazarus can be independently update with Tortoise, just get
new sources and go to Tools -> Build Lazarus. If you instead do
a 'make clean bigide' you will have to reinstall 3rd party components
that you have added to the component palette.

« Last Edit: January 14, 2017, 11:52:11 pm by kapibara »
Lazarus trunk / fpc 3.2.2 / Kubuntu 22.04 - 64 bit

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: making 2.7 compiler with 2.6.4 release
« Reply #3 on: March 28, 2014, 11:09:47 am »
Either that or use fpcup, setting the fpcurl to
Code: [Select]
--fpcurl=http://svn.freepascal.org/svn/fpc/trunk

:)

(Although manually building with svn is the supported way, fpcup automates this process)
http://wiki.lazarus.freepascal.org/fpcup

Disclaimer: I'm one of the fpcup authors...
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

pm

  • Newbie
  • Posts: 5
Re: making 2.7 compiler with 2.6.4 release
« Reply #4 on: March 29, 2014, 03:19:48 pm »
THANK YOU.  Those are huge steps forward, and, I appreciate your clarity on what is not ready yet.  I do use Classes (TComponent) extensively.  Nonetheless, I will practice building v2.7 and see what I can see. 

Ann

pm

  • Newbie
  • Posts: 5
Re: making 2.7 compiler with 2.6.4 release
« Reply #5 on: May 20, 2014, 09:53:59 pm »
Long delay yet ... some feedback...

Those steps were extremely helpful as far as building FPC v2.7.1 including fpc.exe.  I did not need to build Lazarus itself yet.

In terms of proofreading the steps:

a) I didn't have a release path for Lazarus when I installed.  Just "{path}\Lazarus\startlazarus.exe" 

b) My only choice of bin folder was bin\i386-win32 instead of bin\x86_64-win64 even though I am using Windows 7 64-bit.

c) I would add one comment about the BAT in step [4] which is that the INSTALL_PREFIX represents the TARGET path for the newly compiled version. 

Note: when first trying this, I got errors at the end of the make process.  Error snippet follows ( yes, my svn trunk is in D:/Apps/FreePascal/2.7.0/fpc ) :

D:/Apps/FreePascal/2.7.0/fpc/utils/fpcm/bin/i386-win32/fpcmake.exe -p -Ti386-win
32 Makefile.fpc
process_begin: CreateProcess(NULL, D:/Apps/FreePascal/2.7.0/fpc/utils/fpcm/bin/i
386-win32/fpcmake.exe -p -Ti386-win32 Makefile.fpc, ...) failed.
make (e=2): The system cannot find the file specified.
make[3]: *** [fpc_install] Error 2

It was true that this file did not exist
D:/Apps/FreePascal/2.7.0/fpc/utils/fpcm/bin/i386-win32/fpcmake.exe
so I copied in the binary from {path}Lazarus\fpc\2.6.4\bin\i386-win32\fpcmake.exe and then the make process ended with success messages.

Thank you kindly for the steps and explanations.

Ann

kapibara

  • Hero Member
  • *****
  • Posts: 610
Re: making 2.7 compiler with 2.6.4 release
« Reply #6 on: May 23, 2014, 06:47:38 am »
Thanks for the feedback.

Quote
b) My only choice of bin folder was bin\i386-win32 instead of bin\x86_64-win64 even though I am using Windows 7 64-bit.

I guess it doesn't matter if you have 64bit windows. If you install 32bit FPC/Lazarus then you probably get bin\i386-win32 instead of bin\x86_64-win64 anyway. Didnt think of that when I wrote the steps.

Quote
c) I would add one comment about the BAT in step [4] which is that the INSTALL_PREFIX represents the TARGET path for the newly compiled version. 

Updated the "steps" with your INSTALL_PREFIX comment.

Will keep an eye out for what happens with fpcmake.exe here when I install/compile FPC next time.

« Last Edit: May 23, 2014, 06:55:18 am by kapibara »
Lazarus trunk / fpc 3.2.2 / Kubuntu 22.04 - 64 bit

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: making 2.7 compiler with 2.6.4 release
« Reply #7 on: August 20, 2014, 08:51:48 am »
    Since this is a fresh install of fpc, you have no fpc.cfg.
    Copy c:\lazarus\release\fpc\2.6.2\bin\x86_64-win64\fpc.cfg to
    c:\fpc\2.7.1\bin\x86_64-win64 and edit the paths.
I'd suggest rather using fpcmkcfg to get a correct fpc.cfg without need to edit paths etc..

    Now Add c:\fpc\2.7.1\bin\x86_64-win64 to your system PATH:
    * In Explorer, Rightclick Computer: choose Properties.
    * Choose Advanced system settings
    * Click the Environment Variables button
    * In System Variables Listbox, scroll down to the Path variable
    and doubleclick it. Add c:\fpc\2.7.1\bin\x86_64-win64; at the
    BEGINNING of the line, before everything else and dont forget the
    semicolon.
Would see this as an optional step. Yes, it's nice to be able to compile on the command line but if you have multiple fpc installs (as I think this guide uses), it can get messy.
Maybe easier to make a .cmd file like
Code: [Select]
@echo off
rem fpc271.cmd
rem FPC compiler, development environment
rem Requires NT style Windows, so no 95,98,ME
rem %* represents all arguments on the command line, so you can pass more than 9
 (%1 %2 %3 etc only go up to 9)
set oldpath=%path%
set path=c:\development\fpctrunk\bin\i386-win32\;%path%
c:\development\fpctrunk\bin\i386-win32\fpc.exe %*
set path=%oldpath%

    Now REBOOT! Yes. Otherwise there can be a mismatch between release version
    of fpc and the freshly compiled fpc.
See previous remark. In addition, if you change the paths in your Lazarus setup, there's no need to reboot as long as you only use Lazarus. That said, I do understand your remark on rebooting as it keeps things clearer with your instructions.

[6] Build Lazarus. From a NEW commandprompt, go to c:\lazarus\LazSVN and run:
    make clean bigide
Would need to be adjusted with FPC=whatever or something if following my suggestion above

    a directory under C:\Users\Elvis\AppData\Local\lazarus
Nice username ;)

Also Lazarus can be independently update with Tortoise, just get
new sources and do a 'make clean bigide'.
Or easier: via the rebuild Lazarus command in the tools menu. Advantage: FPC path is recognized correctly.
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

 

TinyPortal © 2005-2018