Recent

Author Topic: Cannot clean and Build - errors  (Read 1572 times)

QEnnay

  • Full Member
  • ***
  • Posts: 115
Cannot clean and Build - errors
« on: July 02, 2022, 05:57:43 pm »
Mint-MATE 20.3, Laz 2.2.2

Recently updated to 2.2.2 and getting some weird stuff (kept rolling back to previous code) when compiling so tried "Clean and build."

I am getting the following error and whole list of files that need deleted with "sudo" access.

Quote
Unable to delete file "/usr/share/lazarus/2.2.2/components/buildintf/units/x86_64-linux/BuildIntf.compiled".

How do I fix this?

Do I need to manually do it?

Thanks
Linux-Mint 20.1 x64 + Cinnamon; Lenovo Flex 5 Ryzen 5 4500, 16GB memory
FPC: 3.2.0-1, Lazarus 2.0.12-0, all 64bit

MarkMLl

  • Hero Member
  • *****
  • Posts: 6646
Re: Cannot clean and Build - errors
« Reply #1 on: July 02, 2022, 06:00:52 pm »
Just to get the ball rolling (a) where or how did you get that Lazarus and (b) what does an ls -l show you on that file?

Are you actually trying to build a project of your own or rebuild the IDE?

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9754
  • Debugger - SynEdit - and more
    • wiki
Re: Cannot clean and Build - errors
« Reply #2 on: July 02, 2022, 07:22:07 pm »
Well, who owns the  file, what are the access rights?

If that is the only issue, and if there is no hidden other issue => just delete the entire folder
Code: Bash  [Select][+][-]
  1. rm -rf /usr/share/lazarus/2.2.2/components/buildintf/units

QEnnay

  • Full Member
  • ***
  • Posts: 115
Re: Cannot clean and Build - errors
« Reply #3 on: July 02, 2022, 07:59:08 pm »
Thanks to both of you for the quick replies. This was all working just fine with 2.0.12 with a project developed over the past year. No Permissions have been changed and only a single User (non-admin) in Mint-MATE.

This morning, without even trying yesterday's code, I decided to reinstate the entire project Folder from Thursday's backup. When I compiled and ran, it presented a login option that I had added yesterday. It should not even have know about that.

I then tried a Build of project (using Thursday's backup code) but it still drew on yesterday's code. That's why I tried the Clean and Build option, crashed, then came here with the error.

I had looked in the /usr/ ... folder but unsure just how deep to go before deleting but will bite the bullet and delete that /usr/.../units folder as suggested.

back soon. :)
Linux-Mint 20.1 x64 + Cinnamon; Lenovo Flex 5 Ryzen 5 4500, 16GB memory
FPC: 3.2.0-1, Lazarus 2.0.12-0, all 64bit

QEnnay

  • Full Member
  • ***
  • Posts: 115
Re: Cannot clean and Build - errors
« Reply #4 on: July 02, 2022, 08:43:16 pm »
I give up. That would not compile anything after deleting that /usr/ ...2.2.2 ... /units folder.

I have rolled back to 2.0.12 before I installed 2.2.2 few days back.

The 2.2.2 looks like it needs some more work for Linux.
Linux-Mint 20.1 x64 + Cinnamon; Lenovo Flex 5 Ryzen 5 4500, 16GB memory
FPC: 3.2.0-1, Lazarus 2.0.12-0, all 64bit

dbannon

  • Hero Member
  • *****
  • Posts: 2778
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Cannot clean and Build - errors
« Reply #5 on: July 03, 2022, 01:42:34 am »
You clearly have a working FPC, just build your Lazarus from source. That way, all of lazarus is in user space and Lazarus does not have to do the things it does to of rebuilding itself in your config dir.

https://wiki.freepascal.org/Installing_Lazarus_on_Linux#Build_Lazarus_from_Source

Its interesting that you are the second recent Mint user to have a problem (vaguely) like this. While it needs to be solved, the Lazarus Developers cannot test on every Linux distribution, whats going on, I cannot tell but building from source, and having all the code and units in user space will almost certainly fix things. Its easy and very flexible.

Davo
Lazarus 2, Linux (and reluctantly Win10, OSX)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

MarkMLl

  • Hero Member
  • *****
  • Posts: 6646
Re: Cannot clean and Build - errors
« Reply #6 on: July 03, 2022, 09:37:43 am »
I give up. That would not compile anything after deleting that /usr/ ...2.2.2 ... /units folder.

So do I, because you didn't look at the ownership of the .compiled file that was causing the problem despite both Martin and myself suggesting that you needed to.

The most likely cause is that you'd got at least some of the Lazarus files owned as root, or that the directory structure had been created as root-owned. But now neither you nor people better placed to fix the underlying problem will ever know.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9754
  • Debugger - SynEdit - and more
    • wiki
Re: Cannot clean and Build - errors
« Reply #7 on: July 03, 2022, 11:50:26 am »
Quote
/usr/share/lazarus

I did also ask about the access rights.
Files in that location usually are owned by root.

So, if I take a wild guess and assume that to be the case, then you need to build them as root.


wp

  • Hero Member
  • *****
  • Posts: 11830
Re: Cannot clean and Build - errors
« Reply #8 on: July 03, 2022, 12:16:12 pm »
AFAIK, in Linux, you should start Lazarus with the "startlazarus" application rather than with the "lazarus" binary directly. This way the compiled files are written to your user space, and later you can select whether you want to use the originally installed version or the recompiled version.

MarkMLl

  • Hero Member
  • *****
  • Posts: 6646
Re: Cannot clean and Build - errors
« Reply #9 on: July 03, 2022, 12:26:52 pm »
AFAIK, in Linux, you should start Lazarus with the "startlazarus" application rather than with the "lazarus" binary directly. This way the compiled files are written to your user space, and later you can select whether you want to use the originally installed version or the recompiled version.

Would that really make a difference? I thought startlazarus was there as a restart shim if the IDE etc. was rebuilt.

In my case I put local builds of the IDE into /usr/local/share and make them staff-writable. I've also got startup scripts which handle --pcp automatically to prevent grossly-different versions confusing each other.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9754
  • Debugger - SynEdit - and more
    • wiki
Re: Cannot clean and Build - errors
« Reply #10 on: July 03, 2022, 02:52:58 pm »
AFAIK, in Linux, you should start Lazarus with the "startlazarus" application rather than with the "lazarus" binary directly. This way the compiled files are written to your user space, and later you can select whether you want to use the originally installed version or the recompiled version.

For compiling the sources "startlazarus" makes no difference.

If anything then "lazbuild" will make the diff.
Afaik, "make" itself will work in the directory it was invoked. Afaik, a full build will build lazbuild, and then call lazbuild to build the IDE, which then in turn would take care of writing results to the user's home dir (or wherever the "pcp" /primary-config-path is).



Would that really make a difference? I thought startlazarus was there as a restart shim if the IDE etc. was rebuilt.

In my case I put local builds of the IDE into /usr/local/share and make them staff-writable. I've also got startup scripts which handle --pcp automatically to prevent grossly-different versions confusing each other.

"startlazarus" also checks for a shadow build.

If lazarus is installed in a directory not writeable to the current user, and the current user installs a package (or for other reasons does a rebuild), then the new lazarus executable can not be written in the install dir. So the exe is written in the home directory, under the "pcp".

If you run startlazarus (from the install dir), then it will first check for an updated lazarus in the pcp.

MarkMLl

  • Hero Member
  • *****
  • Posts: 6646
Re: Cannot clean and Build - errors
« Reply #11 on: July 03, 2022, 03:41:09 pm »
Afaik, "make" itself will work in the directory it was invoked. Afaik, a full build will build lazbuild, and then call lazbuild to build the IDE, which then in turn would take care of writing results to the user's home dir (or wherever the "pcp" /primary-config-path is).

So that would presumably include the .compiled file. In my case I can confirm that my locally built versions do have .compiled files in the /usr/local/share tree, but I've very carefully set directories etc. to be accessible before building them as a non-root user.

Is there a possibility that a Mint maintainer has built as root, hence leaving stuff that FPC would like to overwrite but can't?

Quote
"startlazarus" also checks for a shadow build.

If lazarus is installed in a directory not writeable to the current user, and the current user installs a package (or for other reasons does a rebuild), then the new lazarus executable can not be written in the install dir. So the exe is written in the home directory, under the "pcp".

If you run startlazarus (from the install dir), then it will first check for an updated lazarus in the pcp.

Thanks for that.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9754
  • Debugger - SynEdit - and more
    • wiki
Re: Cannot clean and Build - errors
« Reply #12 on: July 03, 2022, 05:25:32 pm »
Afaik, "make" itself will work in the directory it was invoked. Afaik, a full build will build lazbuild, and then call lazbuild to build the IDE, which then in turn would take care of writing results to the user's home dir (or wherever the "pcp" /primary-config-path is).

So that would presumably include the .compiled file. In my case I can confirm that my locally built versions do have .compiled files in the /usr/local/share tree,

You have to be more specific than "/usr/local/share tree".

There is components/buildintf/BuildIntf.compiled and that is part of the install. (or when you "regenerate Makefiles", assuming write permission).

And there is components/buildintf/units/x86_64-linux/BuildIntf.compiled which is generated. It's written when the ppu are created. (It may be done as copy of the first / not sure). And "make clean" would try to remove it, as it removes the ppu.


I have to say, I am not 100% an expert on those Makefiles. IIRC lazbuild is build first. And then the IDE should be build via lazbuild (not sure if the Makefiles actually do anything for the IDE, except calling lazbuild). Because, afaik (but double check to be sure) otherwise the whole compiling into your home dir would not work. => Since there needs to be a whole shadow infrastructure for all the ppu => And since then the ppu in the write protected folder will never be touched. => So even "make clean" needs to somehow honour that. Then again, all that can only happen if at least lazbuild exists (and again/still not sure). So if it doesn't, or if you call make in a way forcing it to rebuild lazbuild => no idea what happens. But it may well be that then you need write access to the install location.
I don't really ever run into this, since all my builds are from source, and all sources are always in my home dir. I don't have an install from the installer (except on my Windows box, for testing newly build installers)


Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9754
  • Debugger - SynEdit - and more
    • wiki
Re: Cannot clean and Build - errors
« Reply #13 on: July 03, 2022, 05:40:01 pm »
And on the original post I did reply with
Well, who owns the  file, what are the access rights?

If that is the only issue, and if there is no hidden other issue => just delete the entire folder
Code: Bash  [Select][+][-]
  1. rm -rf /usr/share/lazarus/2.2.2/components/buildintf/units

So, if of course he tries to compile as non-root, while the files belong to root => then that is another issue, and it wont help to delete those files.

Still deleting them should not hurt. He will just get another error, until the access right issue is gone.

Either he logs in as root, and compiles in place.
Or he has a setup, where he compiles into the shadow folders in his home dir, and if he does, the deleted files should be created there.


If you rebuild from the IDE (and the existing installation has a copy of lazbuild as it should) then the IDE will take care.

If you run make yourself, I don't know how to tell it to use the shadow folders.

But to conclude this:

   @QEnnay:
if this is a new build from scratch, and you somehow installed the sources only => build it as root.
Code: Bash  [Select][+][-]
  1. su -
And then once you have a working copy, rebuild from the IDE.

Besides that, I recommend: If you build from sources, download the sources (as zip or tar.gz, or with git clone) and save the sources in your home folder. Then build there.

If you didn't  download source only, then I don't know why you call make yourself (or did I misunderstand that?).
Anyway, maybe the issue is in the shadow files in your home.
It be highly unusual... Normally the IDE is really good at maintaining those.
Check under
Code: Bash  [Select][+][-]
  1. ls -la ~/.lazarus/
There is one folder that has lots of ppu / I am not sure of the name (I don't have it, due to reasons above) => move it out of the way, and retry.



dbannon

  • Hero Member
  • *****
  • Posts: 2778
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Cannot clean and Build - errors
« Reply #14 on: July 04, 2022, 02:06:56 am »
Lets be clear here. The startlazarus is an incredibly clever way of building and using a local version of lazarus while the user sits there thinking they are using a /usr install. You cannot help but be impressed by what it does but there is always some chance it will not work on any one system. Distro designers and users them selves can very easily create problems because startlazarus has to make a whole lot of assumptions.

So, if you use it, you have to accept it might not work and be prepared to abandon the idea. Fiddling, altering permissions under /usr, manually removing files, building as root, all compound the problem, make a complicated system even more complicated, more fragile and will almost always lead to trouble eventually.

If you rely on startlazarus, you MUST always start with startlazarus.

If startlazarus does not work, build from source !  (or, expert mode,  fix the underlying problem startlazarus encountered). Don't hack the OS.

Davo
Lazarus 2, Linux (and reluctantly Win10, OSX)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

 

TinyPortal © 2005-2018