Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2011-02

Libnodave on linux

10 messages · 4 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Peter Andersen

Hello

Is there anybody who has compilled the libnodave testprogram "TestISO_TCP.PAS" under linux.
If yes could you tell what version of fpc and what options etc. you have used to it.
I have try with version 2.4.2 but got somthing like this:

hmi]$ fpc testISO_TCP.pas
Free Pascal Compiler version 2.4.2 [2010/11/09] for i386 Copyright (c) 1993-2010 by Florian Klaempfl
Target OS: Linux for i386
Compiling testISO_TCP.pas
testISO_TCP.pas(68,5) Note: Local variable "seconds" not used testISO_TCP.pas(68,13) Note: Local variable "thirds" not used testISO_TCP.pas(72,22) Note: Local variable "saveDebug" not used testISO_TCP.pas(72,33) Note: Local variable "proto" is assigned but never used
testISO_TCP.pas(79,5) Note: Local variable "t1" not used testISO_TCP.pas(79,8) Note: Local variable "t2" not used testISO_TCP.pas(84,5) Note: Local variable "usec" is assigned but never used Linking testISO_TCP
/usr/bin/ld: warning: link.res contains output sections; did you forget -T? /usr/lib/libnodave.so: undefined reference to `printf' /usr/lib/libnodave.so: undefined reference to `stdout' /usr/lib/libnodave.so: undefined reference to `connect' /usr/lib/libnodave.so: undefined reference to `strerror' /usr/lib/libnodave.so: undefined reference to `memcpy' /usr/lib/libnodave.so: undefined reference to `puts' /usr/lib/libnodave.so: undefined reference to `tcflush' /usr/lib/libnodave.so: undefined reference to `tolower' /usr/lib/libnodave.so: undefined reference to `malloc' /usr/lib/libnodave.so: undefined reference to `socket' /usr/lib/libnodave.so: undefined reference to `select' /usr/lib/libnodave.so: undefined reference to `fflush' /usr/lib/libnodave.so: undefined reference to `calloc' /usr/lib/libnodave.so: undefined reference to `write' /usr/lib/libnodave.so: undefined reference to `fprintf' /usr/lib/libnodave.so: undefined reference to `setsockopt' /usr/lib/libnodave.so: undefined reference to `read' /usr/lib/libnodave.so: undefined reference to `strncmp' /usr/lib/libnodave.so: undefined reference to `strncpy' /usr/lib/libnodave.so: undefined reference to `gettimeofday' /usr/lib/libnodave.so: undefined reference to `memset' /usr/lib/libnodave.so: undefined reference to `tcgetattr' /usr/lib/libnodave.so: undefined reference to `gethostbyname' /usr/lib/libnodave.so: undefined reference to `sprintf' /usr/lib/libnodave.so: undefined reference to `stderr' /usr/lib/libnodave.so: undefined reference to `fputc' /usr/lib/libnodave.so: undefined reference to `localtime_r' /usr/lib/libnodave.so: undefined reference to `fwrite' /usr/lib/libnodave.so: undefined reference to `htons' /usr/lib/libnodave.so: undefined reference to `__errno_location' /usr/lib/libnodave.so: undefined reference to `open' /usr/lib/libnodave.so: undefined reference to `tcsetattr' /usr/lib/libnodave.so: undefined reference to `close' /usr/lib/libnodave.so: undefined reference to `free' testISO_TCP.pas(413,1) Error: Error while linking
testISO_TCP.pas(413,1) Fatal: There were 1 errors compiling module, stopping Fatal: Compilation aborted
Error: /usr/bin/ppc386 returned an error exitcode (normal if you did not specify a source file to be compiled)

/ Peter Andersen / Skanderborg / Danmark
Jeppe Johansen
to Peter Andersen

Try to do a fpc -k-lc testISO_TCP.pas

That should instruct the linker to link libc too

Peter Andersen wrote 67 lines
Hello Is there anybody who has compilled the libnodave testprogram "TestISO_TCP.PAS" under linux. If yes could you tell what version of fpc and what options etc. you have used to it. I have try with version 2.4.2 but got somthing like this: hmi]$ fpc testISO_TCP.pas Free Pascal Compiler version 2.4.2 [2010/11/09] for i386 Copyright (c) 1993-2010 by Florian Klaempfl Target OS: Linux for i386 Compiling testISO_TCP.pas testISO_TCP.pas(68,5) Note: Local variable "seconds" not used testISO_TCP.pas(68,13) Note: Local variable "thirds" not used testISO_TCP.pas(72,22) Note: Local variable "saveDebug" not used testISO_TCP.pas(72,33) Note: Local variable "proto" is assigned but never used testISO_TCP.pas(79,5) Note: Local variable "t1" not used testISO_TCP.pas(79,8) Note: Local variable "t2" not used testISO_TCP.pas(84,5) Note: Local variable "usec" is assigned but never used Linking testISO_TCP /usr/bin/ld: warning: link.res contains output sections; did you forget -T? /usr/lib/libnodave.so: undefined reference to `printf' /usr/lib/libnodave.so: undefined reference to `stdout' /usr/lib/libnodave.so: undefined reference to `connect' /usr/lib/libnodave.so: undefined reference to `strerror' /usr/lib/libnodave.so: undefined reference to `memcpy' /usr/lib/libnodave.so: undefined reference to `puts' /usr/lib/libnodave.so: undefined reference to `tcflush' /usr/lib/libnodave.so: undefined reference to `tolower' /usr/lib/libnodave.so: undefined reference to `malloc' /usr/lib/libnodave.so: undefined reference to `socket' /usr/lib/libnodave.so: undefined reference to `select' /usr/lib/libnodave.so: undefined reference to `fflush' /usr/lib/libnodave.so: undefined reference to `calloc' /usr/lib/libnodave.so: undefined reference to `write' /usr/lib/libnodave.so: undefined reference to `fprintf' /usr/lib/libnodave.so: undefined reference to `setsockopt' /usr/lib/libnodave.so: undefined reference to `read' /usr/lib/libnodave.so: undefined reference to `strncmp' /usr/lib/libnodave.so: undefined reference to `strncpy' /usr/lib/libnodave.so: undefined reference to `gettimeofday' /usr/lib/libnodave.so: undefined reference to `memset' /usr/lib/libnodave.so: undefined reference to `tcgetattr' /usr/lib/libnodave.so: undefined reference to `gethostbyname' /usr/lib/libnodave.so: undefined reference to `sprintf' /usr/lib/libnodave.so: undefined reference to `stderr' /usr/lib/libnodave.so: undefined reference to `fputc' /usr/lib/libnodave.so: undefined reference to `localtime_r' /usr/lib/libnodave.so: undefined reference to `fwrite' /usr/lib/libnodave.so: undefined reference to `htons' /usr/lib/libnodave.so: undefined reference to `__errno_location' /usr/lib/libnodave.so: undefined reference to `open' /usr/lib/libnodave.so: undefined reference to `tcsetattr' /usr/lib/libnodave.so: undefined reference to `close' /usr/lib/libnodave.so: undefined reference to `free' testISO_TCP.pas(413,1) Error: Error while linking testISO_TCP.pas(413,1) Fatal: There were 1 errors compiling module, stopping Fatal: Compilation aborted Error: /usr/bin/ppc386 returned an error exitcode (normal if you did not specify a source file to be compiled)
Jonas Maebe
to Jeppe Johansen
Jeppe Johansen wrote
Try to do a fpc -k-lc testISO_TCP.pas That should instruct the linker to link libc too

That's a very bad way to link libc, because afaik it bypasses all compiler detections for the fact that you are linking to that library (and doing so requires using different startup code). Instead, either add {$linklib c} to the source, or add the "initc" unit to the uses clause.

Jonas

Peter Andersen
to Jonas Maebe: That's a very bad way to link libc, because afaik it bypasses all compiler detections for…
Jonas Maebe wrote 13 lines
On 04 Feb 2011, at 20:44, Jeppe Johansen wrote: > Try to do a fpc -k-lc testISO_TCP.pas > > That should instruct the linker to link libc too That's a very bad way to link libc, because afaik it bypasses all compiler detections for the fact that you are linking to that library (and doing so requires using different startup code). Instead, either add {$linklib c} to the source, or add the "initc" unit to the uses clause. Jonas_______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Please could you explain it a little bit more.
I am new to this.
I have programmet in Dos and on windows for years. But with linux using shared lib i am total new.

/ Peter Andersen / Skanderborg / Danmark
Jonas Maebe
to Peter Andersen
Peter Andersen wrote
> That's a very bad way to link libc, because afaik it bypasses all compiler detections for the fact that you are linking to that library (and doing so requires using different startup code). Instead, either add {$linklib c} to the source, or add the "initc" unit to the uses clause. Please could you explain it a little bit more.

What is it exactly that you do not understand?

Jonas

Unknown author
to Jonas Maebe

Maybe, you can try the PascalSCADA...

Regards,

Fabio

2011/2/4 Jonas Maebe :

Show quoted text 14 lines
On 04 Feb 2011, at 21:24, Peter Andersen wrote: >> That's a very bad way to link libc, because afaik it bypasses all compiler detections for the fact that you are linking to that library (and doing so requires using different startup code). Instead, either add {$linklib c} to the source, or add the "initc" unit to the uses clause. > > Please could you explain it a little bit more. What is it exactly that you do not understand? Jonas_______________________________________________ fpc-pascal maillist  -   http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Peter Andersen
to Jonas Maebe: What is it exactly that you do not understand? Jonas
Jonas Maebe wrote 8 lines
On 04 Feb 2011, at 21:24, Peter Andersen wrote: >> That's a very bad way to link libc, because afaik it bypasses all compiler detections for the fact that you are linking to that library (and doing so requires using different startup code). Instead, either add {$linklib c} to the source, or add the "initc" unit to the uses clause. > > Please could you explain it a little bit more. What is it exactly that you do not understand?

{$linklib c}
Is it possible just to add a line like:
{$/linklib c}
into the source and if yes where in the source.
I have some
{$ifdef linux}
,linux
{$endif}
should it be inside thes ifdef and endif ?

/ Peter Andersen / Skanderborg / Danmark
Jonas Maebe
to Peter Andersen: {$linklib c} Is it possible just to add a line like: {$/linklib c} into the source and if…
Peter Andersen wrote 14 lines
Den 04-02-2011 21:27, Jonas Maebe skrev: > > On 04 Feb 2011, at 21:24, Peter Andersen wrote: > >>> That's a very bad way to link libc, because afaik it bypasses all compiler detections for the fact that you are linking to that library (and doing so requires using different startup code). Instead, either add {$linklib c} to the source, or add the "initc" unit to the uses clause. >> >> Please could you explain it a little bit more. > > What is it exactly that you do not understand? {$linklib c} Is it possible just to add a line like: {$/linklib c} into the source

Yes (without the "/")

and if yes where in the source.

In principle it can appear anywhere.

Show quoted text 5 lines
I have some {$ifdef linux} ,linux {$endif} should it be inside thes ifdef and endif ?

If the C library should only be linked when compiling for Linux: then yes (although I wouldn't add it inside that particular ifdef/endif block since it's the in the middle of a uses-clause, but instead in a separate ifdef/endif block that only contains shared library-related stuff). If the library should always be linked, then add it somewhere outside those defines.

Jonas