#1 2023-05-02 21:25:34

thierrybo
Member
Registered: 2023-04-30
Posts: 11

[Solved]Compiling ex/mvc-blog/MVCServerFirebirdZeos.dpr error on Linux

Hi,

Trying to compile this sample mORMot2-2.0.stable/ex/mvc-blog/MVCServerFirebirdZeos.dpr on Linux, I get this error:

Messages, Warnings: 1
Warning: other unit files search path (aka unit path) of "zcomponent 8.0" contains "/home/thierrybo/Sys/Lazarus.projets/Composants/zeoslib-code-0-r8027-branches-8.0-patches/src/component", which belongs to package "zcomponentdesign"
Compile Project, Mode: Default, CPU: i386, Target: exe/MVCServerFirebirdZeos: Exit code 1, Errors: 3, Hints: 3
Hint: Start of reading config file /home/thierrybo/.local/opt/lazarus_fixes_fpcupdeluxe/fpc/bin/x86_64-linux/fpc.cfg
Hint: End of reading config file /home/thierrybo/.local/opt/lazarus_fixes_fpcupdeluxe/fpc/bin/x86_64-linux/fpc.cfg
Verbose: Free Pascal Compiler version 3.2.3-707-g15194c6ee9 [2023/04/02] for i386
Verbose: Copyright (c) 1993-2021 by Florian Klaempfl and others
Verbose: Target OS: Linux for i386
Verbose: Compiling MVCServerFirebirdZeos.dpr
Verbose: Compiling MVCModel.pas
Verbose: Compiling MVCViewModel.pas
MVCViewModel.pas(286,25) Hint: Converting the operands to "TID" before doing the multiply could prevent overflow errors.
Verbose: Writing Resource String Table file: MVCViewModel.rsj
MVCServerFirebirdZeos.dpr(30,20) Verbose: Unit "zdbc" not used in MVCServerFirebirdZeos
Verbose: Linking /home/thierrybo/Sys/Lazarus.projets/Composants/mORMot2-2.0.stable/ex/mvc-blog/exe/MVCServerFirebirdZeos
Error: /home/thierrybo/.local/opt/lazarus_fixes_fpcupdeluxe/cross/bin/i386-linux/i386-linux-ld: /home/thierrybo/Sys/Lazarus.projets/Composants/mORMot2-2.0.stable/ex/mvc-blog/lib/i386-linux/MVCViewModel.o: in function `.La6':
Error: MVCViewModel.pas:(.debug_info+0x316): undefined reference to `DBG2_$MORMOT.REST.MVC_$$_IMVCAPPLICATION'
MVCServerFirebirdZeos.dpr(94,1) Error: Error while linking
MVCServerFirebirdZeos.dpr(94,1) Verbose: There were 1 errors compiling module, stopping
Verbose: Compilation aborted
Verbose: /home/thierrybo/.local/opt/lazarus_fixes_fpcupdeluxe/fpc/bin/x86_64-linux/ppcross386 returned an error exitcode

This is a cross compile 64->32 but i get the same error in native 64:

Error: /usr/bin/ld : /home/thierrybo/Sys/Lazarus.projets/Tests/Mormot/mormot2/mvc-blog-mysql/lib/x86_64-linux/MVCViewModel.o : dans la fonction « .La6 » :
Error: MVCViewModel.pas:(.debug_info+0x388) : référence indéfinie vers « DBG2_$MORMOT.REST.MVC_$$_IMVCAPPLICATION »

I have no error on Win32/Win64

My Lazarus/fpc are the same version on Windows and Linux, same Mormot2 and Zeos 8

Lazarus 2.2.7 (rev lazarus_2_2_6-1-gada7a90f86) FPC 3.2.3 x86_64-linux-qt5
Lazarus 2.2.7 (rev lazarus_2_2_6-1-gada7a90f86) FPC 3.2.3 i386-win32-win32/win64

Last edited by thierrybo (2023-05-03 14:00:32)

Offline

#2 2023-05-03 06:36:57

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,183
Website

Re: [Solved]Compiling ex/mvc-blog/MVCServerFirebirdZeos.dpr error on Linux

Sounds like a configuration error in your build chain.

Do other projects cross-compilation work?

First try with https://github.com/synopse/mORMot2/commit/0740e4c0

You may:
0) Clean and re-build the project (deleting the .o files).
1) Try with another version of FPC.
2) Rebuild FPC and Lazarus.

Offline

#3 2023-05-03 11:18:49

thierrybo
Member
Registered: 2023-04-30
Posts: 11

Re: [Solved]Compiling ex/mvc-blog/MVCServerFirebirdZeos.dpr error on Linux

Well i'am a bit confused for the moment.

On my current Linux Lazarus/FPC setup, I have the same error for Linux 32/64 with mormot 0740e4c0, even after a clean rebuild of the project and Mormot2.

I have a test virtual Machine on Ubuntu 20.04 LTS with a bare bone default Lazarus/fpc setup (with fpcupdeluxe) with the same version as my local setup. I have the same error for Linux 32/64 with mormot 0740e4c0.

On the virtual machine I added a new fpcupdeluxe setup with the same Lazarus version but with freepascal trunk (Lazarus 2.2.7 (rev lazarus_2_2_6-1-gada7a90f86) FPC 3.3.1 x86_64-linux-gtk2).  With this setup and mormot 0740e4c0, cross compiling to native linux64 worked once, then I cross compiled to linux32 and this gave me the same error "Error: MVCViewModel.pas:(.debug_info+0x33c): undefined reference to `DBG2_$MORMOT.REST.MVC_$$_IMVCAPPLICATION'".

Then every new attempt to build for linux64 native never worked again, even using "Clean up an build with all options checked" (deletes project *. *.ppu, deletes mormot, zeos and FCL .o .*ppu ..).

Offline

#4 2023-05-03 11:43:45

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,183
Website

Re: [Solved]Compiling ex/mvc-blog/MVCServerFirebirdZeos.dpr error on Linux

I am also confused, because I don't have any trouble here on Linux/Debian.
My version is

Free Pascal Compiler version 3.2.3-702-g05480071e2 [2022/12/30] for x86_64

Sounds like a compiler/linker problem, or a configuration problem.
Don't use the trunk but try plain 3.2.0.

Offline

#5 2023-05-03 11:43:56

thierrybo
Member
Registered: 2023-04-30
Posts: 11

Re: [Solved]Compiling ex/mvc-blog/MVCServerFirebirdZeos.dpr error on Linux

AHH, I will kill myself.

In my test virtual machine with FPC from trunk and mormot2 0740e4c0, I just discovered this is the "Default" build option that raise the error.. Changing to Release or Debug works in both native linux64 and linux32 !

Back to my normal setup with Lazarus/FPC stable/fixes and mormot2-stable, and the project compile fine too now for both target CPU ....

Offline

#6 2023-05-03 11:52:43

thierrybo
Member
Registered: 2023-04-30
Posts: 11

Re: [Solved]Compiling ex/mvc-blog/MVCServerFirebirdZeos.dpr error on Linux

Maybe the diff may help

https://i.imgur.com/M1gQiQc.png

Offline

#7 2023-05-03 14:33:33

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,183
Website

Re: [Solved]Compiling ex/mvc-blog/MVCServerFirebirdZeos.dpr error on Linux

My best guess is that mixing DebugInfoType is what made the linking fail.

The very same debug information should be set for both mORMot packages and the project.

Offline

#8 2023-05-03 15:12:12

thierrybo
Member
Registered: 2023-04-30
Posts: 11

Re: [Solved]Compiling ex/mvc-blog/MVCServerFirebirdZeos.dpr error on Linux

Indeed, changing DebugInfoType on the Default profile to

Automatic, Dwarf3, stabs -> OK
Dwarf2, Dwarfs with sets -> NOK

Offline

Board footer

Powered by FluxBB