Forum > Linux
Howto - Cross compile win7-64 to Linux (centos)
jack616:
If you want to do this you may find this worth a read:
I had planned to follow leleedumbo's advice and compile linux to windows but centos had me running round in circles as linux does ... so I went back to a windows to linux cross compile.
This is what I'm doing:
Windows7-64 to centos 6(final)-64 using the Typhon(5.2) install on windows compiling for GTK2
X86_64 on a dual boot system.
This started out bad but there is one piece of information that fixes everything - it took me a long time
to find it but once I had it everything went like a dream. Everyone seems to have the same library problem
but no one ever seems to make the fixes specific and clear anywhere -
1. Install typhon/lazarus with a full compile and ensure the batch menu option 12 is run and
the crossbuild options are right in the typhon (not lazarus IDE) are set right. (I dont know if that's
essential when you do a full typhon build but I did it so I'm reporting it)
2. Go to paragons web site and install their (free) EXT file reader - this reads ext4 but doesnt write - not a problem.
Give this some time to kick in - it doesnt seem to work right away and wants to scan the EXT4 main tree later.
3. In lazarus projects options configure in addtions & overrides for your LCLWidget (GTK2 in my case)
4. In config & target set target OS to linux and Target CPU family to X86_64
5. I've seen talk of -Xd being needed for the linker - I havn't needed to do that or link smart or anything like that.
6. Create a simple form with just a close button on it for testing and save the project.
7. Click build. This will attempt to find libraries in your linux partition.
You will get a load of linker errors for files not found - just keep clicking build as you clear them.
For me it was just 3 directories - add them to your libraries list in the project options:
f:\usr\lib64\
f:\lib64\
f:\usr\lib\gcc\x86_64-redhat-linux\4.4.4\
The reason the paths look like windows is just how the (rather impressive) paragon driver translates them.
8. click build again and you will probably get linker errors for2 not found files - then go mad because they
are exactly where the linker says they are.
The two most people seem to complain about are:
/lib64/libpthread.so.0
/usr/lib64/libpthread_nonshared.a
9. The big trick I found was to edit the root .so file that controls these libraries. This turns out to be a simple
ldd text file - in linux locate the file libpthread.so and edit the GROUP line to remove the paths
from the files in brackets giving something like:
GROUP ( libpthread.so.0 libpthread_nonshared.a )
The search paths are the problem not the files- even though the path is correct.
10. click build and you may get one more link error - same as 9 above for libc
look for file libc.so (probably in /lib64) and do the same as above - remove the paths.
Compile and test your program on centos - it should run fine.
If anyone wants to do a precis of that please feel free.
All I have to do now is find out which widgets work with gtk and which dont - is there a list anywahere?
(Typhon tends to spoil you by installing everything and the ships cat)
I hope that is useful to someone.
Once you know about the path edit everything seems pretty simple.
jack
marcov:
--- Quote from: jack616 on March 17, 2015, 03:10:07 pm ---5. I've seen talk of -Xd being needed for the linker - I havn't needed to do that or link smart or anything like that.
--- End quote ---
Recent versions of the binutils on most *nix distributions skip versions for other architectures, and the auto-added paths are not a problem.
-Xd is a parameter for when that isn't the case.
userx-bw:
--- Quote from: marcov on March 17, 2015, 04:22:43 pm ---
--- Quote from: jack616 on March 17, 2015, 03:10:07 pm ---5. I've seen talk of -Xd being needed for the linker - I havn't needed to do that or link smart or anything like that.
--- End quote ---
Recent versions of the binutils on most *nix distributions skip versions for other architectures, and the auto-added paths are not a problem.
-Xd is a parameter for when that isn't the case.
--- End quote ---
what is this new thing I am now reading about ??
typhon aka CodeTyphon??
Install typhon/lazarus with a full compile and ensure the batch menu option 12 is run and
the crossbuild options are right in the typhon (not lazarus IDE) are set right. (I dont know if that's
essential when you do a full typhon build but I did it so I'm reporting it)
Jungle:
When I try to cross-compile x86_64 to linux, I get the following error:
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---Compile package FCL 1.0.1: Exit code 1, Errors: 1math.pp(11,71) Error: Internal error 200208151
which points me to the bug-report with comment:
--- Quote ---Cross-compiling from Win64 to other x86 platforms is not supported due to a lack of 80 bits extended floating point support.
--- End quote ---
I'm confused.
PascalDragon:
--- Quote from: Jungle on April 09, 2021, 03:34:05 pm ---When I try to cross-compile x86_64 to linux, I get the following error:
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---Compile package FCL 1.0.1: Exit code 1, Errors: 1math.pp(11,71) Error: Internal error 200208151
which points me to the bug-report with comment:
--- Quote ---Cross-compiling from Win64 to other x86 platforms is not supported due to a lack of 80 bits extended floating point support.
--- End quote ---
I'm confused.
--- End quote ---
All x86 targets (no matter if 16-, 32- or 64-bit) make use of the 80-bit Extended floating point type except for one: Win64. If you want to compile for a target that uses Extended (aka any x86 target that is not Win64) you need to be able to do that and the Win64 compiler simply can't. This is the main reason that the FPC team does not provide a native Win64 compiler, because with that you essentially can't compile for any other x86_64 target.
Solution: use the Win32 compiler to compile for x86_64-linux.
Navigation
[0] Message Index
[#] Next page