Recent

Author Topic: Linker error - symbol not found  (Read 9425 times)

//DG

  • New Member
  • *
  • Posts: 17
Re: Linker error - symbol not found
« Reply #15 on: September 28, 2016, 06:45:10 pm »
Whole FPC, not whole RTL. And then whole lazarus.

Since literally every depends on the RTL.
By that we mean all packages and libraries, but not compiler(FPC)/Lazarus ide itself, right? The only thing I see why it might be needed is because of debugging and source<>binary binding for that. Otherwise I can't see why changing (by extending) low-level obj needs recompile of modules relying on it.
Lets say, we have obj file A, depending on function/symbol abc from obj file B. We rebuild B by adding def, xyz; abc is still on place. obj A would still be linked fine to B, because B.abc is still there.
« Last Edit: September 28, 2016, 06:46:57 pm by //DG »

Leledumbo

  • Hero Member
  • *****
  • Posts: 8747
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Linker error - symbol not found
« Reply #16 on: September 28, 2016, 07:14:33 pm »
Otherwise I can't see why changing (by extending) low-level obj needs recompile of modules relying on it.
Lets say, we have obj file A, depending on function/symbol abc from obj file B. We rebuild B by adding def, xyz; abc is still on place. obj A would still be linked fine to B, because B.abc is still there.
In the C world, yes. In Pascal especially FPC but generally applies to other implementations as well, compilation unit is compiled into interface file (.ppu) and object file (.o). .ppu is the one that the compiler plays with, it has all symbol information in a compilation unit whose consistency is checked by embedded CRC value inside it, calculated from all symbols defined in that compilation unit (therefore, an addition of a new symbol is enough to change this value). When this value changes, there's no safer way but to recompile all depending compilation units to check whether caller-callee relationship is still intact. This will prevent unpredictable runtime behavior: when symbol stays the same but the interface changes, be it the calling convention, number of parameters, parameters type, etc.

//DG

  • New Member
  • *
  • Posts: 17
Re: Linker error - symbol not found
« Reply #17 on: September 28, 2016, 07:38:47 pm »
OK, thanks for explanation.
But still: I have fresh installation of Lazarus, package from official site. I'm fine with recompiling all the modules that rely on windows/system/any other low-level module, but not the fpc itself, because change we're talking here about does not affect compiler of ide in any way.
When I go to
c:\lazarus\fpc\3.0.0\source\rtl, run "make clean", I see it tries to clean wrong paths, for example:
C:/lazarus/fpc/3.0.0/bin/i386-win32/rm.exe -f ../../rtl/units/i386-win32/system.
ppu ../../rtl/units/i386-win32/uuchar.ppu ../../rtl/units/i386-win32/objpas.ppu

while there's no ../../rtl....... it must be ../../units/i386-win32/rtl/<file name>

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11383
  • FPC developer.
Re: Linker error - symbol not found
« Reply #18 on: September 28, 2016, 08:03:57 pm »
If you feel that way, recompile, but don't install the bin/ folder from the temp location, but only the units folder.

So take the bin folder of the release, and the generated units folder which you "make install"ed into a temp dir.


//DG

  • New Member
  • *
  • Posts: 17
Re: Linker error - symbol not found
« Reply #19 on: September 28, 2016, 08:10:46 pm »
If you feel that way, recompile, but don't install the bin/ folder from the temp location, but only the units folder.

So take the bin folder of the release, and the generated units folder which you "make install"ed into a temp dir.

Yes, I'm rebuilding everything in place, using existing bin tools.

Looks like make clean/make all didn't work in a first place, see my note above - it tries to clean wrong folder. It means something is wrong with paths makefile uses.


ok, using make fpc_baseinfo I was able to figure it out. It created output files in source\rtl\units\i386-win32, treating \source\rtl as base dir.
« Last Edit: September 28, 2016, 08:37:32 pm by //DG »

//DG

  • New Member
  • *
  • Posts: 17
Re: Linker error - symbol not found
« Reply #20 on: September 29, 2016, 08:45:52 pm »
Just for note to others who are new to FPC/Lazarus and might get, just like me, confused with used terminology.
I needed to rebuild RTL and various FPC libraries that rely on it. Not the FPC as whole, but its libraries (packages).
Since I had standard Lazarus installation, I didn't have sources for packages, so I went to github mirror and downloaded FPC trunk.

Directory structure on my machine is:
c:\lazarus\fpc\3.0.0\sources\
sources\rtl had rtl sources, but there was no sources for other modules (fcl-base etc), so I copied over rtl\ and packages\ to my source folder from trunk.

Then using "make clean", "make all" and "make install INSTALL_PREFIX=c:\lazarus\fpc\tmp" I was able to rebuild needed modules. First doing it in \sources\rtl folder, then in sources\packages.
After that I needed to copy over c:\lazarus\fpc\tmp\units to my c:\lazarus\fpc\3.0.0\units to finish the process.

Topic can be closed.

Thanks everyone for replies, really enjoying community.

 

TinyPortal © 2005-2018