Recent

Author Topic: wsl: convincing FPC that it is on Linux  (Read 12498 times)

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11351
  • FPC developer.
wsl: convincing FPC that it is on Linux
« on: August 18, 2018, 06:42:11 pm »
I just installed debian WSL, and tried to compile FPC.

I run

make clean all PP=~/ppcx64 

but make terminates with

Quote
Makefile:135: *** Compiler /home/marcov/ppcx64.exe not found.  Stop.

so it adds an extension because it thinks it is on Windows.

make info gives typical windows output. OS_SOURCE=linux doesn't really help either.

Anybody info on running FPC on Windows/wsl-linux ?

Thaddy

  • Hero Member
  • *****
  • Posts: 14157
  • Probably until I exterminate Putin.
Re: wsl: convincing FPC that it is on Linux
« Reply #1 on: August 18, 2018, 10:15:10 pm »
I installed fpc from the repositories with apt-get. then you get 2.6.2 on my version.
subsequently built 3.0.4 with 2.6.2. The wsl version is ubuntu trusty+backports.
[edit] in two stages.
« Last Edit: August 18, 2018, 10:29:02 pm by Thaddy »
Specialize a type, not a var.

Thaddy

  • Hero Member
  • *****
  • Posts: 14157
  • Probably until I exterminate Putin.
Re: wsl: convincing FPC that it is on Linux
« Reply #2 on: August 19, 2018, 06:01:13 am »
Note that gives you a ppcx64 compiler.
steps I did:
1. install fpc from apt repository, this is 2.6.2 x86_64
2. co 3.0.2 compiler and rt|l cd compiler|make  // just the compiler to bootstrap later
3. co 3.0.4 | make all install PP=/the/path/to/your/302/compiler/ppcx64
Specialize a type, not a var.

Thaddy

  • Hero Member
  • *****
  • Posts: 14157
  • Probably until I exterminate Putin.
Re: wsl: convincing FPC that it is on Linux
« Reply #3 on: August 19, 2018, 11:45:05 am »
Marco, I can't imagine you did that but:
It is possible to invoke ppcx64-linux  from a Windows console!
But that won't work for a build.
You need to invoke fpc and make from a Linux console (bash in my case) that is also provided by wsl.
Just in case...
Specialize a type, not a var.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11351
  • FPC developer.
Re: wsl: convincing FPC that it is on Linux
« Reply #4 on: August 19, 2018, 11:54:16 am »
I ran the command from debian's bash and the compiler was one I got from a linux system (and ran if you used ./ppcx64)

If I type make info however, I see all files taken from my /mnt/c/pp32 normal trunk FPC install.

I have a feeling the OS detection of the makefile goes wrong. But I'll see if I can get a TAR installer to get a full linux FPC install.

p.s. debian FPC packages are IMHO not worth going through that kind of trouble, just get the tar.

FPK

  • Full Member
  • ***
  • Posts: 118
Re: wsl: convincing FPC that it is on Linux
« Reply #5 on: August 19, 2018, 01:22:28 pm »
bash -c "make FPC=/home/marcov/ppcx64 all -j"

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11351
  • FPC developer.
Re: wsl: convincing FPC that it is on Linux
« Reply #6 on: August 19, 2018, 02:07:24 pm »
bash -c "make FPC=/home/marcov/ppcx64 all -j"

Same problem.   I cleaned out my  $path, and now it works. So something found in the path convinced it that the source OS was windows, and OS_SOURCE=linux didn't convince it otherwise. Bad if something can't be overriden.

Then it bombs on development libraries, I assume I have to install build-essentials or something like it.

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: wsl: convincing FPC that it is on Linux
« Reply #7 on: August 19, 2018, 02:33:56 pm »
[....] something found in the path convinced it that the source OS was windows, [...]

I had this problem once upon a time (compilign a 2.6.x) and it happened because there was a ; in PATH, which made it think it was a Windows PATH.

[...] I assume I have to install build-essentials or something like it.

Yes, and all the *-dev dependencies. The Build-FAQ is your friend here, though not a very good friend. :)
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11351
  • FPC developer.
Re: wsl: convincing FPC that it is on Linux
« Reply #8 on: August 19, 2018, 02:47:29 pm »
[....] something found in the path convinced it that the source OS was windows, [...]

I had this problem once upon a time (compilign a 2.6.x) and it happened because there was a ; in PATH, which made it think it was a Windows PATH.

Well, I think in this case it is the pwd.exe in the path that sets the SRCEXEEXT.

Code: Pascal  [Select][+][-]
  1. override PATH:=$(patsubst %/,%,$(subst \,/,$(PATH)))
  2. ifneq ($(findstring darwin,$(OSTYPE)),)
  3. inUnix=1 #darwin
  4. SEARCHPATH:=$(filter-out .,$(subst :, ,$(PATH)))
  5. else
  6. ifeq ($(findstring ;,$(PATH)),)
  7. inUnix=1
  8. SEARCHPATH:=$(filter-out .,$(subst :, ,$(PATH)))
  9. else
  10. SEARCHPATH:=$(subst ;, ,$(PATH))
  11. endif
  12. endif
  13. SEARCHPATH+=$(patsubst %/,%,$(subst \,/,$(dir $(MAKE))))
  14. PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(SEARCHPATH))))
  15. ifeq ($(PWD),)
  16. PWD:=$(strip $(wildcard $(addsuffix /pwd,$(SEARCHPATH))))
  17. ifeq ($(PWD),)
  18. $(error You need the GNU utils package to use this Makefile)
  19. else
  20. PWD:=$(firstword $(PWD))
  21. SRCEXEEXT=
  22. endif
  23. else
  24. PWD:=$(firstword $(PWD))
  25. SRCEXEEXT=.exe
  26. endif
  27. ifndef inUnix
  28. ifeq ($(OS),Windows_NT)
  29. inWinNT=1
  30. else
  31. ifdef OS2_SHELL
  32. inOS2=1
  33. endif
  34. endif
  35. else
  36. ifneq ($(findstring cygdrive,$(PATH)),)
  37. inCygWin=1
  38. endif

Builtin variables OS and OSTYPE seem to be also used

Quote
[...] I assume I have to install build-essentials or something like it.

Yes, and all the *-dev dependencies. The Build-FAQ is your friend here, though not a very good friend. :)

I'm supposed to know it by heart, since I wrote it :-)

Thaddy

  • Hero Member
  • *****
  • Posts: 14157
  • Probably until I exterminate Putin.
Re: wsl: convincing FPC that it is on Linux
« Reply #9 on: August 19, 2018, 05:35:56 pm »
what happens when you just use the compiler like this:
fpc -Tlinux helloworld.pas

But then again, an install from the apt repository indeed draws in buildessential as a dependency as well as several other -dev packages that you otherwise need to install by hand.
I suggest you follow my path: install 2.6.2 , build 3.0.2 compiler only, use that to bootstrap the higher versions. Slightly more work, but worked for me on a second system too.
I tested that this morning.
Also note: is there an fpc.cfg in the way? Check for one in /etc/fpc.cfg
Specialize a type, not a var.

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: wsl: convincing FPC that it is on Linux
« Reply #10 on: August 19, 2018, 06:22:48 pm »
The Build-FAQ is your friend here, though not a very good friend. :)

I'm supposed to know it by heart, since I wrote it :-)

Oops!  :-[
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

Thaddy

  • Hero Member
  • *****
  • Posts: 14157
  • Probably until I exterminate Putin.
Re: wsl: convincing FPC that it is on Linux
« Reply #11 on: August 19, 2018, 08:18:20 pm »
Oops!  :-[
Marco seldom asks questions. If he does, the answer is often complex.
Specialize a type, not a var.

 

TinyPortal © 2005-2018