OpenFL on Linux - Haxelib selfupdate

Hi, I have recently posted this question on stack overflow:

I would like to know if other users of Haxe on Linux are facing this kind of problem and if someone has a solution. I am probably missing something very stupid, but I can’t seem to get haxelib selfupdate to work.

I have the same problem,

The trick is to make a copy of the haxelib executable and to run selfupdate with it (and then delete it).

isn’t enough…

  sudo haxelib selfupdate

?

As I said in the stackoverflow question:

If I try to run haxelib as administrator, it requires me to make a 
new haxelib setup (I guess it is one setup per user). Once I did the 
setup and ran sudo haxelib selfupdate I got the folloing error:

Error compiling haxelib client: Standard library not found

At least on my setup it isn’t working. I guess this happens because haxe has a setup for each user.

Is this with 3.2, or 3.1.3? Have you guys posted an issue on https://github.com/haxefoundation/haxelib?

Thanks for the tip Ibilon! However, I tried to make a copy of haxelib but it was of no use. Same error:

[fabio@fabio-thinkpad ~]$ sudo cp /usr/bin/haxelib /usr/bin/haxelib2
[sudo] password for fabio: 
[fabio@fabio-thinkpad ~]$ haxelib2 selfupdate
Blocked
Haxelib was already up to date...
Error writing file /usr/bin/haxelib. Please ensure you have write permissions. 
  [file_open,/usr/bin/haxelib]

It seems @ibilon posted the issue @singmajesty

I didn’t read the stackoverflow question
sorry for that :wink:

Maybe try running the copy with sudo.

@ibilon If I run with sudo, I get this:
Error compiling haxelib client: Standard library not found

Maybe it’s missing some environment variables,
so it’ll probably be faster to compile it manually.

cd /usr/lib/haxe/lib/haxelib_client/3,2,0-rc,3/src/
haxe -main tools.haxelib.Main -n ~/haxelib.n
cd ~
nekotools boot haxelib.n
rm haxelib.n
sudo mv haxelib /usr/lib/haxe/

Thank you @ibilon! Worked like a charm :smile:

My haxelib path is actually /usr/bin/haxelib. Do you think that this may be causing any problems? The fact that I can’t compile something as sudo is very weird too, I will look into it.

Oh didn’t notice, could explain your problem,
I own the /usr/lib/haxe folder while root owns /usr/bin, most likely similar for you, since a simple user couldn’t write in /usr/bin that’d be a reason why it fails.

The error says it can’t find the std, so maybe try

sudo su
export HAXE_STD_PATH=/usr/lib/haxe/std
haxe -main ...

@Ibilon Thanks again, worked like a charm. Do you have any idea of why sudo doesn’t have HAXE_STD_PATH set on my computer?

It should be set as there are two files on /etc/profile.d/ setting it in different ways.
haxe.sh does

export HAXE_STD_PATH=/opt/haxe/std:.

And haxe.csh does

setenv HAXE_STD_PATH /opt/haxe/std:.

Both files should be running when bash is started.

Just got that, sudo doesn’t keep environment variables and you have to set the ones you want to keep at /etc/sudoers with:

Defaults env_keep += "HAXE_STD_PATH"
1 Like

It’s somewhat amusing to me how haxelib seems to assume that the user who is issuing this command is a member of the “wheel” group.

As a matter of fact, my development-user account is fairly powerless: it certainly isn’t among those privileged souls who are able to successfully “sudo.” Only one user in my entire laptop :wink: is able to do that . . .

1 Like

I think Linux archives are containing files owned by 1000:1000 (eg. see extracted files of install-haxe.sh). I’d say its a security concern, and it should be changed, but I’m not sure who to contact with this…

I think that we should re-think the notion of “selfupdate.” On my machine, as I said, applications are protected from modification and I am by-design not able to run sudo. (The user that is, is a different user, and I’m not sure how to run “selfupdate” from that user such that it would work.)

What I’d do, instead, is to look for an updated installer (for OS/X, in my case). Just as I would do with any other application that I wished to update. I’d like to be notified when haxelib has been upgraded, but I don’t want [it even to be possible …] to “self-upgrade” it.

@sundialservices Just a note (and for people reading this topic or finding it from a search engine), in case it’s not obvious (your message is a bit ambiguous), openfl isn’t making the haxelib tool.
If you have a problem with it or wish to discuss it you should use the HaxeFoundation’s github repository https://github.com/HaxeFoundation/haxelib

This is my solution:

1 Like