Recent

Author Topic: can not find LibC (moduleload)  (Read 7564 times)

jcaser1948

  • Jr. Member
  • **
  • Posts: 51
can not find LibC (moduleload)
« on: December 28, 2017, 09:12:00 am »
I use Lazarus 1.8 in SuseLinux 42.3 64 bits  und try to compile the Demo Openglcontrol. wich comes with Lazarus.
I get a complain from Moduleloader "Can not find LIBC"
The code  part in the Moduloader is
uses
{$ifdef Linux}
  Types,
  Libc;
{$else} 
I can not fid this Libc anywhere. Cansamone give me a hint? Thanks
« Last Edit: December 28, 2017, 11:09:39 am by jcaser1948 »

Thaddy

  • Hero Member
  • *****
  • Posts: 8880
Re: can not find LibC (moduleload)
« Reply #1 on: December 28, 2017, 09:20:30 am »
I am not sure the libc unit is necessary(it is deprecated) but the libc llibrary it is in /packages/libc/ and the unit libc is in /packages/libc/src/libc.pp. It is 32 bit only and only i386.

http://wiki.freepascal.org/libc_unit

You should use the unix and linux units instead. (I think at least somethink like baseunix, baselinux , cthreads);
« Last Edit: December 28, 2017, 09:30:09 am by Thaddy »
Most people that want to use threading should learn to patch their jeans first: use a needle.

jcaser1948

  • Jr. Member
  • **
  • Posts: 51
Re: can not find LibC (moduleload)
« Reply #2 on: December 28, 2017, 11:15:05 am »

Thanks Thaddy.
No wonder  Lazarus does not find the library.
Is there a way to compile  the Demo Openglcontrol. which comes with Lazarus (Linux64bit). If there is none I wonder why they ship this demo in the package at all.Perhaps to discourage newbies like me

Thaddy

  • Hero Member
  • *****
  • Posts: 8880
Re: can not find LibC (moduleload)
« Reply #3 on: December 28, 2017, 11:33:06 am »
Well its author is on this forum. But are you sure you are using Laz 1.8 +FPC 3.0.4?
If the demo indeed relies on libc, that is easy to fix. It can also be considered a bug if it still is in Laz 1.8.
Most people that want to use threading should learn to patch their jeans first: use a needle.

wp

  • Hero Member
  • *****
  • Posts: 6227
Re: can not find LibC (moduleload)
« Reply #4 on: December 28, 2017, 12:46:17 pm »
I tested the OpenGL demo which comes along with the package in Linux Mint/gtk2, and it is running fine (32 bit, though).

I wonder where this module loader is coming from. Seeking through the entire Lazarus/fpc source tree, there is only one moduleloader.pas, and this is in (fpc)\packages\winunits-jedi\src\ModuleLoader.pas. Strange...
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10

Thaddy

  • Hero Member
  • *****
  • Posts: 8880
Re: can not find LibC (moduleload)
« Reply #5 on: December 28, 2017, 01:10:53 pm »
Because jedi units historically supports Kylix? Anyway, libc (the unit) should not turn up in demo code that is part of the distribution.. OpenGL is cross-platform.
Most people that want to use threading should learn to patch their jeans first: use a needle.

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 7432
Re: can not find LibC (moduleload)
« Reply #6 on: December 28, 2017, 01:37:34 pm »
My guess is that your compiler finds some third party GL unit that isn't terribly well ported to Free Pascal instead of the default freepascal one.

Go to the example form, and ctrl-click the gl unit, and see what it loads.

jcaser1948

  • Jr. Member
  • **
  • Posts: 51
Re: can not find LibC (moduleload)
« Reply #7 on: December 28, 2017, 02:18:10 pm »
Dear Markov
I explain what I have done
1) downloaded  the compiled Lazarus1.8 from Opensuse with YAST
2) Installed it also with Yast
3) copied  the Demo programs out to my Home directory, changed the Ownership and compiled it
When I try to compile Openglecontrol Lazarus refuses  The error rises in the Moduleloader


unit moduleloader;
{
  $Id: moduleloader.pas,v 1.4 2004/02/20 17:19:10 savage Exp $
 
}
{******************************************************************}
{                                                                  }
{       Project JEDI                                               }
{       OS independent Dynamic Loading Helpers                     }
{                                                                  }
{ The initial developer of the this code is                        }
{ Robert Marquardt <robert_marquardt@gmx.de)                       }
{                                                                  }
{ Copyright (C) 2000, 2001 Robert Marquardt.                       }
{                                                                  }
{ Obtained through:                                                }
{ Joint Endeavour of Delphi Innovators (Project JEDI)              }
{                                                                  }
{ You may retrieve the latest version of this file at the Project  }
{ JEDI home page, located at http://delphi-jedi.org                }
{                                                                  }
{ The contents of this file are used with permission, subject to   }
{ the Mozilla Public License Version 1.1 (the "License"); you may  }
{ not use this file except in compliance with the License. You may }
{ obtain a copy of the License at                                  }
{ http://www.mozilla.org/NPL/NPL-1_1Final.html                     }
{                                                                  }
{ Software distributed under the License is distributed on an      }
{ "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or   }
{ implied. See the License for the specific language governing     }
{ rights and limitations under the License.                        }
{                                                                  }
{******************************************************************}
{
  $Log: moduleloader.pas,v $
  Revision 1.4  2004/02/20 17:19:10  savage
  Added Calling convention to Win32 functions just in case.

  Revision 1.3  2004/02/14 22:36:29  savage
  Fixed inconsistencies of using LoadLibrary and LoadModule.
  Now all units make use of LoadModule rather than LoadLibrary and other dynamic proc procedures.

  Revision 1.2  2004/02/14 00:23:39  savage
  As UNIX is defined in jedi-sdl.inc this will be used to check linux compatability as well. Units have been changed to reflect this change.

  Revision 1.1  2004/02/14 00:04:50  savage
  dllfuncs conflicts with FreePascal so it has been renamed back to the moduleloader.pas

  Revision 1.1  2004/02/05 00:08:19  savage
  Module 1.0 release

 
}

interface

{$i jedi-sdl.inc}
{$WEAKPACKAGEUNIT ON}
Hier the error
moduleloader.pas(190,3) Fatal: no puedo encontrar Libcutilizado por moduleloader.

And hier the Beginning of LIBC

{$mode objfpc}
{$inline on}
{$h+}

{$if not defined(linux) or not defined(cpui386)}
  {$error The KernelDefs unit is a legacy Kylix-compatibility unit that is only supported on Linux/i386. It is known not to work in various ways on other OSes and architectures (including Linux/x86_64). }
{$endif}

unit libc deprecated 'Unportable Kylix legacy unit that only exists on Linux/x86. see http://wiki.freepascal.org/libc_unit ';

Interface

uses unixtype,kerneldefs;

Const
  clib = 'c';
  dllib

And here  the offending part, where Lazarus strikes


{$ENDIF}

{$IFDEF Unix}
uses
{$ifdef Linux}
  Types,
  Libc;
{$else}
  dl,
  Types,
  Baseunix,
  Unix;
{$endif}
type
  // Handle to a loaded .so
  TModuleHandle = Pointer;

const
  // Value designating an unassigned TModuleHandle od a failed loading
  INVALID_MODULEHANDLE_VALUE = TModuleHandle(nil);
« Last Edit: December 28, 2017, 02:28:38 pm by jcaser1948 »

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 7432
Re: can not find LibC (moduleload)
« Reply #8 on: December 28, 2017, 02:23:30 pm »
That was not the question. The question was which opengl (or whatever) unit that you use that USES moduleloader.

Moduleloader is an old 2000s unit only for some jedi projects. Thus no normal FPC sourcecode uses it, except it is very old legacy.

I suspect you have some jedi unit in your search path that directly or indirectly ends up in module loader.

jcaser1948

  • Jr. Member
  • **
  • Posts: 51
Re: can not find LibC (moduleload)
« Reply #9 on: December 28, 2017, 02:37:41 pm »
Dear markov
I have no idea why Lazarus seeks Modulloader and LIbc .I have no such legacy units that I can find. Perhaps you could give some hints  how to seek them
Where they came from I can not undertand
Thanks again

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 7432
Re: can not find LibC (moduleload)
« Reply #10 on: December 28, 2017, 03:11:13 pm »
Perhaps you could give some hints  how to seek them

I already did in my first post:

Quote
Go to the example form, and ctrl-click the gl unit, and see what it loads.

jcaser1948

  • Jr. Member
  • **
  • Posts: 51
Re: can not find LibC (moduleload)
« Reply #11 on: December 28, 2017, 04:11:14 pm »
Dear markov
Thaks to your hints I have cound the following:
GL calls moduleloader.pas

interface

{$I jedi-sdl.inc}

uses
{$IFDEF __GPC__}
  system,
  gpc,
{$ENDIF}

{$IFDEF WIN32}
  Windows,
{$ENDIF}
  moduleloader;

moduleloader calls LibC

aprox at  position 190

{$IFDEF Unix}
uses
{$ifdef Linux}
  Types,
  Libc;
{$else}
  dl,
  Types,
  Baseunix,
  Unix;
{$endif}     

Furthermore, there exits a libc.so  at /usr/lib64/libc.so
How it went there I do not know
I could not find out where moduleloader.pas is located

Thanks for your time

Thaddy

  • Hero Member
  • *****
  • Posts: 8880
Re: can not find LibC (moduleload)
« Reply #12 on: December 28, 2017, 04:15:52 pm »
libc.so has nothing to do with libc.pp: libc.so contains the C standard library code. Don't confuse them.
FPC does not usually need libc.so.

Oh and did you give us Laz and FPC version yet?
Most people that want to use threading should learn to patch their jeans first: use a needle.

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 7432
Re: can not find LibC (moduleload)
« Reply #13 on: December 28, 2017, 04:17:44 pm »
Dear markov
Thaks to your hints I have cound the following:
GL calls moduleloader.pas

Free Pascal's gl unit does not . So where is that "gl" coming from? If you hover above the tab you can see the path.

The name of the include file seems to indicate your GL unit is packaged with some "jedi-sdl" package.

jcaser1948

  • Jr. Member
  • **
  • Posts: 51
Re: can not find LibC (moduleload)
« Reply #14 on: December 28, 2017, 06:44:06 pm »
Dear Thaddy
I have the version FPC 3.0.05.51
and the Lazarus Version 1.8.0-15.5
Thanks