Recent

Author Topic: [SOLVED] Fpcmake error  (Read 614 times)

TheLastCayen

  • Jr. Member
  • **
  • Posts: 74
[SOLVED] Fpcmake error
« on: March 01, 2020, 11:53:27 pm »
Hi,

I am using
 - Linux Mint Xfce 19.3 64bit
 - Lazarus 2.0.6
 - FPC 3.0.4

 I try to generate a make file for my project. If I understand, lazbuild --create-makefile don't work for a project. Same for the checkbox in project -> project options...->Compler commands->Create Makefile.

But I found the documentation for Fpcmake at this address:
https://wiki.freepascal.org/Fpcmake

Following the documentation I tried:
Code: Bash  [Select][+][-]
  1. export FPCDIR=/usr/lib/fpc
  2. fpcmake -w -Tall
  3.  

This is the output:
Processing makefile.fpc
Error: Unable to open file "makefile.fpc"

How can I use this tool to create a make file for my project?
If I can't use the tool, is there any documentation on how to create a make file that will launch lazbuild or fpc instead of gcc?. I also need to learn how to do make install script.

Thank you

« Last Edit: March 03, 2020, 04:21:28 am by TheLastCayen »

dbannon

  • Hero Member
  • *****
  • Posts: 1073
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Fpcmake error
« Reply #1 on: March 02, 2020, 12:57:41 am »
Hi TheLastCayen, I found the same thing awhile ago. I am struggling to remember now but I think I eventually found that I fpcmake was not really intended to work as we both read the docs.

Have a look at my bash script https://github.com/tomboy-notes/tomboy-ng/blob/master/package/package.bash its quite busy because it builds Windows, and Linux in several different formats. You are interested in only the first function, BuildIt(), it uses lazbuild and reads the Lazarus project file to build each binary based on the Lazarus Project Modes.

You can go one step further and call fpc directly if you like, In the Project Options there is a button across the bottom of window (called, from memory) "show options", its only there in the compiling config sections of project options. It shows you all the options that will, eventually be passed to fpc.

I have a script that does that in https://github.com/tomboy-notes/tomboy-ng/blob/master/tomboy-ng/buildit.bash, bit more complicated in that it assumes you don't have a working Lazarus, first it builds lazbuild and then uses that to build KControls (that my project uses) and then builds the main app with fpc. Its has proven to be a bit maintenance heavy ...

Davo

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

trev

  • Hero Member
  • *****
  • Posts: 738
  • Former Delphi 1-7 and 10.2 User
Re: Fpcmake error
« Reply #2 on: March 02, 2020, 05:35:30 am »
This is the output:
Processing makefile.fpc
Error: Unable to open file "makefile.fpc"

Do you have write permission for the output directory?
o Lazarus v2.1.0 r63272, FPC v3.3.1 r45525, macOS 10.14.6 (with sup update), Xcode 11.3.1
o Lazarus v2.1.0 r61574, FPC v3.3.1 r42318, FreeBSD 12.1 amd64 (Parallels VM)
o FPC 3.0.4, FreeBSD 12-STABLE r361007 amd64
o Lazarus v2.1.0 r61574, FPC v3.0.4, Ubuntu 18.04 (Parallels VM)

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 8491
  • FPC developer.
Re: Fpcmake error
« Reply #3 on: March 02, 2020, 11:10:12 am »
Why do you need a makefile?

TheLastCayen

  • Jr. Member
  • **
  • Posts: 74
Re: Fpcmake error
« Reply #4 on: March 02, 2020, 08:26:52 pm »
Thank you dbannon:) I will take a look at your scripts:)

trev: if the way I am calling the command is the proper way, yup I have full access... now, if Fpcmakei t's trying to write in an obscure place, probably not because I will not try it at root... especially if it's not working at intended...

marcov: because Linux users can be special some time. I already had negative comments for using Lazarus instead of C and GCC... right now I am doing a tar.gz and I need to be able to use make && make install as it's common standard while compiling under Linux.



dbannon

  • Hero Member
  • *****
  • Posts: 1073
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Fpcmake error
« Reply #5 on: March 02, 2020, 11:21:38 pm »
Well, there is no reason why you cannot write a Makefile by hand, it would then call, eg, lazbuild. It would be pretty simple as far as Makefiles go but still probably a bit harder to maintain than a bash script doing the same thing.

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

TheLastCayen

  • Jr. Member
  • **
  • Posts: 74
Re: Fpcmake error
« Reply #6 on: March 03, 2020, 01:18:51 am »
I have a lot to learn from your script dbannon:) was testing in a virtual machine and if lazarus is not launch first, my software refuses to compile:(

I manage to find a few examples online on how to build a makefile. so far this is what I have. I still have so much to learn lol but at least, now I have something I can improve.

Code: GNU make  [Select][+][-]
  1. CC=lazbuild
  2. OBJ = ptinymice.lpi
  3. DATADIR = /usr/share
  4. BINDIR = /usr/bin
  5.  
  6. tinymice: $(OBJ)
  7.         $(CC) $^
  8.         upx --best ./bin/$@
  9.  
  10. .PHONY: clean
  11.  
  12. clean:
  13.         rm -Rf ./lib
  14.         rm -Rf /Cross.Codebot-master/source/lib
  15.         rm -Rf ./libs/mouseandkeyinput/lib
  16.         rm -Rf ./bin
  17.  
  18. .PHONY: install
  19. install:
  20.         mkdir -p $(DATADIR)/tinymice/languages/
  21.         cp ./bin/tinymice $(DATADIR)/tinymice/
  22.         cp ./languages/* $(DATADIR)/tinymice/languages/
  23.         cp ./pictures/tinymice.png $(DATADIR)/icons/hicolor/128x128/apps/tinymice.png
  24.  
  25.         chown -R root:root $(DATADIR)/tinymice
  26.         chmod -R 644 $(DATADIR)/tinymice/languages/*
  27.         chmod 755 $(DATADIR)/tinymice/tinymice
  28.        
  29.         chown root:root $(DATADIR)/icons/hicolor/128x128/apps/tinymice.png
  30.         chmod 644 $(DATADIR)/icons/hicolor/128x128/apps/tinymice.png
  31.  
  32.         ln -s $(DATADIR)/icons/hicolor/128x128/apps/tinymice.png $(DATADIR)/pixmaps/tinymice.png
  33.         ln -s $(DATADIR)/tinymice/tinymice $(BINDIR)/tinymice
  34.         chown root:root $(DATADIR)/pixmaps/tinymice.png
  35.         chown root:root $(BINDIR)/tinymice
  36.  
  37.         echo "[Desktop Entry]" > $(DATADIR)/applications/TinyMouse.desktop
  38.         echo "Name=TinyMice" >> $(DATADIR)/applications/TinyMouse.desktop
  39.         echo "Comment=Auto Clicker" >> $(DATADIR)/applications/TinyMouse.desktop
  40.         echo "Exec=tinymice" >> $(DATADIR)/applications/TinyMouse.desktop
  41.         echo "Icon=tinymice" >> $(DATADIR)/applications/TinyMouse.desktop
  42.         echo "Terminal=false" >> $(DATADIR)/applications/TinyMouse.desktop
  43.         echo "Type=Application" >> $(DATADIR)/applications/TinyMouse.desktop
  44.         echo "Categories=Utility;" >> $(DATADIR)/applications/TinyMouse.desktop
  45.         echo "StartupNotify=true" >> $(DATADIR)/applications/TinyMouse.desktop
  46.         echo "Keywords=Auto;Clicker;AutoClicker;Auto Clicker;Mouse;" >> $(DATADIR)/applications/TinyMouse.desktop
  47.  
  48.         chown root:root $(DATADIR)/applications/TinyMouse.desktop
  49.         chmod 755 $(DATADIR)/applications/TinyMouse.desktop
  50.  
  51.  
  52. .PHONY: uninstall
  53. uninstall:
  54.         rm -f $(DATADIR)/applications/TinyMouse.desktop
  55.         rm -f $(DATADIR)/pixmaps/tinymice.png
  56.         rm -f $(BINDIR)/tinymice
  57.         rm -f $(DATADIR)/icons/hicolor/128x128/apps/tinymice.png
  58.         rm -Rf $(DATADIR)/tinymice
  59.  



« Last Edit: March 03, 2020, 01:21:50 am by TheLastCayen »

Cyrax

  • Hero Member
  • *****
  • Posts: 817
Re: Fpcmake error
« Reply #7 on: March 03, 2020, 03:43:32 am »
...
marcov: because Linux users can be special some time. I already had negative comments for using Lazarus instead of C and GCC... right now I am doing a tar.gz and I need to be able to use make && make install as it's common standard while compiling under Linux.

Just ignore them.

dbannon

  • Hero Member
  • *****
  • Posts: 1073
    • tomboy-ng, a rewrite of the classic Tomboy
Re: [SOLVED] Fpcmake error
« Reply #8 on: March 03, 2020, 07:09:10 am »
@TheLastCayen
Should be no reason to have Lazarus running before using those scripts. That sounds quite strange. In fact, the second one I pointed you to does not even build a full version of Lazarus, it just compiles lazbuild and then uses that to build another package.  In that case, there is no Lazarus IDE available to run !

Anyway, keep at it !  I have to confess that Makefiles are a very arcane science indeed.

@Cyrax
Yeah !   :D

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

 

TinyPortal © 2005-2018