Open kgardas opened 4 years ago
On 2020-04-28, at 6:51 AM, kgardas notifications@github.com wrote:
It would be great if there is also ppc64le/power platform supported.
https://tenor.com/view/onemilliondollars-gif-4123675
tim Rowledge; tim@rowledge.org; http://www.rowledge.org/tim There can never be a computer language in which you cannot write a bad program.
And which operating system?
This is per se a good idea. Alas, as the other comments succinctly point out, we have limited resources in the community. This means we have neither hardware nor people nor enought knowledge (yet) to pursue that.
However, maybe we could salvage some parts from Self? š¤
If you have access to one I would expect the stack VM builds and runs just fine. Ā I can try it tomorrow and see if it builds.
If we ever manage to move the target-agnostic JIT over to OSTVM, that would give us PPC for free. As to the stack interpreter, it should work as is. I haven't tried with PPC (hmmm... would be a good idea) but last November at Smalltalks I tried on RISC-V 64-bit and it works fine (I demoed it on an Unleashed board)
Well, I'm on linux ppc64le here. When I tried to
cmake .
make
it fails with:
[ 6%] Generating VMMaker image
Error. Could not determine platform's libc path for VM.
Try forcing $PLATFORMLIBDIR in /home/karel/vcs/opensmalltalk-vm/build/vmmaker/pharo-vm/pharo, based on LIBC_SO.
Please report what works to pharo [vm-dev] mail list.
LIBC_SO=
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.4 LTS"
NAME="Ubuntu"
VERSION="18.04.4 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.4 LTS"
VERSION_ID="18.04"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic
UNAME=Linux power 4.15.0-96-generic #97-Ubuntu SMP Wed Apr 1 03:02:23 UTC 2020 ppc64le ppc64le ppc64le GNU/Linux
System seems to be 64 bit. You may need to (re)install the 32-bit libraries.
CMakeFiles/PharoVMCore.dir/build.make:69: recipe for target 'build/vmmaker/VMMaker.image' failed
make[2]: *** [build/vmmaker/VMMaker.image] Error 1
CMakeFiles/Makefile2:722: recipe for target 'CMakeFiles/PharoVMCore.dir/all' failed
make[1]: *** [CMakeFiles/PharoVMCore.dir/all] Error 2
Makefile:151: recipe for target 'all' failed
make: *** [all] Error 2
Also it looks like build downloads some libraries (binaries) and they are AMD64 version instead of PPC64le:
$ find . -name '*.so' -type f -exec file \{} \;
./build/vm/libssl.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=89cb8ea91be8b04ffc742cc33d525fb9f76b556c, not stripped
./build/vm/libssh2.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=eafa92c5653860e7e2453024ace4429679ca9b38, not stripped
./build/vm/libSDL2.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=5e637f50425ea9b3266dd865d74db24a5f65d5fa, not stripped
./build/vmmaker/pharo-vm/lib/pharo/5.0-202002121043/SqueakSSL.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=c28a2b546ca033349842a63f37e232232539cfc1, with debug_info, not stripped
./build/vmmaker/pharo-vm/lib/pharo/5.0-202002121043/JPEGReadWriter2Plugin.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=7f7f34794b40827f2c331855f8a3b5a3314f70c2, with debug_info, not stripped
./build/vmmaker/pharo-vm/lib/pharo/5.0-202002121043/vm-sound-null.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=b20f0fc8d58f998911d2adb16a234b0a67951766, with debug_info, not stripped
./build/vmmaker/pharo-vm/lib/pharo/5.0-202002121043/SurfacePlugin.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=725d5c8cd893ec941a1785ca773910c679b22270, with debug_info, not stripped
./build/vmmaker/pharo-vm/lib/pharo/5.0-202002121043/libssl.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=1949ac7e4f805fa1b4dddf52968bd04a8f225b12, not stripped
./build/vmmaker/pharo-vm/lib/pharo/5.0-202002121043/libssh2.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=649fd9bcd4e0e181a13ae55162d5038cc41a476a, not stripped
./build/vmmaker/pharo-vm/lib/pharo/5.0-202002121043/vm-display-null.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=2349b3d3c43e5de72af4fc07a4170f8b86f2c8f0, with debug_info, not stripped
./build/vmmaker/pharo-vm/lib/pharo/5.0-202002121043/RePlugin.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=9be7371153f2f2b5c82efc4d3a04a2797ecc24f8, with debug_info, not stripped
./build/vmmaker/pharo-vm/lib/pharo/5.0-202002121043/vm-sound-pulse.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=a9dd584b9178f9bc2784a105e86800dd43e32c03, with debug_info, not stripped
./build/vmmaker/pharo-vm/lib/pharo/5.0-202002121043/vm-sound-OSS.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=37be7347ae6a0624ac46f8ad60e86fa177fbb3c2, with debug_info, not stripped
./build/vmmaker/pharo-vm/lib/pharo/5.0-202002121043/libgit2.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=aeda1977d79e6300652175530a00523b59dcc7be, with debug_info, not stripped
./build/vmmaker/pharo-vm/lib/pharo/5.0-202002121043/vm-display-X11.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=56a571c4ff59d527594bcf63064727d06833bc55, with debug_info, not stripped
./build/vmmaker/pharo-vm/lib/pharo/5.0-202002121043/vm-display-fbdev.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=2d0b96852d55f41a86c4d95ea30f70da122ae4ee, with debug_info, not stripped
./build/vmmaker/pharo-vm/lib/pharo/5.0-202002121043/EventsHandlerPlugin.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=760efc5202c4524f308105affbd4efdcff9f9b78, with debug_info, not stripped
./build/vmmaker/pharo-vm/lib/pharo/5.0-202002121043/libSDL2.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=228d83bb8bf91950ef50f8b2f8efc110ed62dc9a, not stripped
./build/vmmaker/pharo-vm/lib/pharo/5.0-202002121043/FileAttributesPlugin.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=7a622d85f5c29ffdb8b75ae4bc636ed2d9d047c1, with debug_info, not stripped
./build/vmmaker/pharo-vm/lib/pharo/5.0-202002121043/vm-sound-NAS.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=2f6fd795b34e6c6d76d8341466575f09f8b9e37d, with debug_info, not stripped
./build/vmmaker/pharo-vm/lib/pharo/5.0-202002121043/AioPlugin.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=3f66a722391732ea86e8102f3f4ee4a14397390c, with debug_info, not stripped
./build/vmmaker/pharo-vm/lib/pharo/5.0-202002121043/JPEGReaderPlugin.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=63720cd219d9c5ab83369402006fb82297f884cc, with debug_info, not stripped
./build/vmmaker/pharo-vm/lib/pharo/5.0-202002121043/B3DAcceleratorPlugin.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=b56343b4c77dd90a4903f01c2783b56659bf1ab6, with debug_info, not stripped
./build/vmmaker/pharo-vm/lib/pharo/5.0-202002121043/vm-sound-ALSA.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=5f615b6ab0017ea50923adee021888ecd922dd53, with debug_info, not stripped
./build/vmmaker/pharo-vm/lib/pharo/5.0-202002121043/InternetConfigPlugin.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=5c8f80b41de811bb16c65487ed8e80829fc02a34, with debug_info, not stripped
So there is something to do on PPC64le support. Anyway, I'm surprised the beast running fine on RISC-V. If this is the case, then perhaps I'm just missing some configuration/cmake option to make that working on PPC64le too?
For folks interested in POWER architecture development/porting, the most easy way to get access to actual hardware is GCC compile farm: https://cfarm.tetaneutral.net/ -- where people working on open-source/free-software may request account and access machines from the list. POWER is presented with both big and little endian and with power7, power8 and power9 CPUs hosts and with Linux and AIX. So the coverage is quite good...
I've also tested
cmake -DFLAVOUR=StackVM .
but this still shows the problem above.
Sorry, this is not the build process used in this repo. I cannot really help with the problems you are presenting :/ Have you tried following the instructions in the README?
Tobias, indeed, I've completely messed up with this. Anyway, bear with me, testing this repo source code now.
Reading README reveals that there is obviously not build.linux64ppc64le directory with the required infrastructure. But most close is probably build.linux64x64 so I give a try to it to find out how far I can get. The first issue is that the project config.guess file is out-dated. Note, I'm using squeak.stack.spur as I've thought this is stack based VM without any JIT. Anyway, the output is here:
karel@power:~/vcs/OpenSmalltalk/opensmalltalk-vm/build.linux64x64/squeak.stack.spur/build$ ./mvm
clean? yes
/home/karel/vcs/OpenSmalltalk/opensmalltalk-vm/spurstack64src
/home/karel/vcs/OpenSmalltalk/opensmalltalk-vm/src/plugins
checking sanity of generated src directory... okay
checking build system type... ../../../platforms/unix/config/config.guess: unable to guess system type
This script, last modified 2018-12-11, has failed to recognize
the operating system you are using. It is advised that you
download the most up to date version of the config scripts from
ftp://ftp.gnu.org/pub/gnu/config/
If the version you run (../../../platforms/unix/config/config.guess) is already up to date, please
send the following data and any information you think might be
pertinent to <config-patches@gnu.org> in order to provide the needed
information to handle your system.
config.guess timestamp = 2018-12-11
uname -m = ppc64le
uname -r = 4.15.0-96-generic
uname -s = Linux
uname -v = #97-Ubuntu SMP Wed Apr 1 03:02:23 UTC 2020
/usr/bin/uname -p =
/bin/uname -X =
hostinfo =
/bin/universe =
/usr/bin/arch -k =
/bin/arch =
/usr/bin/oslevel =
/usr/convex/getsysinfo =
UNAME_MACHINE = ppc64le
UNAME_RELEASE = 4.15.0-96-generic
UNAME_SYSTEM = Linux
UNAME_VERSION = #97-Ubuntu SMP Wed Apr 1 03:02:23 UTC 2020
configure: error: cannot guess build type; you must specify one
karel@power:~/vcs/OpenSmalltalk/opensmalltalk-vm/build.linux64x64/squeak.stack.spur/build$
when I updated this file to recognize my platform, I've got this:
karel@power:~/vcs/OpenSmalltalk/opensmalltalk-vm/build.linux64x64/squeak.stack.spur/build$ ./mvm
clean? y
/home/karel/vcs/OpenSmalltalk/opensmalltalk-vm/spurstack64src
/home/karel/vcs/OpenSmalltalk/opensmalltalk-vm/src/plugins
checking sanity of generated src directory... okay
checking build system type... powerpc64le-unknown-linux-gnu
checking host system type... powerpc64le-unknown-linux-gnu
checking target system type... powerpc64le-unknown-linux-gnu
Configuring Squeak (.-) for powerpc64le-linux-gnu
checking whether make sets $(MAKE)... yes
checking for gcc... clang
checking whether the C compiler works... no
configure: error: in `/home/karel/vcs/OpenSmalltalk/opensmalltalk-vm/build.linux64x64/squeak.stack.spur/build':
configure: error: C compiler cannot create executables
See `config.log' for more details
karel@power:~/vcs/OpenSmalltalk/opensmalltalk-vm/build.linux64x64/squeak.stack.spur/build$
which looks like is caused by missing clang on my box, I've installed Ubuntu 18.04 LTS clang (6.0 version) and run again. Configure part complains with one error:
...
checking the name lister (/usr/bin/nm -B) interface... (cached) BSD nm
error: unknown warning option '-Wno-unused-but-set-variable'; did you mean '-Wno-unused-const-variable'? [-Werror,-Wunknown-warning-option]
checking for ln... ln
...
and compilation part fails with a lot of errors about VM_LABEL missing:
/home/karel/vcs/OpenSmalltalk/opensmalltalk-vm/spurstack64src/vm/gcc3x-interp.c:3054:5: error: invalid symbol redefinition
VM_LABEL(pushLiteralConstantBytecode2);
^
/home/karel/vcs/OpenSmalltalk/opensmalltalk-vm/platforms/unix/vm/sqPlatformSpecific.h:110:49: note: expanded from macro 'VM_LABEL'
# define VM_LABEL(foo) asm("\n.globl L" #foo "\nL" #foo ":")
^
<inline asm>:3:1: note: instantiated into assembly here
LpushLiteralConstantBytecode2:
^
Anyway, I hope I've followed the right project and the right README here just to point few issues you probably already know about w.r.t. PPC64le platform support. Thanks!
Thanks, this puts things into perstpective.
That config.guess is outdated might be the case, I have no Idea how that is cenerated.
For the VM_LABEL
, could you try defining it to
# define VM_LABEL(foo) ((void)0)
as is done later in the file?
[see 5f075015b8 ]
Thanks for the patch and for the hint. I used that and after some more or less horrible hacks I've got to compiling platform specific IA32abi plugin which is a mark that time for ppc64le specific build infrastructure is here. :-) My hacks so far including your advice is:
$ cat /tmp/ppc64.diff
diff --git a/platforms/unix/vm/include_ucontext.h b/platforms/unix/vm/include_ucontext.h
index 7dc8d92d0..48d27e6b1 100644
--- a/platforms/unix/vm/include_ucontext.h
+++ b/platforms/unix/vm/include_ucontext.h
@@ -46,6 +46,9 @@
# define _PC_IN_UCONTEXT uc_mcontext.pc
#elif __linux__ && __arm__
# define _PC_IN_UCONTEXT uc_mcontext.arm_pc
+#elif __linux__ && __ppc64__
+/* 33th reg in the gp_regs should be NIP */
+# define _PC_IN_UCONTEXT uc_mcontext.gp_regs[32]
#elif __FreeBSD__ && __i386__
# define _PC_IN_UCONTEXT uc_mcontext.mc_eip
#elif __FreeBSD__ && __amd64__
diff --git a/platforms/unix/vm/sqPlatformSpecific.h b/platforms/unix/vm/sqPlatformSpecific.h
index d760ba24b..2694caa18 100644
--- a/platforms/unix/vm/sqPlatformSpecific.h
+++ b/platforms/unix/vm/sqPlatformSpecific.h
@@ -107,7 +107,7 @@ extern void sqFilenameFromString(char *uxName, sqInt stNameIndex, int sqNameLeng
#if defined(__GNUC__)
# if !defined(VM_LABEL)
-# define VM_LABEL(foo) asm("\n.globl L" #foo "\nL" #foo ":")
+# define VM_LABEL(foo) ((void)0)
# endif
#else
# if HAVE_ALLOCA_H
diff --git a/platforms/unix/vm/sqUnixHeartbeat.c b/platforms/unix/vm/sqUnixHeartbeat.c
index 90d023db5..adb4a0494 100644
--- a/platforms/unix/vm/sqUnixHeartbeat.c
+++ b/platforms/unix/vm/sqUnixHeartbeat.c
@@ -188,6 +188,8 @@ ioHighResClock(void)
/* Tim, not sure I have input beyond:
Is there a 64-bit clock on ARM? If so, access it here :-)
*/
+#elif defined(__ppc64__) && defined(__linux__)
+ /* for now do nothing */
#else
# error "no high res clock defined"
#endif
diff --git a/platforms/unix/vm/sqUnixMain.c b/platforms/unix/vm/sqUnixMain.c
index 2d2196f31..d23c0f0da 100644
--- a/platforms/unix/vm/sqUnixMain.c
+++ b/platforms/unix/vm/sqUnixMain.c
@@ -2007,7 +2007,8 @@ void imgInit(void)
#endif
#if defined(__GNUC__) && ( defined(ppc) || defined(__ppc) || defined(__ppc__) \
- || defined(POWERPC) || defined(__POWERPC) || defined (__POWERPC__) )
+ || defined(POWERPC) || defined(__POWERPC) || defined (__POWERPC__) ) \
+ && !defined(__ppc64__)
void mtfsfi(unsigned long long fpscr)
{
__asm__("lfd f0, %0" :: "m"(fpscr));
and the compile failure is:
clang -g -O1 -DNDEBUG -DDEBUGVM=0 -msse2 -Wall -Qunused-arguments -pthread -DLSB_FIRST=1 -m64 -Wno-missing-braces -Wno-unknown-pragmas -Wno-unused-value -Wno-unused-label -Wno-unused-function -Wno-unused-variable -DHAVE_CONFIG_H -DSQUEAK_BUILTIN_PLUGIN -I/home/karel/vcs/OpenSmalltalk/opensmalltalk-vm/build.linux64x64/squeak.stack.spur/build -I/home/karel/vcs/OpenSmalltalk/opensmalltalk-vm/build.linux64x64/squeak.stack.spur/build -I/home/karel/vcs/OpenSmalltalk/opensmalltalk-vm/platforms/unix/vm -I/home/karel/vcs/OpenSmalltalk/opensmalltalk-vm/platforms/Cross/vm -I/home/karel/vcs/OpenSmalltalk/opensmalltalk-vm/spurstack64src/vm -I/usr/local/include -I/home/karel/vcs/OpenSmalltalk/opensmalltalk-vm/platforms/Cross/plugins/IA32ABI -m64 -Wno-missing-braces -Wno-unknown-pragmas -Wno-unused-value -Wno-unused-label -Wno-unused-function -Wno-unused-variable -c -o xabicc.o /home/karel/vcs/OpenSmalltalk/opensmalltalk-vm/platforms/Cross/plugins/IA32ABI/xabicc.c
/home/karel/vcs/OpenSmalltalk/opensmalltalk-vm/platforms/Cross/plugins/IA32ABI/xabicc.c:23:2: error: "Unsupported architecture"
#error "Unsupported architecture"
^
1 error generated.
Makefile:193: recipe for target 'xabicc.o' failed
Yes. this is because of a plugin that is x86-specific
Please remove the line IA32ABI \
from build.linux64x64/squeak.stack.spur/plugins.int
and start again with ./mvm
Note that SqueakFFIPrims \
in plugins.ext
might also be a candidateā¦
Thanks, both of those removals were needed. Now I do have compiled VM in the tree. I've downloaded squeak image (5.3 latest), unzipped it, set SQUEAK_IMAGE to point to file and was able to start squeak. The UI complains about missing source file, but otherwise run -- as far as me as ST newbie can see... Thanks!
I've attempted to also start pharo8.0 image, but this complains (although run) with "Callout mechanism not available". It's probably a result of "GetPwdViaFFI" call as far as I can see and if this is FFI, then indeed, it may complain...
The sources file is here: http://files.squeak.org/sources_files/ (that is: http://files.squeak.org/sources_files/SqueakV50.sources.gz )
That said, This is really cool! Can you post a screenshot of the about-squeak dialog on squeak-dev or vm-dev?
Unfortunately I'm neither on vm-dev nor on squeak-dev. Anyway, it's here: https://drive.google.com/file/d/1AexePnuVNavu-q0NcMTgg8daQ9jGNr5h/view?usp=sharing -- feel free to download/repost there.
Cool!! FWIW, I booted up the Unleashed on which we demoed Squeak back in November, to refresh my memory of what I did. In all honesty this is just a quick hack. Here is the patch: https://github.com/shingarov/opensmalltalk-vm/tree/neuquen-demo I also included a screenshot of the about-squeak dialog: https://raw.githubusercontent.com/shingarov/opensmalltalk-vm/neuquen-demo/squeak-riscv64.png
Cool!! FWIW, I booted up the Unleashed on which we demoed Squeak back in November, to refresh my memory of what I did. In all honesty this is just a quick hack. Here is the patch: https://github.com/shingarov/opensmalltalk-vm/tree/neuquen-demo I also included a screenshot of the about-squeak dialog: https://raw.githubusercontent.com/shingarov/opensmalltalk-vm/neuquen-demo/squeak-riscv64.png
This is indeed awesome. I've inteded to do that for some years now but never had the opportunity.
This is per se a good idea. Alas, as the other comments succinctly point out, we have limited resources in the community. This means we have neither hardware nor people nor enough knowledge (yet) to pursue that.
For the hardware, Iām having Windows. And on Linux, qemuāuser can wrap Linux system calls into native Linux system call without having to į“ÉŖį“ a whole system (should work with anyone). I even build a rootfs which is able to transparently execute both į“į“į“ ā¶ā“ and Power binaries (much like itās possible to use mix 32ābits x86) that way (with native toolchain included).
This should allow anyone to performs testing and compiling in the case of Linux.
Hi Tobias,
On Apr 29, 2020, at 3:17 AM, Tobias Pape notifications@github.com wrote:
ļ»æ Yes. this is because of a plugin that is x86-specific
IA32ABI is not platform-specific, it is misnamed. If actually provides the callback machinery for the FFI.
Please remove the line IA32ABI \ from build.linux64x64/squeak.stack.spur/plugins.int and start again with ./mvm
No, thatās not the right solution at all. The tight thing is yo implrr et next the relevant platform-specific support machinery for callbacks.
Note that SqueakFFIPrims \ in plugins.ext might also be a candidateā¦
ā You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.
I'm confused. What is the IA32
about then, if not about x86? https://en.wikipedia.org/wiki/IA-32
Anyway, to get things to compile I think it's ok to first fogore the FFI machinery and then add necessary callbacks
It would be great if there is also ppc64le/power platform supported.