Re: [fpc-pascal] FPC linking syntax error

2015-06-22 Thread Stéphane Aulery

Hello,

Le 21/06/2015 13:58, Marco van de Voort a écrit :

In our previous episode, patspiper said:

Compiling the following simple program (from fpc prog manual
http://www.freepascal.org/docs-html/prog/progsu46.html#x53-520001.2.46)
yields a linking syntax error:



Is this a bug?


Not of a general kind, since it works on most Linux distros. E.g. it works
fine on my debian jessie 64-bit.

So it must be something particular to your Linux installation or
distribution. So best is to tell something about that installation.


I had a similar discussion last April. See those two bug reports:

http://bugs.freepascal.org/view.php?id=27988
http://bugs.freepascal.org/view.php?id=27994

It might help you understand if the problem is the same or not.

Regards,

--
Stéphane Aulery
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] FPC linking syntax error

2015-06-21 Thread patspiper

On 21/06/15 17:46, Marco van de Voort wrote:

In our previous episode, patspiper said:

INPUT(
-l c
)

I think that should be -lc, not -l c. I don't know where the extra
space is coming from in your case.

Exactly!

I have just posted a message with my findings. Which program produces
link.res?

Maybe the problem is the $linklib line in your example? Some an extra (shift-?) 
space that isn't
stripped but output to the linklib?

Exactly! I deleted the whole line, retyped it et voila!

It seems copying from LHelp carries some unwanted luggage (some odd 
invisible characters).


Thanks and sorry for the noise.

However I encountered this issue while trying to help Bo Berglund in his 
Lazarus mailing list thread. I will post a related specific question in 
a new fpc thread as not to mix things here.


Stephano
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] FPC linking syntax error

2015-06-21 Thread Jonas Maebe
On 21/06/15 11:28, patspiper wrote:
 Using 'ppc386 -s program1.pp' instead, line 121 of link.res is '-l c' in
 the section:
 INPUT(
 -l c
 )

I think that should be -lc, not -l c. I don't know where the extra
space is coming from in your case.


Jonas
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] FPC linking syntax error

2015-06-21 Thread patspiper

On 21/06/15 14:58, Marco van de Voort wrote:

In our previous episode, patspiper said:

Compiling the following simple program (from fpc prog manual
http://www.freepascal.org/docs-html/prog/progsu46.html#x53-520001.2.46)
yields a linking syntax error:
Is this a bug?

Not of a general kind, since it works on most Linux distros. E.g. it works
fine on my debian jessie 64-bit.

So it must be something particular to your Linux installation or
distribution. So best is to tell something about that installation.


Ubuntu 11.04 32bit
fpc 3.0.1 and 3.1.1 (not sure which rev but max 2 weeks old)
ld version: GNU ld (GNU Binutils for Ubuntu) 2.21.0.20110327

Stephano
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] FPC linking syntax error

2015-06-21 Thread Mark Morgan Lloyd

patspiper wrote:

On 21/06/15 14:58, Marco van de Voort wrote:

In our previous episode, patspiper said:

Compiling the following simple program (from fpc prog manual
http://www.freepascal.org/docs-html/prog/progsu46.html#x53-520001.2.46)
yields a linking syntax error:
Is this a bug?
Not of a general kind, since it works on most Linux distros. E.g. it 
works

fine on my debian jessie 64-bit.

So it must be something particular to your Linux installation or
distribution. So best is to tell something about that installation.


Ubuntu 11.04 32bit
fpc 3.0.1 and 3.1.1 (not sure which rev but max 2 weeks old)
ld version: GNU ld (GNU Binutils for Ubuntu) 2.21.0.20110327


Can you try with a different linker version? I've previously had 
problems with ld 2.21 on SPARC Solaris which apparently is acknowledged 
as a bad build, I was able to work round them to some extent by giving 
fpc an option like -k-T/some_path_here/ldscripts/elf32_sparc.x


--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] FPC linking syntax error

2015-06-21 Thread patspiper

On 21/06/15 16:40, Jonas Maebe wrote:

On 21/06/15 11:28, patspiper wrote:

Using 'ppc386 -s program1.pp' instead, line 121 of link.res is '-l c' in
the section:
INPUT(
-l c
)

I think that should be -lc, not -l c. I don't know where the extra
space is coming from in your case.

Exactly!

I have just posted a message with my findings. Which program produces 
link.res?


Stephano
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] FPC linking syntax error

2015-06-21 Thread patspiper

On 21/06/15 14:58, Marco van de Voort wrote:

In our previous episode, patspiper said:

Compiling the following simple program (from fpc prog manual
http://www.freepascal.org/docs-html/prog/progsu46.html#x53-520001.2.46)
yields a linking syntax error:
Is this a bug?

Not of a general kind, since it works on most Linux distros. E.g. it works
fine on my debian jessie 64-bit.

So it must be something particular to your Linux installation or
distribution. So best is to tell something about that installation.
- I tried to link manually using the fpc produced link.res and got the 
same error.


- I removed the section INPUT(-l c) from link.res and linked manually 
(adding -lc as an option):
/usr/bin/ld -b elf32-i386 -m elf_i386 
--dynamic-linker=/lib/ld-linux.so.2 -L. -lc -o program1 link.res

Success!

I changed the following part in link.res:
INPUT(
-l c
)
to
INPUT(
-lc
)
and manual linking works!

So the issue is fpc producing link.res with a -l c instead of -lc. Which 
program specifically produces link.res?


Note: Newer ld built from source produces the same results.

Stephano
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] FPC linking syntax error

2015-06-21 Thread Jonas Maebe
On 21/06/15 15:50, patspiper wrote:
 So the issue is fpc producing link.res with a -l c instead of -lc. Which
 program specifically produces link.res?

It's the compiler. But this can't be a problem that always occurs,
because otherwise make all would fail too as fpmake by default also
links to libc.


Jonas
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] FPC linking syntax error

2015-06-21 Thread Marco van de Voort
In our previous episode, patspiper said:
 Compiling the following simple program (from fpc prog manual 
 http://www.freepascal.org/docs-html/prog/progsu46.html#x53-520001.2.46) 
 yields a linking syntax error:

 Is this a bug?

Not of a general kind, since it works on most Linux distros. E.g. it works
fine on my debian jessie 64-bit.

So it must be something particular to your Linux installation or
distribution. So best is to tell something about that installation.

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] FPC linking syntax error

2015-06-21 Thread Marco van de Voort
In our previous episode, patspiper said:
  INPUT(
  -l c
  )
  I think that should be -lc, not -l c. I don't know where the extra
  space is coming from in your case.
 Exactly!
 
 I have just posted a message with my findings. Which program produces 
 link.res?

Maybe the problem is the $linklib line in your example? Some an extra (shift-?) 
space that isn't
stripped but output to the linklib?
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


[fpc-pascal] FPC linking syntax error

2015-06-21 Thread patspiper

Hi,

Compiling the following simple program (from fpc prog manual 
http://www.freepascal.org/docs-html/prog/progsu46.html#x53-520001.2.46) 
yields a linking syntax error:


program Project1;
{$Linklib c}
Const P : PChar = 'This is fun !';
Function strlen (P: PChar): Longint; cdecl; external;
begin
  WriteLn ('Length of (',p,') : ',strlen(p))
end.

 ppc386 program1.pp
Free Pascal Compiler version 3.1.1 [2015/06/06] for i386
Copyright (c) 1993-2015 by Florian Klaempfl and others
Target OS: Linux for i386
Compiling program1.pp
Linking program1
/usr/bin/ld:link.res: file format not recognized; treating as linker script
/usr/bin/ld:link.res:121: syntax error
program1.pp(8,1) Error: Error while linking
program1.pp(8,1) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted

Using 'ppc386 -s program1.pp' instead, line 121 of link.res is '-l c' in 
the section:

INPUT(
-l c
)

and the linker invocation line in ppas.sh is:
/usr/bin/ld -b elf32-i386 -m elf_i386 
--dynamic-linker=/lib/ld-linux.so.2   -s -L. -o program1 link.res


Is this a bug?

Thanks,
Stephano
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal