Recent

Author Topic: I need help building Lazarus 1.1 using FPC 2.7.1 on Mac OSX 10.7.4  (Read 9001 times)

CephasAtheos

  • New Member
  • *
  • Posts: 35
I need help building Lazarus 1.1 using FPC 2.7.1 on Mac OSX 10.7.4
« on: September 25, 2012, 09:26:43 am »
(I don't think there are enough version numbers in the title!)

OK, I've been having major stability issues with Lazarus 1.0 and FPC 2.6.0 on my Macbook pro running OSX 10.7.4. These include crashes, debugger timeouts, bad font rendering in the editor, missing GUI elements in various dialogs, dialogs freezing, etc. Extremely unusable. This was all experienced from binary installs.

So someone suggested building FPC and Lazarus from the svn repos, and I've started to do that. However, it seems that I need to somehow reconfigure the make scripts for lazarus to use the new version of fpc instead of the original version, and I've had no success in doing any of that. Unfortunately, while I knew a fair bit about make a couple of decades ago, things have changed, and I can't figure out how to reconfigure the make scripts to do that.

Any suggestions, explanations, or examples, would be most welcome - I've been bashing my head against this wall for over 18 hours, and google is not my friend here anymore!

I've successfully built the fpc compiler and packages, the svn version is 2.7.1 I've tested and confirmed that it's all working (as far as my simple tests go anyway). I found a problem with spaces in the source directory path in the fpc makefile, but I have a workaround now and I'll get onto that after I get this other problem sorted out.

After a LOT (!) of experimentation and grepping and awking, I *think* I need to configure and run lazbuild, but when I do, it seems to come up with perfectly reasonable defaults (i.e. it knows where I'm building from, and the right OS and gui) but I can't see how to tell it to use my fpc compiler instead of the system compiler. So when I run make all, it always runs the old (2.6.0) compiler version, instead of the new version. (I actually tried to do a make install on the new fpc source, but it only copied itself back into my home directory ./bin and ./lib folders... the version in /usr/local/bin is still the old fpc)

If anyone can explain with some simple examples how to configure make so that I can build lazarus with the new version of fpc, I would very much appreciate the assistance. And if I need to provide any further information, I'm more than happy to do so. Just let me know!

Thanks in advance for your help.

Cheers,
Pete
Data isn't information. Information isn't knowledge. Knowledge isn't wisdom.

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 1071
Re: I need help building Lazarus 1.1 using FPC 2.7.1 on Mac OSX 10.7.4
« Reply #1 on: September 25, 2012, 01:37:44 pm »
A good overview of the top level make targets you can use to be build Lazarus can be found in http://www.mail-archive.com/lazarus@lists.lazarus.freepascal.org/msg29927.html (more background information in http://www.mail-archive.com/lazarus@lists.lazarus.freepascal.org/msg29926.html and http://www.mail-archive.com/lazarus@lists.lazarus.freepascal.org/msg29928.html ).

Specifying the compiler binary to use can be done using the FPC=xxx makefile variable. When you do that, you will also have to tell that compiler where it can find its units, which can be done by adding the appropriate -Fuyyy parameters (can contain a wildcard) to the OPT=zzz makefile variable. Since you'll presumably be using FPC 2.7.1 a lot, you can also create a local configuration file so that you don't have to explicitly specify those options all the time.

Concrete example, assuming your FPC 2.7.1 has been installed in $HOME/fpc271
  • build lazarus from withing in the Lazarus directory:
Code: [Select]
make FPC=$HOME/fpc271/lib/fpc/2.7.1/ppc386 OPT="-Fu$HOME/fpc271/lib/fpc/2.7.1/units/i386-darwin/* -Fu$HOME/fpc271/lib/fpc/2.7.1/units/i386-darwin/rtl" clean bigide
  • create a local configuration file so the OPT stuff is no longer required (the FPC=xxx is still required though, since otherwise the default system compiler will still be used): create $HOME/.fpc.cfg with the following contents
Code: [Select]
#ifdef VER2_7
-Fu$HOME/fpc271/lib/fpc/2.7.1/units/i386-darwin/*
-Fu$HOME/fpc271/lib/fpc/2.7.1/units/i386-darwin/rtl
#endif
#include /etc/fpc.cfg
    The reason for explicitly specifying the rtl units directory again at the end is to make sure it overrides any units in other unit directories with the same name (there are a few such cases, which still has to be fixed).


    CephasAtheos

    • New Member
    • *
    • Posts: 35
    Re: I need help building Lazarus 1.1 using FPC 2.7.1 on Mac OSX 10.7.4
    « Reply #2 on: September 25, 2012, 04:02:15 pm »
    Wow. Thank you so much, Jonas, that's exactly the kind of info I was after! Now I know what switches to use with make, and why. Brilliant!

    So, after rebuilding fpc in its own directory under $HOME (I should have done that before!), I tried to build Lazarus with the options you suggested, but I keep getting stuck with the following error about a minute into the build :
    Code: [Select]
    Compiling lazarus.pp
    PPU Loading /Users/Pietje/fpc271/lib/fpc/2.7.1/units/i386-darwin/univint/CarbonEvents.ppu
    PPU Source: CarbonEvents.pas not available
    Recompiling CarbonEvents, checksum changed for Menus
    Fatal: Can't find unit CarbonEvents used by HIShape
    Fatal: Compilation aborted
    make[2]: *** [lazarus] Error 1
    make[1]: *** [bigide] Error 2
    make: *** [idebig] Error 2
    Is there some part of the fpc build I'm not doing correctly? My fpc build command line currently looks like this :
    Code: [Select]
    make clean all install INSTALL_PREFIX=˜/fpc271
    (I'm not sure exactly why, but if I don't do a make install, nothing gets written to disk... I think that just shows my lack of understanding though!)

    I performed a "svn update" for the lazarus source after first seeing this error, in case I'd accidentally changed any of the build files. There were a dozen or so changes from the last checkout, but nothing I'd been looking at.

    Is there anything I can do from this end to help find out why I'm having so much trouble? I'm sure it must be something stupid I'm doing (or failing to do!), after all this all works fine for everyone else.

    Thanks for any more suggestions or comments!
    Data isn't information. Information isn't knowledge. Knowledge isn't wisdom.

    Jonas Maebe

    • Hero Member
    • *****
    • Posts: 1071
    Re: I need help building Lazarus 1.1 using FPC 2.7.1 on Mac OSX 10.7.4
    « Reply #3 on: September 25, 2012, 04:14:10 pm »
    That problem is caused by an unfortunate unit naming conflict between the Mac OS X universal interfaces and Free Vision (a Turbo Vision clone), which both contain a unit called "menus". I'm not sure why this problem gets triggered in your scenario though, while it doesn't with a standard FPC installation.

    The easiest workaround is probably to simply completely delete /Users/Pietje/fpc271/lib/fpc/2.7.1/units/i386-darwin/fv. It's unlikely you'll want to compile any programs that depend on it when you use Lazarus.

    Quote
    (I'm not sure exactly why, but if I don't do a make install, nothing gets written to disk... I think that just shows my lack of understanding though!)
    Everything gets written to disk, but simply not to the installation directory. That part is what "make install" handles. Before doing a "make install", the compiled units are located all over the source tree, in rtl/units/i386-darwin, packages/fcl-base/units/i386-darwin, packages/univint/units/i386-darwin etc.

    You don't have to install everything, if you don't want to. E.g., my .fpc.cfg contains
    Code: [Select]
    #include /etc/fpc.cfg
    #ifdef VER2_7
    -Fu/Users/jonas/fpc/packages/*/units/$fpctarget
    -Fu/Users/jonas/fpc/rtl/units/$fpctarget
    #endif
    I manually copy the compiler/ppc386 to a separate location that's in my path (and rename it to something like ppn271, so it doesn't conflict with the standard ppc386 name of the default system compiler).

    CephasAtheos

    • New Member
    • *
    • Posts: 35
    Re: I need help building Lazarus 1.1 using FPC 2.7.1 on Mac OSX 10.7.4
    « Reply #4 on: September 25, 2012, 11:56:51 pm »
    For this thread, please assume all my responses are prefixed with "Thank you very much, that makes sense, you are a genius", it will save me typing all that and embarrassing you, OK?  :D Oh, and I'm working my way through the Lazarus and FPC wikis as fast as I can... So I'm not just dumping everything here because I'm too lazy to read!

    I can see now where you got that information from the error message, but is that information available anywhere in the fpc site or wiki? That would save you a lot of time and basic troubleshooting, I'm sure. I did a number of searches on the fpc site and in google, and I could find nothing that led to the FV unit (or anything else, for that matter!). Obviously this is a known issue, so if you can point me to somewhere that's documented, I can maybe do some figuring out and see if I can't help to discover why that happened on my installation. At least then you won't be stuck doing basic make/build troubleshooting with me!

    On that point, unfortunately Free Vision is something I *am* interested in using on this system, since I'll be working with a number of text-mode sources I'm porting from my old Delphi 2 and 3 archives, but these aren't critical right now. I can hopefully help out eventually in some way to sort out the namespace clash there, but I need to concentrate on Lazarus right now.

    Having said that, and kind of understanding how you figured THAT problem out, I've immediately hit another, similar, problem, only this time it looks a bit more critical. Here's the logjam :
    Code: [Select]
    PPU Loading /Users/Pietje/Sources/lazarus/lcl/units/i386-darwin/carbon/carbongdiobjects.ppu
    PPU Source: carbongdiobjects.pp not found
    PPU Source: carbondefines.inc not available
    Recompiling CarbonGDIObjects, checksum changed for Controls
    carbongdiobjects.pp(70,12) Fatal: Can't find unit CarbonGDIObjects used by CarbonInt
    Fatal: Compilation aborted
    make[2]: *** [lazarus] Error 1
    make[1]: *** [bigide] Error 2
    make: *** [idebig] Error 2
    So based on the previous problem, I'm looking for multiple sourcefiles called Controls.* in the compiled fpc units directory. Unlike the Menus issue, though, the only place I can find Controls files is in the univint directory, which I assume is not something that can be deleted!

    This is over-simplified on my part, I know. That's where the documentation would be helpful, showing what fpc packages contain what modules and headers and object files and so on, but I'm afraid I can't seem to find anything like that. The best docs are from people chasing down their own problems, but those are few and far between. Anyway, bottom line is I need help to understand where and why this error is being generated...

    As an aside, since the problem I was originally experiencing had to do with carbon controls, I'm wondering if this might be part of the root issue on my machine? It really is a bog-standard Mac running bog-standard Lion 10.7.4, I'm not silly enough to have changed anything in the core system, apart from Apple patches and updates.

    Hmm. I *did* remove (and then subsequently re-install) the preinstalled X11 library suite very early on, since I didn't think anything I would be doing would use it, but I've since found that a whole bunch of applications - generally text editors and so on that I've tried to build - rely on many, many X11 components. But that really is the only core part of the delivered system I've changed. I swear!

    Again, thanks for any pointers or suggestions you can make. And I do apologise for not being smart enough to figure this basic stuff out for myself.
    « Last Edit: September 26, 2012, 12:04:14 am by CephasAtheos »
    Data isn't information. Information isn't knowledge. Knowledge isn't wisdom.

    Jonas Maebe

    • Hero Member
    • *****
    • Posts: 1071
    Re: I need help building Lazarus 1.1 using FPC 2.7.1 on Mac OSX 10.7.4
    « Reply #5 on: September 26, 2012, 11:19:37 am »
    There's also a lazarus unit called "controls". What I don't understand is how you are getting these problems, because I haven't heard of anyone else getting them (nor have I ever experienced them myself). In this case, the problem should never occur because the makefiles all explicitly pass the Lazarus unit directories on the compiler's command line, so they are searched before the FPC unit directories and hence the univint controls unit should never be found.

    Are you perhaps still using your awk'ed versions of the makefiles? Please try again with a clean checkout if you changed anything.

    CephasAtheos

    • New Member
    • *
    • Posts: 35
    Re: I need help building Lazarus 1.1 using FPC 2.7.1 on Mac OSX 10.7.4
    « Reply #6 on: September 26, 2012, 01:48:47 pm »
    Aaaaaahhhh! D'oh... :-[

    I ran svn diff before downloading the sources again, and sure enough, in ./packager/registration/Makefile I had changed the widget type to qt instead of carbon. Sigh. I made the change back, and voilà! I have a working lazarus 1.1 IDE! Kind of... I'd like to know why the qt widget configuration didn't compile, though - it's supposed to be able to, isn't it? (I know it's not the preferred config, but it *should* have worked...) Ah well. It's on my TODO list...

    I'm now building the ide packages, so I'll try a few things out when it finishes.

    Just to be clear, I removed all traces of fpc 2.6.0 and lazarus 1.0 from the system entirely. I then performed a system install of fpc 2.7.1 (i.e. it now lives in /usr/local, not ~/fpc271), which means I can keep using this as the default fpc for the time being, without having to nominate all the paths and so on. (I hope...) So far, that seems to be working as expected.

    I'm now starting to understand how much I have yet to learn! And I have *so many* questions! But I'll be working my way through the docs, then through the wiki, and THEN if I have questions, I'll post them here - after doing a thorough search, of course!

    I can confirm that I have a working IDE, and the problems are all fixed - the fonts change and render correctly now, the dialogs all work, and I can change the text colours just fine.

    I feel like I've done something wonderful, but I know it's all the hard work you guys have put in over the years that made it possible for me to do it. I'm still smiling though.  ;D

    Thanks once again for helping to clear my mind and get one step further (a big step!). Please let me know if there is any point to finding out why the qt configuration broke. Now that I know how to get a clean build of both fpc & lazarus working, I'm more than happy to be a guinea pig if that will help in the future.
    Kind regards,
    Pete
    Data isn't information. Information isn't knowledge. Knowledge isn't wisdom.

    Jonas Maebe

    • Hero Member
    • *****
    • Posts: 1071
    Re: I need help building Lazarus 1.1 using FPC 2.7.1 on Mac OSX 10.7.4
    « Reply #7 on: September 26, 2012, 01:58:04 pm »
    Compiling for Qt should work if you compile everything for Qt using the top level makefile, rather than only a single subdirectory. Add LCL_PLATFORM=qt to your make invocation to do so.

    Quote
    Just to be clear, I removed all traces of fpc 2.6.0 and lazarus 1.0 from the system entirely. I then performed a system install of fpc 2.7.1 (i.e. it now lives in /usr/local, not ~/fpc271), which means I can keep using this as the default fpc for the time being, without having to nominate all the paths and so on. (I hope...) So far, that seems to be working as expected.
    It will break soon enough. Building development versions of FPC is only guaranteed to work when starting with the latest official release (2.6.0 at this time). Starting a build with anything else may work, but is not supported and can break at any time. You should therefore keep the latest official release also installed, and always make sure to use that one when building a new version. Multiple FPC versions can coexist.

     

    TinyPortal © 2005-2018