New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pharo: 5.0 -> 6.0 #26924
pharo: 5.0 -> 6.0 #26924
Conversation
Create a new set of VM packages to keep up with changes in the upstream Pharo project.
mv vm-sound-ALSA vm-sound-ALSA.so | ||
mv pharo pharo-vm | ||
|
||
cp * "$prefix/lib/$name" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to use ./*.
}; | ||
# Choose target platform name in the format used by the vm. | ||
flavor = | ||
if stdenv.isLinux && stdenv.isi686 then "linux32x86" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be factored, but perhaps it was a conscious choice. No need to reply, just consider it.
# Regenerate the configure script. | ||
# Unnecessary? But the build breaks without this. | ||
autoreconfPhase = '' | ||
(cd opensmalltalk-vm/platforms/unix/config && make) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's up with the subshell?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The subshell was there to isolate the change of directory. I switched from (cd x && foo)
to pushd x; foo; popd
style which is hopefully less controversial.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lukego A subshell is great if you want to accomplish that (and certainly better than the replacement with pushhd and popd), but I am and wasn't sure whether the different phases run within the same shell process and whether or not they run from the same directory. I wouldn't expect the phase's execution semantics to be dependent on the other phases having run, which is what you seem to imply. If this is true, then I would consider it a design flaw. So, are you absolutely sure that you need it?
EOF | ||
# Note: --with-vmcfg configure option is broken so copy plugin specs to ./ | ||
preConfigure = '' | ||
cd opensmalltalk-vm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please rewrite without using the cd command. I.e. add its argument to the paths in the next line.
# Note: --with-vmcfg configure option is broken so copy plugin specs to ./ | ||
preConfigure = '' | ||
cd opensmalltalk-vm | ||
cp build.${flavor}/pharo.cog.spur/plugins.{ext,int} . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quote ${flavor}, even though it now isn't needed.
make install-squeak install-plugins prefix=$(pwd)/products | ||
|
||
# Copy binaries & rename from 'squeak' to 'pharo' | ||
mkdir -p $out |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$out can contain spaces with a different store location, right? So, that needs to be quoted.
|
||
# Copy binaries & rename from 'squeak' to 'pharo' | ||
mkdir -p $out | ||
cp products/lib/squeak/5.0-*/squeak $out/pharo |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent spacing.
# LD_LIBRARY_PATH. This is important because various C code in the VM | ||
# and Smalltalk code in the image will search for them there. | ||
mkdir -p $out/bin | ||
chmod u+w $out/bin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer non-differential rights. I.e. chmod 0XXX for some values of XXX.
pkgs/development/pharo/vm/wrapper.sh
Outdated
|
||
# Run the VM | ||
set -f | ||
exec ${vm} $args "$@" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
${vm} also needs quotes.
|
||
# Run the VM | ||
set -f | ||
exec -- ${vm} $@ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quoting again and also add -- to the other exec invocation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix the quoting issues everywhere (some issues I haven't marked multiple times), and the other comments, and I am happy.
ln -s "${pharo-share}/lib/"*.sources $prefix/lib/$name | ||
''; | ||
# Note: Force gcc6 because gcc5 crashes when compiling the VM. | ||
buildInputs = [ bash unzip glibc openssl gcc6 mesa freetype xorg.libX11 xorg.libICE xorg.libSM alsaLib cairo pharo-share libuuid autoreconfHook ]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some of these are only build-time dependencies, e.g. unzip, gcc. Those should be listed as nativeBuildInputs
instead, since buildInputs
is meant for runtime dependencies
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI I've done this in my small PR (#25681), but maybe bash
should be a runtime dependency.
|
||
{ name, src, ... }: | ||
|
||
stdenv.mkDerivation rec { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a use case for keeping the legacy expression around? If someone really needs it it's still there in previous revisions of nixpkgs.
EOF | ||
chmod +x $prefix/bin/${cmd} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use makeWrapper
instead of this script (see my changes in #25681). It essentially does the same thing but it just makes it a bit more maintainable.
@0xABAB Thanks for the reviews! I have pushed some fixes intended to address them. Aside: I would find it helpful if the Nixpkgs Contributors Guide would provide a rationale for these somewhere. I don't immediately understand the difference between |
@Balletie Could you be tempted to rebase your changes on this branch and PR them? |
I spent a little time trying to use multiple outputs to reduce the amount of symlinkage into the environment. I am not sure why but I didn't make that work. I intended to leave that as-is for the purposes of this PR and I don't think that it poses a practical problem. Could be improved in the future when I have more experience with multiple outputs. |
@Balletie Good question about use cases. It's important since this package only provides the VM which is not useful unless you combine it with an image. So where does the image come from, and how do you make sure the image and VM are compatible? My premise on this branch is that you are downloading images from the internet, e.g. Pharo 5, Pharo 6, Pharo 7 preview, Moose 6, Moose 6.1, DrGeo, etc, and you often have no special knowledge of which VM is required (and don't care - you just want to run the image.) So in this case the wrapper script does the right thing by making sure all VMs are available and selecting the appropriate one. (Could be that those images are often distributed together with "appropriate" VMs but those will be binaries that you can't simply run on NixOS out of the box.) Note: There are many Pharo images in the wild, and each one works with only one of the cog32/spur32/spur64 variants, so any time we drop a VM variant we are limiting the set of images that can be opened. |
I'll try to rebase tomorrow. Regarding the comment about the use case: I was trying to say that maybe we should remove the Nice work on detecting the appropriate VM for any given image by the way. Something similar was also present in the pharo launcher (or still is?) when the migration from cog to spur happened. |
Oops! I actually missed committing the file where it is referenced, |
I pushed an update to the latest recommended version of the spur VM (based on feedback on the pharo-dev mailing list since upstream are not making actual source releases nowadays.) The 64-bit VM is now not working properly with my usual test image but I propose to simply live with this for now, since 64-bit support is still an experimental feature and I don't know how stable and compatible it is supposed to be. Hope to fix it with a future PR. |
I decided to skip testing the desktop integration (icons, open on double-click, etc.) My NixOS desktop is not working that well - can't open a file browser in xfce for some reason - and I don't have the time to troubleshoot that (I don't use any of that stuff myself anyway.) |
Travis-CI is reporting a build error but I don't understand its report. Can somebody please help me to decipher it? |
This commit adds the third party libraries needed by the default Pharo environment to the LD_LIBRARY_PATH, by using makeWrapper.
@lukego You can cherry pick from my pharo6-for-nixpkgs branch (it's this commit: Balletie@96600d5). That way this PR can stay open. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not perfect, but it's good enough.
Thanks @0xABAB for the approval. I think it makes sense to land imperfect code and improve it incrementally. (I've already spent about a week on this, spread out over a couple of months, trying to understand what has been happening with the upstream project and coordinate with their release plans. And there is still a lot of that work to do in order to create Pharo images within Nix. Hurts a bit :)) @Balletie I merged your branch, thanks! Sorry about the wait, I did not immediately realize that you had created a new branch with the changes rebased. Thank you for that. Is this branch ready to merge then? I am fine with any rebasing/squashing/etc that anybody wants to do / wants me to do. |
This is important. The VM was not compiled in "Pharo mode" and this made certain primitives return different values to the Smalltalk side. (Practically speaking I am surprised that the VM has been working basically fine for me for weeks, but this resolves a problem with adding filetree:// repositories with Monticello that failed in an obscure way when the file permissions lookup primitive did not behave as expected.) See also: https://pharo.fogbugz.com/f/cases/20217/Image-does-not-detect-incompatible-opensmalltalk-vm
Building with GCC > 4.9 produces a broken VM for reasons that are not yet understood, see http://forum.world.st/OSProcess-fork-issue-with-Debian-built-VM-td4947326.html also disable "stackprotector" hardening for compatibility with this older gcc.
... Since this PR is still open I will continue to push my Pharo related fixes here. The latest is a downgrade to gcc 4.8 to work-around a segfault crash when forking a subprocess (2b3dcfa I have reached out for help with identifying a suitable test suite for the VM to find this problems more proactively. |
@lukego If you believe the packaging is done, just contact e.g. Mic92 with a request to merge (I already thought it was good enough to merge earlier). The reason Pharo crashes with newer compilers is because newer compilers tend to exploit C semantics, and in particular undefined behavior, better. Pharo programmers used fork without understanding what it does (next to some other out of bounds issue being present). So, while many people would traditionally point at the compiler for being wrong with the argument that the old compiler did work, this line of reasoning is false. I fully expect the same problems on other platforms, if not today, then tomorrow. I would not recommend anyone to run anything important on Pharo, because of the referenced bug. In our packaging it would be nice to have a marker like "known to exhibit nasal daemons for programs with known undefined behavior", but unfortunately I expect that most people in this community would consider such a feature to be too harsh. |
Closing in a huff because I am annoyed by the unsolicited disparaging comments about the software that I am packaging. |
@0xABAB Please bear with me for a bit. I am frustrated because I don't understand the process for contributing to nixpkgs (what is a "merge request"? who is "Mic92"?) and I don't enjoy the feedback you are giving me (feels a bit gratuitously negative to me and I am not sure if/how I am supposed to respond in this context i.e. on a PR that I have open.) I am just looking for the lowest friction way to share the work that I am doing on packaging Pharo in order to avoid duplication by other people who want to use it too. |
@lukego please don't be discouraged! |
@@ -52,7 +51,7 @@ stdenv.mkDerivation rec { | |||
secs=5 | |||
echo -n "Running headless Pharo for $secs seconds to check for a crash... " | |||
timeout $secs \ | |||
${pharo-vm}/bin/pharo-vm-nox PharoLauncher.image --no-quit eval 'true' | |||
"${pharo}/bin/pharo" -nodisplay PharoLauncher.image --no-quit eval 'true' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possible minor typo: At least on my machine, pharo
complains about the -nodisplay
argument, using two dashes (--nodisplay
) does the trick.
I understand from #27298 that this branch may be rebased/squashed on the way into the repo. That's fine. |
@lukego merged. Thank you |
This pull request has been mentioned on Nix community. There might be relevant details there: https://discourse.nixos.org/t/code-of-conduct-or-whatever/2134/1 |
Update Pharo for the 6.0 release. This includes a new upstream VM package, with a new build procedure, and separate 32-bit/64-bit variants.
This branch mostly done but with a little work still in progress:
pharo-cog32
: 32-bit VM for legacycog
images.pharo-spur32
: 32-bit VM for Pharo 6 (and late Pharo 5.)pharo-spur64
: 64-bit VM for Pharo 6 (and late Pharo 5.) Experimental!pharo
: Multi-VM wrapper that automatically selects a suitable VM based on the image being opened.spur
VM to the new OpenSmalltalk version and build process. This is the standard one now.spur
VM source to the latest version recommended by upstream.pharo-launcher
as unmaintained. (Seems to require coordinating with upstream developers, who have some multi-VM selection logic on the Smalltalk side, and on reflection I don't have time for this.)cc @Balletie
Motivation for this change
Support the latest Pharo VM in order to run the latest Pharo images.
Things done
(nix.useSandbox on NixOS,
or option
build-use-sandbox
innix.conf
on non-NixOS)
nix-shell -p nox --run "nox-review wip"
./result/bin/
)