Recent

Author Topic: [SOLVED]can't link projekt 'cannot find -lkernel32.dll  (Read 10703 times)

hy

  • Full Member
  • ***
  • Posts: 224
[SOLVED]can't link projekt 'cannot find -lkernel32.dll
« on: September 27, 2012, 03:45:09 pm »
I am getting a strange warning:
/usr/bin/ld: warning: /media/.../lib/link.res contains output sections; did you forget -T?

I did specify -T (Target Linux)

Next error:
/usr/bin/ld: cannot find -lkernel32.dll

Which is strange becuase I am creating the binary for linux so what the heck  is lazarus looking for a DLL?

these are my options
Code: [Select]
-MDelphi -Scghi -O1 -Tlinux -Pi386 -g -gl -vewnhi -Fi../ylazlib/fy -Fi../ylazlib/hy -Fi../ylazlib/app -Fi../ylazlib/oy -Filib -Fi../ylazlib/inc -Fi/home/hy/lazarus/components/indy/Lib/Core -Fl/opt/gnome/lib -Fu../ylazlib/fy -Fu../ylazlib/hy -Fu../ylazlib/app -Fu../ylazlib/oy -Fu/home/hy/lazarus/components/indy/Lib/System -Fu/home/hy/lazarus/components/indy/Lib/Protocols -Fu/home/hy/lazarus/components/indy/Lib/Core -Fu/home/hy/lazarus/lcl/units/i386-linux/gtk2 -Fu/home/hy/lazarus/lcl/units/i386-linux -Fu/home/hy/lazarus/components/lazutils/lib/i386-linux -Fu/home/hy/lazarus/packager/units/i386-linux -Fu. -FUlib/ -l -FElib/ -dLCL -dLCLgtk2 -dUseTCE -dGetCODES
« Last Edit: September 30, 2012, 11:21:24 pm by hy »
_____
***hy

Leledumbo

  • Hero Member
  • *****
  • Posts: 8836
  • Programming + Glam Metal + Tae Kwon Do = Me
What packages are you using? Perhaps there are some windows specific units in a package that link to kernel32. Looking at the -Fu's, do you give path to Indy units source code instead of compiled ones? That could be the problem...

hy

  • Full Member
  • ***
  • Posts: 224
Thanks. Indy might be the problem.

I don't have any compiled ones.
i downloaded them from http://indy.fulgan.com/ZIP/
which was recommended in another post here.
If you'd recommend other sources to download Indy i'd appreciate that.

TIA
_____
***hy

Leledumbo

  • Hero Member
  • *****
  • Posts: 8836
  • Programming + Glam Metal + Tae Kwon Do = Me
Quote
I don't have any compiled ones.
i downloaded them from http://indy.fulgan.com/ZIP/
which was recommended in another post here.
If you'd recommend other sources to download Indy i'd appreciate that.
No, no, no. I mean, install Indy normally, there should be a (some?) directories containing .ppu and .o (and probably .a) which your program should use. Add Indy as your project dependency (via project inspector), that would automatically put the directories I mentioned earlier. You shouldn't add directory to your project's "other unit files", it's intended for your own sources lying in different directory, not package sources.

hy

  • Full Member
  • ***
  • Posts: 224
Sorry, I found several different instructions here on how to install Indy.
No one worked here. There are several versions of sources around.
I do not use the components as components but create the required ones manually in my source.
So I thought it should be enough to have the sources avbailable.
There is here an install instruction:
http://wiki.freepascal.org/Indy_with_Lazarus

Which didn't work out on my system. (Debian sid).
Thanks for any hint on how to do it in a different manner.
_____
***hy

Leledumbo

  • Hero Member
  • *****
  • Posts: 8836
  • Programming + Glam Metal + Tae Kwon Do = Me
Quote
I do not use the components as components but create the required ones manually in my source.
Installing the package and adding it as your project dependency doesn't force you to use the components, you can still create everything by code. And you have to do it this way, otherwise you might let it point to sources it should never touch.

taazz

  • Hero Member
  • *****
  • Posts: 5368
Actually by opening the package with lazarus and compiling it should be enough to have it registered as an existing package with lazarus and enable you to select it in object inspector as dependency.

that fulgan zip file has a number of problems 1st and for most you need to copy all the library files in a single directory including the .lpk related files. Second you need to open the package and make sure that it is marked as a design and runtime package. then you need to hit compile.

That does not solve all the problems though, there are times when Lazarus will decide that the existing compiled units need to be recompiled and it will not compile your project unless it finds and compiles the id*.pas files this problem I solved by adding the lazarus library path to the projects search paths.

I assume that the problem is that the package does not contain all the files that are part of the indy library it only has the registering and editor units that should be used by the IDE.

My next step when I find some time is to create a runtime package that has all the .pas files that are not editors or registration files in a single runtime package and add that package as a requirement on the existing package this should help lazarus find the correct paths as needed.

As for the problem I'm sorry I have no idea why it tries to link to a windows dll and I have no linux set up to test it yet.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

hy

  • Full Member
  • ***
  • Posts: 224
I only have the source files. I don't need them as packages and there is no working way to compile them all. But I'll move this to another topic
_____
***hy

Leledumbo

  • Hero Member
  • *****
  • Posts: 8836
  • Programming + Glam Metal + Tae Kwon Do = Me
Quote
I only have the source files. I don't need them as packages and there is no working way to compile them all. But I'll move this to another topic
OK, if you want to stick that way, you have to find out which units are actually used for your system. You might also need to dig in what compiler options required to compile the sources.

hy

  • Full Member
  • ***
  • Posts: 224
Let me ask the other way round:
From which sources did you install indy?
_____
***hy

hy

  • Full Member
  • ***
  • Posts: 224
I removed Indy completely from the project and still am getting the message that kernel32.dll can not be found
_____
***hy

hy

  • Full Member
  • ***
  • Posts: 224
Again: there is a link.res file in my unit output directory that contains
Code: [Select]
INPUT(
-lkernel32.dll
...

If I delete the entry it is reestablished either when compiling from within the IDE or from commandline.
And though I have set -Tlinux I am getting the warning: Did you forget -T
And no, there is no output section in my link.res
any help apreciated
_____
***hy

Leledumbo

  • Hero Member
  • *****
  • Posts: 8836
  • Programming + Glam Metal + Tae Kwon Do = Me
link.res is automatically generated and the INPUT section contents regarding dynamic libraries are extracted from used units. As I said last time, you have to dig in yourself because we don't have access your full project, so we have no idea how that kernel32 thing can end up in your project. If it's not part of Indy, that means it's something in your sources (or any other packages you use). Perhaps a "find in files" with regex "\{\$linklib\s+kernel32\}" will do.

hy

  • Full Member
  • ***
  • Posts: 224
Thanks to you all. I have found the eroror. As Leledumbo wrote I had in one of my test units a windows dll included that resulted from tests with DELPHI years ago and I had completely forgotten about it.
Topic closed.
_____
***hy

 

TinyPortal © 2005-2018