Recent

Author Topic: [solved] Crosscompiling Mint 17.3 --> Win32/64  (Read 8843 times)

Kralle

  • New Member
  • *
  • Posts: 23
[solved] Crosscompiling Mint 17.3 --> Win32/64
« on: February 14, 2016, 02:46:23 pm »
Hello,

under Linux Mint 17.3 i installed FP 3.0.0 and Lazarus 1.6RC2 with this Script:
Quote
#!/bin/bash
#
# run in your HOME-directory with: sudo sh getlaz.sh  (HR)
#
# (C)by: Michael Van Canneyt (michael@freepascal.org)
#
# Release from: 2016-01-30  (HR)
# additional comments from: Heiko Rompel (HR)
########################################################
# Some variables. Set this to whatever you want
########################################################
#
# Where to download/install everything ? (below home directory)
#
INSTALLDIR=fpc
#
# Which FPC version to use ?
#
VERSION=3.0.0
CPUARCH=`uname -p`
#
# Install FPC/Lazarus as root ? (YES or NO)
#
USEROOT=YES
#
# Which lazarus version ?
# set either tag or branch variable.
# If neither is set, trunk is used.
# When lazarus 1.6 is out, this becomes lazarus_1_6
#
# A newer RC is out (HR)
TAG=lazarus_1_6_RC2/
BRANCH=
 
#########################################################
# No variables after this point.
#########################################################
#
# Install preliminaries. This must be done as root.
#
sudo apt-get install subversion make binutils gdb gcc libgtk2.0-dev
 
#
# Check if the rest must be done as root.
#
if [ "$USEROOT" = YES ]; then
  SUDO=sudo
fi
#
#######################################################################
# Get and install FPC.
#######################################################################
#
# Create installation directory
#
mkdir ~/$INSTALLDIR
cd ~/$INSTALLDIR
#
# Fetch the necessary files for FPC.
#
wget ftp://ftpmaster.freepascal.org/pub/fpc/dist/$VERSION/source/fpc-$VERSION.source.tar.gz
wget ftp://ftpmaster.freepascal.org/pub/fpc/dist/$VERSION/$CPUARCH-linux/fpc-$VERSION.$CPUARCH-linux.tar
#
# extract installer.
#
tar xvf fpc-3.0.0.$CPUARCH-linux.tar
cd fpc-3.0.0.$CPUARCH-linux
#
# Install FPC (possibly as root)
#
$SUDO sh ./install.sh
#
# Extract sources.
#
cd ~
tar xvzf $INSTALLDIR/fpc-$VERSION.source.tar.gz
cd ~/$INSTALLDIR
#
#######################################################################
# Get and install Lazarus
#######################################################################
#
# Determine SVN url
#
BASEURL=http://svn.freepascal.org/svn/lazarus/
#
if [ ! -z "$TAG" ]; then
  SVNURL=$BASEURL/tags/$TAG
else
  if [ ! -z "$BRANCH" ]; then
    SVNURL=$BASEURL/branches/$BRANCH
  else
    SVNURL=$BASEURL/trunk
  fi
fi
#
# Check out sources
#
svn co $SVNURL lazarus
#
# Build the IDE
#
cd lazarus
make bigide
#
# Install lazarus (possibly as root)
#
$SUDO make install
#
# That's all folks !
#

But what must i do then?
http://wiki.lazarus.freepascal.org/Cross_compiling_for_Win32_under_Linux
the Information doesn't work.
At the German Lazarus-Forum in this Thread:
http://www.lazarusforum.de/viewtopic.php?f=16&t=9411
i post the thinks a tested, but nothing works.

Is here somebody who used Linux-Lazarus to create Win32/64-Code?
If yes, please help me.

« Last Edit: February 21, 2016, 07:11:29 am by Kralle »

Leledumbo

  • Hero Member
  • *****
  • Posts: 8757
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Crosscompiling Mint 17.3 --> Win32/64
« Reply #1 on: February 14, 2016, 03:48:29 pm »
the Information doesn't work.
Describe "doesn't work". What steps have you done? What output do you get? Where are you stuck? Have you read and understood the generic article that you must read prior to reading above article?
« Last Edit: February 14, 2016, 03:53:17 pm by Leledumbo »

Kralle

  • New Member
  • *
  • Posts: 23
Re: Crosscompiling Mint 17.3 --> Win32/64
« Reply #2 on: February 14, 2016, 04:27:39 pm »
Hello,

after install FPC and Lazarus, i started Lazarus an press F9.
The default "program" will compiled and run.
Then i take a snapshot (VMware Workstation (only for testing)).

After this i do this:
Quote
Newer FPCs - 2.1.1 and newer

If you are compiling a 2.1.1 or newer version of FPC you can just do:

$ make all OS_TARGET=win32 CPU_TARGET=i386

and then

$ su -c "make crossinstall OS_TARGET=win32 CPU_TARGET=i386"

Note-icon.png

Note: make crossinstall by default installs all files in /usr/local/lib/fpc/$fpcversion/units directory that's why you will need to add to /etc/fpc.cfg file new search path -Fu/usr/local/lib/fpc/$fpcversion/units/$fpctarget. Other option is to use INSTALL_PREFIX=/usr while performing crossinstall in this case you will not need to change anything in /etc/fpv.cfg file because all will be instaled in /usr/lib/fpc/$fpcversion/units witch is alredy there
Note-icon.png

Note: To build for win64 the make command is: make all OS_TARGET=win64 CPU_TARGET=x86_64

The reason for this simplicity is the internal linker included in this version of fpc.

After this i do this: overrides.jpg

then i switch the Buildmode to "win32" and press F9 again.

But i become this win_error.jpg

And now?

Greeting
Heiko


Cyrax

  • Hero Member
  • *****
  • Posts: 836
Re: Crosscompiling Mint 17.3 --> Win32/64
« Reply #3 on: February 14, 2016, 05:02:19 pm »
Did you edit /etc/fpc.cfg to include new paths for win32 units as requested?

Leledumbo

  • Hero Member
  • *****
  • Posts: 8757
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Crosscompiling Mint 17.3 --> Win32/64
« Reply #4 on: February 14, 2016, 05:07:02 pm »
From the 2nd screenshot, it's clear that your cross compiler toolchain is not built / configured well.
  • Where did you execute `make all OS_TARGET=win32 CPU_TARGET=i386` and `su -c "make crossinstall OS_TARGET=win32 CPU_TARGET=i386"` and what did it output? Are both successful? Confirm by locating /usr/local/lib/fpc exists and not empty, at least there should be ppcross386 and units/i386-win32 (which contains a bunch of directories for each package containing their respective compiled units) there
  • Have you done what's told in the "Note" part? Modify -Fu in fpc.cfg if you don't get it
  • Has the symlink to ppcross386 above been created somewhere in PATH? Preferrably in the same place as fpc binary

Kralle

  • New Member
  • *
  • Posts: 23
Re: Crosscompiling Mint 17.3 --> Win32/64
« Reply #5 on: February 14, 2016, 06:16:24 pm »
Hello,

thank you for your help.

Quote from: Leledumbo
Where did you execute `make all OS_TARGET=win32 CPU_TARGET=i386` and `su -c "make crossinstall OS_TARGET=win32 CPU_TARGET=i386"`
I do this in "/home/laz-user/fpc-3.0.0" (laz-user@laz-book ~/fpc-3.0.0)

Quote from: Leledumbo
and what did it output?
Results for the first one (without sudo): result1.txt

Results for the first one (with sudo): result1_sudo.txt

Result for the second one: result2.txt
(to many Words for direct quote)

Quote from: Leledumbo
Are both successful?
I think: yes.

Quote from: Leledumbo
Confirm by locating /usr/local/lib/fpc exists and not empty,
ready

Quote from: Leledumbo
at least there should be ppcross386 and units/i386-win32 (which contains a bunch of directories for each package containing their respective compiled units) there
yes

Quote from: Leledumbo
Have you done what's told in the "Note" part?

No  :-[

Quote from: Leledumbo
Modify -Fu in fpc.cfg if you don't get it

if found the write-protected "fpc.cfg" and found this:

Quote
# searchpath for units and other system dependent things
-Fu/usr/lib/fpc/$fpcversion/units/$fpctarget
-Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/*
-Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/rtl

#ifdef cpui8086
-Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/$fpcsubarch-$fpcmemorymodel
-Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/$fpcsubarch-$fpcmemorymodel/*
-Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/$fpcsubarch-$fpcmemorymodel/rtl
#endif

#IFDEF FPCAPACHE_1_3
-Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/httpd13/
#ELSE
#IFDEF FPCAPACHE_2_0
-Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/httpd20
#ELSE
-Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/httpd22
#ENDIF
#ENDIF

# searchpath for fppkg user-specific packages
-Fu~/.fppkg/lib/fpc/$fpcversion/units/$FPCTARGET/*

Is there something to do for me??

Quote from: Leledumbo
Has the symlink to ppcross386 above been created somewhere in PATH?
Preferrably in the same place as fpc binary

Sorry, i didn't understand this? (i'm a linux newbie)

Greetings from germany
Heiko

Leledumbo

  • Hero Member
  • *****
  • Posts: 8757
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Crosscompiling Mint 17.3 --> Win32/64
« Reply #6 on: February 14, 2016, 06:29:18 pm »
OK, both building and installation success, though it's a little weird you don't have write permission in a folder inside your home directory.
if found the write-protected "fpc.cfg" and found this:
...
Is there something to do for me??
Yes, read the note. The first sentence contains copy-paste-able line that you can write into your fpc.cfg. I suggest making the file writable unless you prefer to always prefixing your editing command with sudo.
Quote from: Leledumbo
Has the symlink to ppcross386 above been created somewhere in PATH?
Preferrably in the same place as fpc binary

Sorry, i didn't understand this? (i'm a linux newbie)
I assume your host fpc is in /usr/bin, so it's:
Code: Bash  [Select][+][-]
  1. $ sudo ln -s /usr/local/lib/fpc/ppcross386 /usr/bin/
Verify by calling fpc -Pi386 -Twin32, fpc should be able to execute ppcross386 and display the help output.

Kralle

  • New Member
  • *
  • Posts: 23
Re: Crosscompiling Mint 17.3 --> Win32/64
« Reply #7 on: February 14, 2016, 07:19:55 pm »
Hello,

Quote from: Leledumbo
Yes, read the note. The first sentence contains copy-paste-able line that you can write into your fpc.cfg. I suggest making the file writable unless you prefer to always prefixing your editing command with sudo.
okay, i do this.

Quote from: Leledumbo
I assume your host fpc is in /usr/bin, so it's:
Code: Bash  [Select][+][-]
  1. $ sudo ln -s /usr/local/lib/fpc/ppcross386 /usr/bin/
okay, i do this.
Quote from: Leledumbo
Verify by calling fpc -Pi386 -Twin32, fpc should be able to execute ppcross386 and display the help output.

This is the output  :'(
Quote
laz-user@laz-book /usr/local/lib/fpc/3.0.0 $ fpc -Pi386 -Twin32
Free Pascal Compiler version 3.0.0 [2016/02/14] for i386
Copyright (c) 1993-2015 by Florian Klaempfl and others
Fatal: No source file name in command line
Fatal: Compilation aborted
Error: /usr/bin/ppcross386 returned an error exitcode
laz-user@laz-book /usr/local/lib/fpc/3.0.0 $

After this i do a restart from linux, but the result is the same.

If i start Lazarus and switch to "Win32" an press F9, the result is the same as in my first post.

I didn't understand what wrong is.

Greeting
Heiko

Leledumbo

  • Hero Member
  • *****
  • Posts: 8757
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Crosscompiling Mint 17.3 --> Win32/64
« Reply #8 on: February 14, 2016, 07:25:02 pm »
This is the output  :'(
Quote
laz-user@laz-book /usr/local/lib/fpc/3.0.0 $ fpc -Pi386 -Twin32
Free Pascal Compiler version 3.0.0 [2016/02/14] for i386
Copyright (c) 1993-2015 by Florian Klaempfl and others
Fatal: No source file name in command line
Fatal: Compilation aborted
Error: /usr/bin/ppcross386 returned an error exitcode
laz-user@laz-book /usr/local/lib/fpc/3.0.0 $
That's correct output, I was wrong it shouldn't display the help page.
After this i do a restart from linux, but the result is the same.
No need, neither of the commands change OS related things. It's not Windows where restart might solve problems magically.
If i start Lazarus and switch to "Win32" an press F9, the result is the same as in my first post.

I didn't understand what wrong is.

Greeting
Heiko
I just realized, the note was missing two characters. Instead of:
-Fu/usr/local/lib/fpc/$fpcversion/units/$fpctarget
you should add:
-Fu/usr/local/lib/fpc/$fpcversion/units/$fpctarget/*
to fpc.cfg.
« Last Edit: February 14, 2016, 07:27:59 pm by Leledumbo »

Kralle

  • New Member
  • *
  • Posts: 23
Re: Crosscompiling Mint 17.3 --> Win32/64
« Reply #9 on: February 14, 2016, 07:59:10 pm »
Hello,

Quote from: Leledumbo
I just realized, the note was missing two characters. Instead of:
-Fu/usr/local/lib/fpc/$fpcversion/units/$fpctarget
you should add:
-Fu/usr/local/lib/fpc/$fpcversion/units/$fpctarget/*
to fpc.cfg.

okay, i change the line, but i become this: error.jpg.

Is there something to do in lazarus for me?

Greeting
Heiko

Leledumbo

  • Hero Member
  • *****
  • Posts: 8757
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Crosscompiling Mint 17.3 --> Win32/64
« Reply #10 on: February 14, 2016, 08:03:47 pm »
That's still not right as the compiler can't find unit Windows which should reside in the directory pointed by that -Fu. Confirm the existence of the file in /usr/local/lib/fpc/$fpcversion/units/$fpctarget/rtl/, replace $fpcversion and $fpctarget accordingly, there should be windows.ppu and windows.o. If you're on 64-bit Linux, don't forget to change Target CPU Family to i386.

Kralle

  • New Member
  • *
  • Posts: 23
Re: Crosscompiling Mint 17.3 --> Win32/64
« Reply #11 on: February 14, 2016, 08:10:40 pm »
Hello,

That's still not right as the compiler can't find unit Windows which should reside in the directory pointed by that -Fu. Confirm the existence of the file in /usr/local/lib/fpc/$fpcversion/units/$fpctarget/rtl/, replace $fpcversion and $fpctarget accordingly, there should be windows.ppu and windows.o. If you're on 64-bit Linux, don't forget to change Target CPU Family to i386.

for today i say:"Thanks." Tomorrow: I will look for the Error again. Good Night.

Bye
Heiko

Kralle

  • New Member
  • *
  • Posts: 23
Re: Crosscompiling Mint 17.3 --> Win32/64
« Reply #12 on: February 16, 2016, 12:18:28 pm »
Hello,

here I am again.

Win32 works. :D
But Win64 doesn't.  :'(

Where is my mistake?

Greeting
Heiko

Leledumbo

  • Hero Member
  • *****
  • Posts: 8757
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Crosscompiling Mint 17.3 --> Win32/64
« Reply #13 on: February 16, 2016, 01:09:10 pm »
Win32 works. :D
But Win64 doesn't.  :'(

Where is my mistake?
Build the toolchain for win64 as well, the first article already mentioned that.

Kralle

  • New Member
  • *
  • Posts: 23
Re: Crosscompiling Mint 17.3 --> Win32/64
« Reply #14 on: February 16, 2016, 02:16:43 pm »
Hello,

Quote from: Leledumbo
Build the toolchain for win64 as well, the first article already mentioned that.

upps, i forgot this.
Now i do this, but i become this error-message:
Quote
Error: Invalid Compiler: file "usr/local/bin/ppcx64" does not exist.

in the directory is a symlink, but it is defined as "faulty".
Who do i create a good symlink?
Code: [Select]
sudo ln -s /usr/local/lib/fpc/3.0.0/ppcx64 /usr/local/bin/ doesnt' work. the symlink is faulty.

Greetings
Heiko


« Last Edit: February 16, 2016, 04:29:15 pm by Kralle »

 

TinyPortal © 2005-2018