Raspberry with source directory on a windows share lazarus / 11-Options ---------------------------------------------------------------------- sporex · 2022-05-20 08:27 Pls.help, I have installed Laz v2.0.10 on a RPi with Debian 11 (bullseye) following this tutorial: https://wiki.freepascal.org/Lazarus_on_Raspberry_Pi Now I want to test the installed IDE for this particular setup: The directory for the source files is on a windows share on a different machine and properly mounted with all required access rights. When I open a very simple test.pas file from this source directory and try to compile it, the following will happen: - the IDE reports "BEGIN expected but end of file found" - the test.pas file on the windows share still exists, but the content is deleted (0byte) - the backup, lib, test.lpi, test.lps are created in the shared folder. So it cannot be a problem of access rights When I do the same test with a folder on the local file system, everything works. And btw, I had the same configuration (source on shared directory) with Jessie and an older version of lazarus. I suppose I need to change something in the Tools|Options settings, but what? Thank you for advice and kind regards ---------------------------------------------------------------------- MarkMLl · 2022-05-20 08:45 Use the file ** command to check what the line endings are. ** That's a standard unix command. Whatever the RPi people would like to call it, you're running a remix of the Debian Linux distribution, which roughly speaking is "a unix". MarkMLl ---------------------------------------------------------------------- sporex · 2022-05-20 08:59 This is the result of file ** before attempting to compile:  Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   test0.pas: ASCII text, with CRLF line terminators And this is after attempting to compile: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   backup:  directorylib:       directorytest0.lpi: XML 1.0 document, ASCII texttest0.lps: XML 1.0 document, ASCII texttest0.pas: empty ---------------------------------------------------------------------- sporex · 2022-05-20 09:05 And this is what I get for the executable when I successfully compile on the local file system: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i  test0:   ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), statically linked, with debug_info, not stripped ---------------------------------------------------------------------- MarkMLl · 2022-05-20 09:08 You might need to find a text editor that saves files with unix-style line endings. I /thought/ that the compiler was tolerant of variations there. MarkMLl ---------------------------------------------------------------------- sporex · 2022-05-20 10:13 Quote from: MarkMLl on May 20, 2022, 11:08:25 amYou might need to find a text editor that saves files with unix-style line endings. I /thought/ that the compiler was tolerant of variations there. MarkMLl But this cannot be the reason for the problem because the source file on the local file system has the same format: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i  test0.pas: ASCII text, with CRLF line terminators this test0.pas was written with the source editor on the windows LAZ, stored to /NAS and then transferred to the local file system of the RPi, and it compiles. ---------------------------------------------------------------------- MarkMLl · 2022-05-20 10:32 Hmm. Going back through the thread: I used ** to indicate a footnote and assumed you would understand that you had to enter something like Code: [Select]file test.pas Is it /really/ showing test.pas empty after compilation? MarkMLl ---------------------------------------------------------------------- sporex · 2022-05-20 10:54 Really, really. This is before compilation: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i pi@DEB11IDE:/NAS/TEST $ file ./test0.pas./test0.pas: ASCII text, with CRLF line terminators And this is afterwards: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i pi@DEB11IDE:/NAS/TEST $ file ./test0.pas./test0.pas: empty And this is the source on the local file system that compiles: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i  pi@DEB11IDE:~/fpcsrc/TEST $ file ./test0.pas./test0.pas: ASCII text, with CRLF line terminators ---------------------------------------------------------------------- MarkMLl · 2022-05-20 11:11 Really, really odd :-| Presumably you're building using the full IDE... what happens if instead you apply lazbuild to the .lpi (Lazarus project information) file? I must say that mapping stuff like that wouldn't be my first choice: I usually use Subversion as the common point. Any idea what protocol is being used (check mount command output)? Edited: incorrectly referred to .lpr file. MarkMLl ---------------------------------------------------------------------- sporex · 2022-05-20 12:02 Quote from: MarkMLl on May 20, 2022, 01:11:18 pmReally, really odd :-| Presumably you're building using the full IDE... what happens if instead you apply lazbuild to the lpr (Lazarus project) file? I must say that mapping stuff like that wouldn't be my first choice: I usually use Subversion as the common point. Any idea what protocol is being used (check mount command output)? MarkMLl The mount result gives me this (for the share): Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i  //192.168.2.126/PINAS/RASPI on /NAS type cifs (rw,relatime,vers=2.1,c ache=strict,username=pi,uid=1000,noforceuid,gid=1000,noforcegid,addr=1 92.168.2.126,file_mode=0777,dir_mode=0777,soft,nounix,serverino,mappos ix,rsize=1048576,wsize=1048576,bsize=1048576,echo_interval=60,actimeo= 1) And this is what I get for the Jessie IDE (where all is ok) Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i  //192.168.2.126/PINAS/RASPI on /NAS type cifs (rw,relatime,vers=2.1,s ec=ntlmssp,cache=strict,username=pi,domain=P1W764,uid=1000,forceuid,gi d=1000,forcegid,addr=192.168.2.126,file_mode=0755,dir_mode=0755,nounix ,serverino,mapposix,rsize=1048576,wsize=1048576,echo_interval=60,actim eo=1) You know that I am not so deeply involved in the internals of Lazarus stuff but what I did so far was: - create /NAS/TEST/test_abc on the LAZ_WIN IDE - trying to conpile (Ctrl-F9) --> failed - trying to Build (Shift-F9) --> failed So I am loosing hope. I can only confirm that I have a SD card image with Debian 8 (Jessie) and LAZ 1.2.4.dfsg2-1 where all this has worked perfectly for years now. To compile to/from the win share is very convenient because I can edit under LAZ-WIN and compile/debug under LINUX arm and get the executable right back to the archive from where I can redistribute it to many other RPi units in the field. Unfortunately I am forced to upgrade all RPi units now to Debian 11 (Jessie is end of life) and it seems that some of the executables that I create with the Jessie IDE do not run on the upgraded Bullseye units. The majority of my applications are "SimpleProgram" without GUI. Only one uses GUI I have to say that I am not interested to always have the most recent release of LAZ and that "compiling the IDE" "cross compiling" and such stuff is beyond my knowledge. So my first choice would be to have a simple way to install version 1.2.4.dfsg2-1 (apt-get install ...) on the Bullseye image, provided that it creates executables that are running. ---------------------------------------------------------------------- MarkMLl · 2022-05-20 12:10 Quote from: sporex on May 20, 2022, 02:02:01 pm- trying to Build (Shift-F9) --> failed ... Unfortunately I am forced to upgrade all RPi units now to Debian 11 (Jessie is end of life) and it seems that some of the executables that I create with the Jessie IDE do not run on the upgraded Bullseye units. ... So my first choice would be to have a simple way to install version 1.2.4.dfsg2-1 (apt-get install ...) on the Bullseye image, provided that it creates executables that are running. a) What happens if you use Lazbuild? b) It would be worth raising failing apps as a separate thread. c) Look back through the forum for discussion on installing Lazarus on an RPi. I for one normally build from source, but I believe that the consensus is that using the distro-provided apt is the least-good way because of the delay to getting bugfixes etc. into it. MarkMLl ---------------------------------------------------------------------- sporex · 2022-05-20 12:26 Quote from: MarkMLl on May 20, 2022, 02:10:15 pmQuote from: sporex on May 20, 2022, 02:02:01 pm- trying to Build (Shift-F9) --> failed ... Unfortunately I am forced to upgrade all RPi units now to Debian 11 (Jessie is end of life) and it seems that some of the executables that I create with the Jessie IDE do not run on the upgraded Bullseye units. a) What happens if you use Lazbuild? b) It would be worth raising failing apps as a separate thread. c) Look back through the forum for discussion on installing Lazarus on an RPi. I for one normally build from source, but I believe that the consensus is that using the distro-provided apt is the least-good way because of the delay to getting bugfixes etc. into it. MarkMLl First of all, I appreciate your help. Concerning a) : do you mean I should use Tools|Build Lazarus with Profile Normal IDE ? Concerning b) : do you mean that apps compiled on Jessie and 1.2.4 dfsg2-1 should normally work with Bullseye? Concerning c) : I will keep on the struggle with this Thanks a lot ---------------------------------------------------------------------- MarkMLl · 2022-05-20 13:50 a) You have a program called lazbuild. Use it. b) Generally speaking, yes. Otherwise it's of general interest to know what's going on. c) Well done. MarkMLl ---------------------------------------------------------------------- PascalDragon · 2022-05-20 13:58 Quote from: sporex on May 20, 2022, 02:26:31 pmConcerning a) : do you mean I should use Tools|Build Lazarus with Profile Normal IDE ? No, MarkMLI means the lazbuild utility provided with Lazarus which allows to build a Lazarus project from the command line. But lets get simpler, just to check whether compilation by itself works: create a new unit on your share with a simple program (just something that does a Writeln('Hello World')) and compile that manually using fpc theprogram.pas. Does this work correctly? What was the output of FPC if it didn't? ---------------------------------------------------------------------- MarkMLl · 2022-05-20 16:16 Without wanting to sound condescending but to make things absolutely clear: lazbuild" and "fpc" are programs that you will need to invoke in a shell session. You should be able to either cut-and-paste or redirect the output so that you can relay it to us. Please do not oblige me to refer to that as a terminal emulator, command prompt or anything similar: there are depths to which I am reluctant to stoop :-) MarkMLl ---------------------------------------------------------------------- sporex · 2022-05-20 19:36 No, MarkMLI means the lazbuild utility provided with Lazarus which allows to build a Lazarus project from the command line. But lets get simpler, just to check whether compilation by itself works: create a new unit on your share with a simple program (just something that does a Writeln('Hello World')) and compile that manually using fpc theprogram.pas. Does this work correctly? What was the output of FPC if it didn't? [/quote] Yes, that one works: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i root@DEB11IDE:/NAS/TEST# fpc ./test0.pasFree Pascal Compiler version 3.2.0+dfsg-12 [2021/01/25] for aarch64Copyright (c) 1993-2020 by Florian Klaempfl and othersTarget OS: Linux for AArch64Compiling ./test0.pastest0.pas(13,6) Warning: Variable "i" does not seem to be initializedAssembling testLinking test017 lines compiled, 1.8 sec1 warning(s) issued ---------------------------------------------------------------------- sporex · 2022-05-20 19:40 And this is the executable: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i  root@DEB11IDE:/NAS/TEST# file ./test0./test0: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), statically linked, stripped ---------------------------------------------------------------------- sporex · 2022-05-20 19:43 And those are the files created in the shared directory: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i  root@DEB11IDE:/NAS/TEST# ls -ltotal 573-rwxrwxrwx 1 pi pi 577296 May 20 20:32 test0-rwxrwxrwx 1 pi pi   4696 May 20 20:32 test0.o-rwxrwxrwx 1 pi pi    151 May 20 09:43 test0.pas ---------------------------------------------------------------------- MarkMLl · 2022-05-20 19:44 I'm uncomfortable to see you running as root. This is not the recommended way of working, it can mess up GUI-oriented software (including introducing security vulnerabilities) and also have an impact on remote file mounts. (And please fix your broken formatting, and you might find the "Modify" button useful when you want to add e.g. a list of files). MarkMLl ---------------------------------------------------------------------- PascalDragon · 2022-05-21 14:59 Quote from: sporex on May 20, 2022, 09:36:26 pmYes, that one works: Okay, great. Next step: would you please share the command line that Lazarus generates for your project, maybe that will give a hint what goes wrong? You can get that in the project's settings using the button “Show settings” (or similar, I'm using the German version) and then the content of the tab “Command line arguments” (or similar). ---------------------------------------------------------------------- sporex · 2022-05-21 17:10 Thank you for beeing available to help. I was running the IDE from a terminal window. Then I have set the project_options|verbosity to "show all" And have copied the terminal output to the file cpl_msg1.txt (this is compiling the source from the share) Next I did the same but compiling the source from the local file system, the output is in cpl_msg2.txt ---------------------------------------------------------------------- sporex · 2022-06-04 09:31 After being discouraged for a while I have resumed trying to compile from the shared folder. What I found out is this: -1) I create the source file test.pas and make a copy test.bak -2) I try to compile test.pas and I am getting "begin expected but end of file found" and test.pas on the share is 0byte -3) Then I copy test.bak > test.pas and try to recompile -4) I get "source file has changed on disk," and I chose "reload checked file from disk" - And now it compiles After step-2) I get the following files in the shared folder /src Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i - /src/backup/test.pas- /src/lib/aarch64-linux/test.compiled- /src/test.lpi- /src/test.lps After step -4) I get additionally: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i - /src/lib/aarch64-linux/test.o and of course the executable /src/test I suppose there must be any setting in the IDE options that must be changed. Only what is it? I made no changes to the default config. ---------------------------------------------------------------------- MarkMLl · 2022-06-04 10:11 So going back through the thread: a) You're using CIFS. b) Are you still running on the client as root? c) Have you tried using Lazbuild yet? MarkMLl ---------------------------------------------------------------------- sporex · 2022-06-04 10:37 Hello Mark thank you for remembering this topic a) yes I am using cifs b) no, this time i ran it as user pi c) Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i lazbuild -B /NAS/TEST/test1.pasError: (lazbuild) don't know how to build: /NAS/TEST/test.pas ---------------------------------------------------------------------- MarkMLl · 2022-06-04 10:43 Lazbuild expects a .lpi ("Lazarus Project Information"). If you were building a simple "Hello, World!" console program which didn't have a .lpi you'd simply use fpc to compile the .pas... I've just done that over a CIFS share from a PC client and am about to try Lazarus. Very slightly later: Definitely no problem using Lazarus 2.2.0 with FPC 3.2.2. Client system running Debian "Stable" (i.e. the OS that yours is derived from) but x86_64 rather than ARM... I'd not expect that to be an issue. Running mount describes the connection as Code: [Select]//192.168.0.72/guest on /home/markMLl/srv/gooey.guest type cifs (rw,nosuid,nodev,relatime,vers=2.0,cache=strict,username=gue st,domain=XXXXXXXX,uid=1000,forceuid,gid=1000,forcegid,addr=192.168.0. 72,file_mode=0755,dir_mode=0755,soft,nounix,mapposix,noperm,rsize=6553 6,wsize=65536,echo_interval=60,actimeo=1,user=markMLl) derived from this in .etc.fstab Code: [Select]//192.168.0.72/guest    /home/markMLl/srv/gooey.guest   cifs    noauto,user,username=guest,guest,workgroup=XXXXXXXX,vers=2.0,noperm   0       0 One thing I'd emphasise is that I accessed the project from a fixed mountpoint off my home directory, rather than via a desktop file manager or something under the "Places" list of a save-as dialogue or similar... the naming there might depend on what widget set's been used to build your IDE. I don't think this is an IDE issue, it's down to either how your OS is setting up mounts, or the configuration and capabilities of your NAS. MarkMLl ---------------------------------------------------------------------- sporex · 2022-06-04 11:22 Alright, then I will have to inquire the mount options. This is mine: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i //192.168.2.126/PINAS/RASPI on /NAS type cifs (rw,relatime,vers=2.1,ca che=strict,username=pi,uid=1000,noforceuid,gid=1000,noforcegid,addr=19 2.168.2.126,file_mode=0777,dir_mode=0777,soft,nounix,serverino,mapposi x,rsize=1048576,wsize=1048576,bsize=1048576,echo_interval=60,actimeo=1 ) And fstab is like that: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i //192.168.2.126/PINAS/RASPI     /NAS    cifs    credentials=/etc/.cred entials,uid=pi,gid=pi,file_mode=0777,dir_mode=0777 I will try to mount the share manually and get back with the result. THX Mark ---------------------------------------------------------------------- MarkMLl · 2022-06-04 11:44 Getting mount options right- particularly for networked shares and most particularly for SMB/CIFS- is arguably more difficult than it needs to be. But the bottom line is that all of the possible options are there for a reason. I speculate that /if/ your NAS were based on "a unix" and /if/ you could get a shell session you'd find (using ls -i) that when Lazarus saved a file it first renamed the original to .bak or similar and then created a new one, and that under certain circumstances the client system is seeing the new one cached before anything has actually been written to it. That rename-create is longstanding unix doctrine with the intention of limiting the extent to which a less-privileged user can overwrite the work of a more-privileged one, and can be contrasted with the Windows convention of doing a copy-overwrite. If that's what's really happening, then it's a NAS (or possibly client library) bug. You /might/ find that telling the IDE to not create a backup (Tools -> Options -> Environment -> Backup) changes that behaviour: arguably, if it's told to create no backup then it should be overwriting the same file in-situ rather than creating a new one. MarkMLl ---------------------------------------------------------------------- sporex · 2022-06-04 21:32 Good evening Mark, I will give up. What I am going to do is: - create a debian11 32 bit images for the units for which I want to roll out the SW - use the debian8 image that I have for the IDE in order to maintain/modify the existing applications that I am distributing to the units - I suppose there will be no hitch (jessie/bullseye) as long as it's 32bit My only concern is that jessie is end-of-life and only compatible with RPi up to Ver.3B (not Ver.3B+) and the hardware will also be phased- out by 2023 as I learn ---------------------------------------------------------------------- MarkMLl · 2022-06-05 07:30 Quote from: sporex on June 04, 2022, 11:32:06 pmGood evening Mark, I will give up. What I am going to do is: - create a debian11 32 bit images for the units for which I want to roll out the SW - use the debian8 image that I have for the IDE in order to maintain/modify the existing applications that I am distributing to the units - I suppose there will be no hitch (jessie/bullseye) as long as it's 32bit My only concern is that jessie is end-of-life and only compatible with RPi up to Ver.3B (not Ver.3B+) and the hardware will also be phased- out by 2023 as I learn In any event, always test thoroughly. There's always a risk of incompatibility at the library level. Otherwise, set up a local Subversion etc. server. I think one's available as a Debian package, but otherwise it's easy enough to build particularly if you stick to the native svn protocol rather than trying to integrate with Apache. Jessie really is getting on a bit by now, and isn't one of those releases for which there were compelling reasons to not upgrade: I'd cite Lenny as being one of those, since some targets were either dropped immediately afterwards, or their quality dropped as people lost interest (SPARC as a particular example). I've had some degree of success with in-situ upgrades, but I usually find redoing from scratch fairly painless since for many years I've been running a script which logs what gets installed manually. See https://github.com/MarkMLl/installed-package-list MarkMLl