Sign in Join

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

Mailing lists / fpc-pascal / 2016-09

Linking to Linux on a FreeBSD system with Linux emulated ?

38 messages · 7 people · –

Reply by email Subscribe to this list Your subscription

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

fredvs

Hello.

In a FreeBSD 64 system with Linux emulated, fpc-linux compiles without problems but at linking there is that message:

... Linking /usr/bin/ld: unrecognizer emulation mode: elf_x86_64 Supported emulation: elf_x86_64_fbsd and elf_i386_fbsd

In ld documentation there is:

-memulation
Emulate the emulation linker. You can list the available emulations with the `--verbose' or `-V' options. If the `-m' option is not used, the emulation is taken from the LDEMULATION environment variable, if that is defined. Otherwise, the default emulation depends upon how the linker was configured.

Could it be possible to change the default emulation used by ld while linking ?

Many thanks.

Fre;D

-----
Many thanks ;-)

View this message in context: http://free-pascal-general.1045716.n5.nabble.com/Linking-to-Linux-on-a-FreeBSD-system-with-Linux-emulated-tp5726205.html Sent from the Free Pascal - General mailing list .
Jonas Maebe
to fredvs
fredvs wrote
Could it be possible to change the default emulation used by ld while linking ?

With fpc's -k parameter, you can pass parameters directly to the linker. If you need to pass multiple parameters, use -k several times (e.g. -k-para1 -kvalue1)

Jonas

fredvs
to Jonas Maebe
With fpc's -k parameter, you can pass parameters directly to the linker. If you need to pass multiple parameters, use -k several times (e.g.-k-para1 -kvalue1)

Wow, many thanks Jonas.

I will try it and write you the result.

But, imagine, with FreeBSD, you could:
Compile and run on same system (no need virtual-box to test it):
- FreeBSD 64 bit programs.
- FreeBSD 32 bit programs.
- Linux 64 bit programs.
- Linux 32 bit programs.
- Windows 64 bit programs (via wine).
- Windows 32 bit programs (via wine).
- Maybe other program-system too (via emulator).

Fre;D

-----
Many thanks ;-)

Sven Barth
to fredvs
"fredvs" wrote 18 lines
> With fpc's -k parameter, you can pass parameters directly to the linker. > If you need to pass multiple parameters, use -k several times > (e.g.-k-para1 -kvalue1) Wow, many thanks Jonas. I will try it and write you the result. But, imagine, with FreeBSD, you could: Compile and run on same system (no need virtual-box to test it): - FreeBSD 64 bit programs. - FreeBSD 32 bit programs. - Linux 64 bit programs. - Linux 32 bit programs. - Windows 64 bit programs (via wine). - Windows 32 bit programs (via wine). - Maybe other program-system too (via emulator).

Keep in mind however that such emulators are never perfect and thus it might be necessary nevertheless to test on a real system.

Regards,
Sven

Graeme Geldenhuys
to Sven Barth
Sven Barth wrote
Keep in mind however that such emulators are never perfect and thus it might be necessary nevertheless to test on a real system.

Linux support under FreeBSD is actually a full install of CentOS 6. So in theory there should be issues testing a linux program under FreeBSD. But yes, I still prefer actual VMs of each OS.

Regards,
Graeme

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ My public PGP key: http://tinyurl.com/graeme-pgp
Marc Santhoff
to fredvs: Wow, many thanks Jonas. I will try it and write you the result. But, imagine, with…
fredvs wrote 17 lines
> With fpc's -k parameter, you can pass parameters directly to the linker. > If you need to pass multiple parameters, use -k several times > (e.g.-k-para1 -kvalue1) Wow, many thanks Jonas. I will try it and write you the result. But, imagine, with FreeBSD, you could: Compile and run on same system (no need virtual-box to test it): - FreeBSD 64 bit programs. - FreeBSD 32 bit programs. - Linux 64 bit programs. - Linux 32 bit programs. - Windows 64 bit programs (via wine). - Windows 32 bit programs (via wine). - Maybe other program-system too (via emulator).

See Greames message for why you still will have to use the Linux ld. Your error message clearly says, the FreeBSD linker can only create bfsd code for i386 and x64.

Supported emulation: elf_x86_64_fbsd and elf_i386_fbsd

Have a look for brandelf(1), btw. You'll need it. And "man linux" will tell some stories, too.

HTH,
Marc

fredvs
to Marc Santhoff: See Greames message for why you still will have to use the Linux ld. Your error message…
Show quoted text 5 lines
See Greames message for why you still will have to use the Linux ld. Your error message clearly says, the FreeBSD linker can only create bfsd code for i386 and x64. > Supported emulation: elf_x86_64_fbsd and elf_i386_fbsd

Yes, before to sent that topic, I have try with the Linux ld and... in fact it is absolutely the same file than ld-freebsd. (same size, same date).

And using ld-linux gives the same message:

> Supported emulation: elf_x86_64_fbsd and elf_i386_fbsd

So, maybe, (I do not know *ld*), like Jonas said, *ld *needs parameters to change default elf.
But yes, the best is to try it. And asap. I will try to find time tonight.

Many thanks.

Fre;D

-----
Many thanks ;-)

fredvs
to Graeme Geldenhuys: Linux support under FreeBSD is actually a full install of CentOS 6. So in theory there…
But yes, I still prefer actual VMs of each OS.

Me too if I had a powerful machine.
But on a slow netbook, the fotal-emulator of FreeBSD is a perfect solution.

Fre;D

-----
Many thanks ;-)

Pierre Free Pascal
to fredvs: Yes, before to sent that topic, I have try with the Linux ld and... in fact it is…
Show quoted text 29 lines
-----Message d'origine----- De : [mailto:fpc-pascal- De la part de fredvs Envoyé : jeudi 1 septembre 2016 22:55 À : Objet : Re: [fpc-pascal] Linking to Linux on a FreeBSD system with Linux emulated ? > See Greames message for why you still will have to use the Linux ld. > Your error message clearly says, the FreeBSD linker can only create bfsd > code for i386 and x64. >> Supported emulation: elf_x86_64_fbsd and elf_i386_fbsd Yes, before to sent that topic, I have try with the Linux ld and... in fact it is absolutely the same file than ld-freebsd. (same size, same date). And using ld-linux gives the same message: >> Supported emulation: elf_x86_64_fbsd and elf_i386_fbsd So, maybe, (I do not know *ld*), like Jonas said, *ld *needs parameters to change default elf. But yes, the best is to try it. And asap. I will try to find time tonight.

What you need here is a multi-target linker,
you can get getting the GNU binutils sources
and running configure with the options:
--enable-targets=all
combined with a second option to also enabled 64-bit targets needed only if you are compiling on a 32-bit target which is: --enable-64-bit-bfd

Pierre

Marc Santhoff
to fredvs: Yes, before to sent that topic, I have try with the Linux ld and... in fact it is…
fredvs wrote 17 lines
> See Greames message for why you still will have to use the Linux ld. > Your error message clearly says, the FreeBSD linker can only create bfsd > code for i386 and x64. >> Supported emulation: elf_x86_64_fbsd and elf_i386_fbsd Yes, before to sent that topic, I have try with the Linux ld and... in fact it is absolutely the same file than ld-freebsd. (same size, same date). And using ld-linux gives the same message: >> Supported emulation: elf_x86_64_fbsd and elf_i386_fbsd So, maybe, (I do not know *ld*), like Jonas said, *ld *needs parameters to change default elf. But yes, the best is to try it. And asap. I will try to find time tonight.

Sorry, I can't help you much with that, ld-linux is not installed here and I don't know which package it is from.

But many binaries are links to the original binary which, when started, check under what name they were started and behave accordingly. So the fact that it's the same binary does not mean it cannot do the job.

Try asking it what options in knows with --help or -h or whatever works. And have a look at the man page with "man ld-linux".

If all that gives not enough hints you could go to www.freebsd.org and look in the at the documentation. The handbook and maybe the developers handbook or FAQ may help.

HTH somehow,
Marc

fredvs
to Marc Santhoff: Sorry, I can't help you much with that, ld-linux is not installed here and I don't know…
Sorry, I can't help you much with that, ld-linux is not installed here and I don't know which package it is from.

Huh, is it possible to install Linux packages (apt-get install something) in a FreeBSD system ?
Or do you mean (like I did), copy ld-linux from a installed Linux system. ?

Thanks.

Fre;D

-----
Many thanks ;-)

Marc Santhoff
to fredvs
fredvs wrote 6 lines
> Sorry, I can't help you much with that, ld-linux is not installed here > and I don't know which package it is from. Huh, is it possible to install Linux packages (apt-get install something) in a FreeBSD system ? Or do you mean (like I did), copy ld-linux from a installed Linux system. ?

Sorry for being terse. A package in this context is a pre-compiled binary port on FreeBSD. So I should have written "which FreeBSD package".

For relevant ports see there:

https://www.freebsd.org/ports/linux.html

Most of those are installable without compiling by using pkg(1).

<https://www.freebsd.org/cgi/man.cgi?query=pkg&apropos=0&sektion=0&manpath=FreeBSD+10.3-RELEASE+and+Ports&arch=default&format=html>

Marc

fredvs
to Marc Santhoff

Hello.

The night was very long and hard...

I have some result.

Here how I did:

- Copy ld-linux into /compat/linux/bin

- Copy dependencies-linux needed by ld-linux (some needed to be in /compat/linux/lib, other in /compat/linux/lib64).

- When using fpc-linux to compile-link a simple fpgui-programe, compilation is ok, linking begin but after 3 minutes, there is a message from fpc.

Error (9014) Can't call the linker, switching to external linking Error (9013) Error while linking.

So i tried to link manually all the compiled files in /units to see what appends with:

-> /compat/linux/bin/ld -o /compat/linux/lib/crt0.o /usr/test/units/test.o -lc

And there is that error message:

<http://free-pascal-general.1045716.n5.nabble.com/file/n5726229/crossfbsdlin.jpg>

Do you have a idea what is wrong ?

Many thanks.

Fre;D

-----
Many thanks ;-)

fredvs
to Marc Santhoff: Sorry for being terse. A package in this context is a pre-compiled binary port on…

Hello Marc.

Thanks for the infos, good to know that it is possible to install linux package via FreeBSD-pkg install.
Sadly I did not see any linux-ld or linux-binutils package in https://www.freebsd.org/ports/linux.html

So, the manually way that i did is the only way (yes/no ?).

Many thanks for your infos.

Fre;D

-----
Many thanks ;-)

Marc Santhoff
to fredvs: Hello. The night was very long and hard... I have some result. Here how I did: - Copy…
fredvs wrote 30 lines
Hello. The night was very long and hard... I have some result. Here how I did: - Copy ld-linux into /compat/linux/bin - Copy dependencies-linux needed by ld-linux (some needed to be in /compat/linux/lib, other in /compat/linux/lib64). - When using fpc-linux to compile-link a simple fpgui-programe, compilation is ok, linking begin but after 3 minutes, there is a message from fpc. > Error (9014) Can't call the linker, switching to external linking > Error (9013) Error while linking. So i tried to link manually all the compiled files in /units to see what appends with: -> /compat/linux/bin/ld -o /compat/linux/lib/crt0.o /usr/test/units/test.o -lc And there is that error message: <http://free-pascal-general.1045716.n5.nabble.com/file/n5726229/crossfbsdlin.jpg> Do you have a idea what is wrong ?

Not very precise, but the error "undefinded reference to ..." tells you it can't find something, that should be there. And since $FPG_MAIN is the first I assume you will have to pass a list of paths to ld helping it finding the .o files missing.

There are ways to see the path list the compiler hands over to the linker - which others will have to show you because I don't know how - and then you can use that path list to tell the linker while trying manually.

Marc

Marc Santhoff
to fredvs: Hello Marc. Thanks for the infos, good to know that it is possible to install linux…
fredvs wrote
Hello Marc.

Hi Fred.

Show quoted text 6 lines
Thanks for the infos, good to know that it is possible to install linux package via FreeBSD-pkg install. Sadly I did not see any linux-ld or linux-binutils package in https://www.freebsd.org/ports/linux.html So, the manually way that i did is the only way (yes/no ?).

Were reaching the end of my wisdom here. ;)

I know linux programs can be compiled on FreeBSD, but I do not know the details. I'd suggest asking on one of the freebsd mailing lists or some forum. You find them via the main page of the web site of freebsd in the "community" menu.

Good luck,
Marc

fredvs
to Marc Santhoff: Not very precise, but the error "undefinded reference to ..." tells you it can't find…

Hello Marc.

And thanks to help.

OK, I have investigate more and there is something that disturb me:

When compiling on a FreeBSD 64 bit system using fpc-freebsd-*64*, there is that message on linking:

[3.069] Searching file /usr/bin/ld... found
[3.069] Using util /usr/bin/ld
[3.069] Executing "/usr/bin/ld -b elf64-x86-64-freebsd -m elf64-x86-64_fbsd -L. -o ./test ./link.res" *with fpSystem call*
[3.960] 62 lines compiled, 4.0 sec
[3.972] 2 hint(s) issued

OK, it works.

When compiling on a FreeBSD 64 bit system using fpc-freebsd-*32* there is that message on linking:

[3.069] Searching file /usr/bin/ld... found
[3.069] Using util /usr/bin/ld
[3.069] Executing "/usr/bin/ld -b elf32-i386-freebsd -m elf32-i386-freebsd -L. -o ./test ./link.res" *with fpSystem call*
[3.960] 62 lines compiled, 4.0 sec
[3.972] 2 hint(s) issued

OK, it works.

When compiling on a FreeBSD 64 bit system using fpc-freebsd-*32*, there is that message on linking:

3.069] Searching file /usr/bin/ld... found
[3.069] Using util /usr/bin/ld
[3.069] Executing "/usr/bin/ld -b elf32-i386-freebsd -m elf_i386_fbsd -L. -o ./test ./link.res" *with fpSystem call*
[3.960] 62 lines compiled, 6.0 sec
[3.972] 2 hint(s) issued

OK, it works.

But when compiling on a FreeBSD 64 bit system using fpc-*linux-64*, there is that message on linking:

[4.438] Searching file /bin/ld... found
[4.438] Using util /bin/ld
[4.438] Executing "/bin/ld" with command line "-b elf64-x86-64 -m elf_x86_64 *--dynamic-linker=/lib64/ld-linux-x86-64.so
.2* -L. -o ./test ./link.res"
/bin/ld: warning: ./link.res contains output sections; did you forget -T? [246.930] test.pas(62,1) Error: Can't call the linker, switching to external linking
[246.930] test.pas(62,1) Error: Error while linking [246.930] test.pas(62,1) Fatal: There were 2 errors compiling module, stopping
[247.070] Fatal: Compilation aborted

So the question is:
What define in fpc.cfg --->
*with fpSystem call*
vs
*--dynamic-linker=/lib64/ld-linux-x86-64.so.2*

This because I want to try when linking using fpc-linux:

[4.438] Executing "/bin/ld" with command line "-b elf64-x86-64 -m elf_x86_64 *with fpSystem call* -L. -o ./test ./link.res"

Many thanks.

Fre;D

-----
Many thanks ;-)

fredvs
to Marc Santhoff: Hi Fred. Were reaching the end of my wisdom here. ;) I know linux programs can be…
I'd suggest asking on one of the freebsd mailing lists or some forum.

Hum, we are very near the goal, I prefer to resolve it with fpc-family ;-)

Fre;D

-----
Many thanks ;-)

Marc Santhoff
to fredvs: Hello Marc. And thanks to help. OK, I have investigate more and there is something that…
fredvs wrote
Hello Marc. And thanks to help.

You're welcome.

[...]

Show quoted text 26 lines
But when compiling on a FreeBSD 64 bit system using fpc-*linux-64*, there is that message on linking: [4.438] Searching file /bin/ld... found [4.438] Using util /bin/ld [4.438] Executing "/bin/ld" with command line "-b elf64-x86-64 -m elf_x86_64 *--dynamic-linker=/lib64/ld-linux-x86-64.so .2* -L. -o ./test ./link.res" /bin/ld: warning: ./link.res contains output sections; did you forget -T? [246.930] test.pas(62,1) Error: Can't call the linker, switching to external linking [246.930] test.pas(62,1) Error: Error while linking [246.930] test.pas(62,1) Fatal: There were 2 errors compiling module, stopping [247.070] Fatal: Compilation aborted So the question is: What define in fpc.cfg ---> *with fpSystem call* vs *--dynamic-linker=/lib64/ld-linux-x86-64.so.2* This because I want to try when linking using fpc-linux: [4.438] Executing "/bin/ld" with command line "-b elf64-x86-64 -m elf_x86_64 *with fpSystem call* -L. -o ./test ./link.res"

I don't know about the *with fpSystem call* problem, but the other is solvable using

"fpc -k --dynamic-linker=/lib64/ld-linux-x86-64.so.2 ..."

as Jonas pointed out already.

Marc

fredvs
to Marc Santhoff

Hello Marc, it is me again ;-)

I don't know about the *with fpSystem call* problem, but the other is

solvable using

"fpc -k --dynamic-linker=/lib64/ld-linux-x86-64.so.2 ..." as Jonas pointed out already.

Of course, I tried this but... adding -ksomething -kotherthing did not change anything in the parameters given by fpc to the linker.

The result is still:
[4.438] Executing "/bin/ld" with command line "-b elf64-x86-64 -m elf_x86_64 --dynamic-linker=/lib64/ld-linux-x86-64.so
.2 -L. -o ./test ./link.res"

I'd suggest asking on one of the freebsd mailing lists or some forum.

There is a answer there (but not sure I understand, what is "linuxolator" ?) :
https://forums.freebsd.org/threads/57511/
<https://forums.freebsd.org/threads/57511/>

And for a other problem with fpc, no aswer yet...
https://forums.freebsd.org/threads/57520/
<https://forums.freebsd.org/threads/57520/>

Many thanks to help.

Fre;D

-----
Many thanks ;-)

fredvs
to fredvs

Yep, this one I get it.

This fpc parameter (that I was using) is not compatible for cross compiling: -*XX* (Link smart).

Without this, fpc can compil FreeBSD 32 bit applications on a FreeBSD 64 bit system and those 32 bit applications can run. ;-)

Now, what is still missing is to compil Linux applications on a FreeBSD 64 bit system.

In FreeBSD forum they explain that FreeBSD 64 bit can run Linux 64 bit applications (I am able too) but can only link Linux 32 bit applications (that cannot be run on a FreeBSD 64 bit system).

But they work on make run Linux 32 bit applications too.

So, I will shill out and wait for FreeBSD update.

Many thanks for help.

Fre;D

-----
Many thanks ;-)

Marc Santhoff
to fredvs: Hello Marc, it is me again ;-) solvable using Of course, I tried this but... adding…
fredvs wrote
There is a answer there (but not sure I understand, what is "linuxolator" ?)

The Linuxolator is a freebsd specific term for the linux binary emulation on freebsd.

AFAIK it is done by implementing a small layer between the linux libraries and programs and the freebsd kernel. This small layer does nothing more than forming a linux kernel api and translating linux kernel calls to the freebsd equivalent.

See there for more details and in depth explanations: https://www.freebsd.org/doc/en/articles/linux-emulation/article.html

HTH,
Marc

fredvs
to Marc Santhoff

Thanks Marc for that clear explanation, I knew linux emulation, of course, but not that nickname.

By the way, if you are using a FreeBSD 32 bit system, did you try to compile a fpc application with smart link enabled (*-XX* parameter) ?

With fpc 3.0.0, on my system, the smart-link is wrong, it calls ld-elf.so.1 in place of ld-elf*32*.so.1.

That does not appends with fpc-linux 32.

Fre;D

-----
Many thanks ;-)

Marc Santhoff
to fredvs
fredvs wrote 5 lines
Thanks Marc for that clear explanation, I knew linux emulation, of course, but not that nickname. By the way, if you are using a FreeBSD 32 bit system, did you try to compile a fpc application with smart link enabled (*-XX* parameter) ?

No, I didn't. I only compile native programs. Even worse, when compiling for Windows I do start Windows. ;)

Regards,
Marc

Marc Santhoff
to fredvs
fredvs wrote 6 lines
> No, I didn't. I only compile native programs. Huh, it is what I wanted to ask... Did you try to compile on a native FreeBSD 32 bit using -XX parameter (smart link).

No, I have no FreeBSD 32 Bit at hand, sorry.

Marc

Graeme Geldenhuys
to fredvs: Yep, this one I get it. This fpc parameter (that I was using) is not compatible for cross…
fredvs wrote
In FreeBSD forum they explain that FreeBSD 64 bit can run Linux 64 bit applications (I am able too) but can only link Linux 32 bit applications (that cannot be run on a FreeBSD 64 bit system).

That's weird. On my 64-bit FreeBSD, I can't run 64-bit Linux applications, but can run 32-bit Linux applications. So I'm experiencing a bit of the opposite to you then. :-/

Regards,
Graeme

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ My public PGP key: http://tinyurl.com/graeme-pgp
Graeme Geldenhuys
to fredvs: Thanks Marc for that clear explanation, I knew linux emulation, of course, but not that…
fredvs wrote
With fpc 3.0.0, on my system, the smart-link is wrong, it calls ld-elf.so.1 in place of ld-elf*32*.so.1.

My 32-bit FreeBSD VM only has FPC 2.6.2, but on it I managed to compile and use -XX -Xs -O2 compiler parameters without problems.

[goofy] ~/devel/wiki> fpc @fpc.cfg -XX -Xs -O2 scms.pas Free Pascal Compiler version 2.6.2 [2013/02/06] for i386 Copyright (c) 1993-2012 by Florian Klaempfl and others Target OS: FreeBSD/ELF for i386
Compiling scms.pas
...snip...
htmout.pas(78,3) Note: Local variable "k" not used Linking wiki.cgi
19691 lines compiled, 2.8 sec
11 warning(s) issued
6 note(s) issued

Unfortunately I don't have any other 32-bit FreeBSD VM where I can install FPC 3.0.0 on.

Regards,
Graeme

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ My public PGP key: http://tinyurl.com/graeme-pgp
Giuliano Colla
to Graeme Geldenhuys

Il 09/09/2016 10:17, Graeme Geldenhuys ha scritto:

Unfortunately I don't have any other 32-bit FreeBSD VM where I can install FPC 3.0.0 on.

I know that you don't like automated scripts, but you should consider fpcup (or fpclazup), in order to experiment with different fpc/Lazarus versions.

You may safely use without messing up your setup, because it provides an installation of fpc (and Lazarus) completely independent of your main installation, in a "sandbox" path. As it provides a number of nice tricks to keep it completely independent, you may use as it is, or just use it to look at the tricks, and then create your own scripts.

Just my 2c

Giuliano

Marc Santhoff
to Graeme Geldenhuys: That's weird. On my 64-bit FreeBSD, I can't run 64-bit Linux applications, but can run…
Graeme Geldenhuys wrote 8 lines
On 2016-09-05 05:02, fredvs wrote: > In FreeBSD forum they explain that FreeBSD 64 bit can run Linux 64 bit > applications (I am able too) but can only link Linux 32 bit applications > (that cannot be run on a FreeBSD 64 bit system). That's weird. On my 64-bit FreeBSD, I can't run 64-bit Linux applications, but can run 32-bit Linux applications. So I'm experiencing a bit of the opposite to you then. :-/

Without an error message one can only guess what happened... ;) Maybe you forgot to "brandelf -T Linux" the freshly compiled program?

Marc

fredvs
to Graeme Geldenhuys: That's weird. On my 64-bit FreeBSD, I can't run 64-bit Linux applications, but can run…
That's weird. On my 64-bit FreeBSD, I can't run 64-bit Linux applications, but can run 32-bit Linux applications. So I'm experiencing a bit of the opposite to you then. :-/

Huh, and on my 64-bit FreeBSD I can run fpc-linux 64 bit but not fpc-linux 32 bit !

Fre;D

-----
Many thanks ;-)

fredvs
to Graeme Geldenhuys: My 32-bit FreeBSD VM only has FPC 2.6.2, but on it I managed to compile and use -XX -Xs…
Unfortunately I don't have any other 32-bit FreeBSD VM where I can install

FPC 3.0.0 on.

Hum, for me the simplest and working way to install fpc 32 bit was from... official fpc download site:

http://www.freepascal.org/down/i386/freebsd.var

--> unzip the file + sh install.sh --> done and working ;-)

Fre;D

-----
Many thanks ;-)

fredvs
to Graeme Geldenhuys: That's weird. On my 64-bit FreeBSD, I can't run 64-bit Linux applications, but can run…

Graeme Geldenhuys-6 wrote

That's weird. On my 64-bit FreeBSD, I can't run 64-bit Linux applications, but can run 32-bit Linux applications. So I'm experiencing a bit of the opposite to you then. :-/

Hello Graeme.

Did you add, in your /boot/loader.conf:

linux64_load="YES"

PS: You need this kernel: /boot/kernel/linux64.ko

PS2: I wonder that you are able to run 32 bit Linux apps... (hum, how did you do ? )

Fre;D

-----
Many thanks ;-)

fredvs
to fredvs

Gooooaaal.

$ uname -a
----> FreeBSD 10.3-RELEASE #0 amd64

$ /usr/local/lib/fpc/3.0.0/ppcx64_linux test.pas
--->
Free Pascal Compiler version 3.0.0 [2015/11/20] for x86_64 Copyright (c) 1993-2015 by Florian Klaempfl and others (1002) Target OS: Linux for x86-64
(3104) Compiling /usr/local/share/ideu/prj_test/test.pas ...
(9015) Linking ./test
/usr/bin/ld: warning: ./link.res contains output sections; did you forget -T?
(1008) 53964 lines compiled, 9.8 sec
(1021) 51 warning(s) issued
(1022) 319 hint(s) issued
(1023) 32 note(s) issued

---> Tested that X graphic application on a Linux 64 bit and it works. ;-)

Now, last thing, is to make that Linux graphic application run by the FreeBSD system (because it fails to run.)
But that is a other story and is no more the problem of fpc.

To resume:

On a FreeBSD 64 bit system, you may, thanks to fpc, without virtual machine:
- Compile and run 64 bit FreeBSD applications.
- Compile and run 32 bit FreeBSD applications.
- Compile and run 32 bit Windows applications.
- Compile (and run) 64 bit Linux applications.

Sure that with some more white nights you could:
- Compile and run 64 bit Windows applications.
- Compile and run 32 bit Linux applications.

Well done, one more time, fpc.

Many, many thanks for your perfect help.

PS: On new polYdev release, all that will work out of the box.

Fre;D

-----
Many thanks ;-)

Graeme Geldenhuys
to fredvs: Graeme Geldenhuys-6 wrote Hello Graeme. Did you add, in your /boot/loader.conf:…
fredvs wrote
Did you add, in your /boot/loader.conf: linux64_load="YES"

No, I don't have any linux[32|64]_load="YES" entries in my loader.conf

PS: You need this kernel: /boot/kernel/linux64.ko

Interestingly, kldstat output shows I have a linux.ko and linux64.ko module loaded.

PS2: I wonder that you are able to run 32 bit Linux apps... (hum, how did you do ? )

The FreeBSD I'm running was originally FreeBSD 9.0, and I've upgraded (not fresh installed) my OS after every FreeBSD release up to the current 10.3. I don't believe Linux 64-bit support was available back in FreeBSD 9.0 days, only 32-bit support. Maybe that is why 32-bit Linux binaries still work - I don't know. :-)

Either way, I'm not too bothered - I don't really need to run much Linux applications these days. Only the Beyond Compare 3 Linux binary, as they don't support FreeBSD at this point.

Regards,
Graeme

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ My public PGP key: http://tinyurl.com/graeme-pgp