openfl / lime

A foundational Haxe framework for cross-platform development
https://lime.openfl.org/
MIT License
752 stars 364 forks source link

Can not setup lime (with haxe installed with homebrew) #519

Closed jordgubben closed 7 years ago

jordgubben commented 9 years ago

I'm facing issues setting up lime. Installing went fine, but the setup step fails (after quite a long time silent). I'm running OS X 10.10, with haxe installed via homebrew.

Some bash

Starting position:

DeLorean:~ jakob$ haxe -version
3.2.0
DeLorean:~ jakob$ which haxe
/usr/local/bin/haxe
DeLorean:~ jakob$ which haxelib
/usr/local/bin/haxelib
DeLorean:~ jakob$ haxelib list
lime: [2.5.2]
openfl: [3.2.2]
DeLorean:~ jakob$ haxelib config
/usr/local/lib/haxelib/

Setup lime (takes 1-2 minutes):

DeLorean:~ jakob$ haxelib run lime setup
Called from lime/system/System.hx line 553
Called from lime/system/System.hx line 304
Called from lime/system/System.hx line 414
Called from lime/system/System.hx line 239
Called from /usr/lib/haxe/std/neko/Lib.hx line 30
Uncaught exception - load.c(237) : Failed to load library : lime.ndll (dlopen(lime.ndll, 1): image not found)

What strikes me as odd is that Lib.hx on the stacktrace above has the wrong path. It's really in /usr/local/lib/haxe/std/neko/ (because this is where homebrew puts things) and not /usr/lib/haxe/std/neko/ (which appears to be the default) so somethings obviously off there. Don't know if it's related though.

Saving clause

I must admit I'm to new to the haxe-ecosystem to tell if this is a problem with homebrew, haxelib or lime. But since I've not encountered any other haxe-lib with this priblem (yet). Thus I'm thought I'd start here and then work my way "uppstream" if this is not a lime issue.

ibilon commented 9 years ago

The path informations come from the computer that compiled the executable.

If you run haxelib run lime without args does-it works?

Maybe try with haxelib run lime setup --no-cffi, if I'm not wrong on the option it wont try to load the ndll, so it'll succeed for this.

If you go to the lime folder, /usr/local/bin/haxe/lime/2,5,2/ does running "neko run.n pwd" works?

jordgubben commented 9 years ago

Without args

If you run haxelib run lime without args does-it works?

Nope. It still has the same problem.

DeLorean:~ jakob$ haxelib run lime
Called from lime/system/System.hx line 553
Called from lime/system/System.hx line 304
Called from lime/system/System.hx line 414
Called from lime/system/System.hx line 239
Called from /usr/lib/haxe/std/neko/Lib.hx line 30
Uncaught exception - load.c(237) : Failed to load library : lime.ndll (dlopen(lime.ndll, 1): image not found)

--no-cffi

Maybe try with haxelib run lime setup --no-cffi, if I'm not wrong on the option it wont try to load the ndll, so it'll succeed for this.

Same result :(

DeLorean:~ jakob$ haxelib run lime setup --no-cffi
Called from lime/system/System.hx line 553
Called from lime/system/System.hx line 304
Called from lime/system/System.hx line 414
Called from lime/system/System.hx line 239
Called from /usr/lib/haxe/std/neko/Lib.hx line 30
Uncaught exception - load.c(237) : Failed to load library : lime.ndll (dlopen(lime.ndll, 1): image not found)

neko run.n

If you go to the lime folder, /usr/local/bin/haxe/lime/2,5,2/ does running "neko run.n pwd" works?

Well, that is not a directory on my machine. My libs are in /usr/local/bin/haxelib, but any way it did not help either.

DeLorean:2,5,2 jakob$ neko run.n `pwd`
Called from lime/system/System.hx line 553
Called from lime/system/System.hx line 304
Called from lime/system/System.hx line 414
Called from lime/system/System.hx line 239
Called from /usr/lib/haxe/std/neko/Lib.hx line 30
Uncaught exception - load.c(237) : Failed to load library : lime.ndll (dlopen(lime.ndll, 1): image not found)
jordgubben commented 9 years ago

Is there any way to enable more debug output?

ibilon commented 9 years ago

I looked at the code and it's actually -nocffi sorry. You can get more information with the verbose mode -v.

So it doesn't seem to be a problem from haxelib.

If you go into the ndll/Mac64/ folder and run "neko ../../run.n pwd"?

jordgubben commented 9 years ago

-nocffi

I looked at the code and it's actually -nocffi sorry. You can get more information with the verbose mode -v.

Got a different result, but still not working. It's a problem with PathHelper, just like the issue I'm having with openfl. Could it be related? The exception appears tp be thrown on the same line (even if the line numbers differ for some reason).

DeLorean:haxe jakob$ haxelib run lime setup -nocffi -v
Called from ? line 1
Called from CommandLineTools.hx line 1359
Called from CommandLineTools.hx line 25
Called from a C function
Called from CommandLineTools.hx line 61
Called from lime/tools/helpers/PathHelper.hx line 202
Uncaught exception - Invalid field access : split

neko ../../run.n

If you go into the ndll/Mac64/ folder and run "neko ../../run.n pwd"?

DeLorean:Mac64 jakob$ pwd
/usr/local/lib/haxelib/lime/2,5,2/ndll/Mac64
DeLorean:Mac64 jakob$ neko ../../run.n `pwd`
Error: Library format is not installed : run 'haxelib install format'

Perhaps this is a stupid questions. But what are the dependencies of lime? Is it just haxe and a self-contained lib or am I expected to install anything else first? Like 'format'? The manual does not mention any external dependencies.

jordgubben commented 9 years ago

neko ../../run.n (again)

Got a slightly different result after installing the format lib.

DeLorean:Mac64 jakob$ pwd
/usr/local/lib/haxelib/lime/2,5,2/ndll/Mac64
DeLorean:Mac64 jakob$ haxelib list
format: [3.1.2]
lime: [2.5.2]
openfl: [3.2.2]
DeLorean:Mac64 jakob$ neko ../../run.n `pwd`
Uncaught exception - load.c(181) : Module not found : tools/tools.n
jordgubben commented 9 years ago

Digging deeper

I've cloned the lime master and added a bunch of trace() statements to see if I can get some more info on what it is that fails.

DeLorean:tools jakob$ haxelib run lime setup
RunScript.hx:161: Running local compile!
PathHelper.hx:189: LogHelper.verbose = true
ProcessHelper.hx:253: runProcess(): ,null,haxelib,[path,lime]
 - Detected host platform: MAC
ProcessHelper.hx:313: _runProcess(): ,null,haxelib,[path,lime]
 - Running process: haxelib path lime
ProcessHelper.hx:388: Process result = 1
ProcessHelper.hx:394: Process stdout:

ProcessHelper.hx:395: Process stderr:
/usr/local/lib/haxe/std/neko/Lib.hx:30: characters 17-68 : You cannot use the library 'lime' inside a macro
lime/system/System.hx:239: characters 11-68 : Called from
lime/system/System.hx:414: characters 14-49 : Called from
lime/system/System.hx:304: characters 3-21 : Called from
lime/system/System.hx:553: characters 48-100 : Called from
Aborted

PathHelper.hx:206: Process output:
null
Called from ? line 1
Called from RunScript.hx line 233
Called from RunScript.hx line 21
Called from lime/tools/helpers/PathHelper.hx line 207
Uncaught exception - Invalid field access : split

Bingo! The return code is 1 (not 0) and there's an error printout from a haxelib path lime process. Looks like haxelib path lime is having trouble locating the path to the lime-lib for some reason. It's sad that the stack trace is trimmed, it may have simplified things if it showed the entire call stack.

Anyway, these are the lines at System.hx:552-555:

    #if (cpp || neko || nodejs)
    private static var lime_system_get_directory = System.load ("lime", "lime_system_get_directory", 3);
    private static var lime_system_get_timer = System.load ("lime", "lime_system_get_timer", 0);
    #end

Odd thing is that making the same call from the terminal works fine.

DeLorean:tools jakob$ haxelib path lime
-L /Users/jakob/GameDevelopment/github/openfl-lime/ndll/
/Users/jakob/GameDevelopment/github/openfl-lime/
-D lime=2.5.2

This is how far I've gotten today. Any ideas?

jgranick commented 9 years ago

Are you sure you have the latest haxelib?

If "haxelib path lime" fails, the rest will follow :smile:

jordgubben commented 9 years ago

Are you sure you have the latest haxelib?

As far as I know. The 3.2.0-rc3 is the latest available release, right?

DeLorean:~ jakob$ haxelib help | head -1
Haxe Library Manager 3.2.0-rc.3 - (c)2006-2015 Haxe Foundation
jordgubben commented 9 years ago

haxelib path lime calls System.hx?

Just as an experiment, I've added some trace() to lime/system/System.hx. And to my surprise the trace output appears inside the output from the haxelib path lime called from within haxelib run lime. :confused: :confounded: :sob:

DeLorean:tools jakob$ haxelib run lime
RunScript.hx:162: Running local compile!
RunScript.hx:20: rebuildTools rebuildBinaries = true
PathHelper.hx:162: getHaxeLib(),{ name => lime, version =>  },true,false
PathHelper.hx:190: LogHelper.verbose = true
ProcessHelper.hx:253: runProcess(): ,null,haxelib,[path,lime]
 - Detected host platform: MAC
ProcessHelper.hx:313: _runProcess(): ,null,haxelib,[path,lime]
 - Running process: haxelib path lime
ProcessHelper.hx:388: Process result = 1
ProcessHelper.hx:394: Process stdout:
System.hx:185: Load: lime,lime_system_get_directory,3,false
System.hx:305: 305 - About to loadNekoAPI()
System.hx:413: loadNekoAPI,false
System.hx:415: 415 - __loadedNekoAPI = null
System.hx:185: Load: lime,neko_init,5,false
System.hx:240: 240 - About to load some module: lime

ProcessHelper.hx:395: Process stderr:
/usr/local/lib/haxe/std/neko/Lib.hx:30: characters 17-68 : You cannot use the library 'lime' inside a macro
lime/system/System.hx:241: characters 11-68 : Called from
lime/system/System.hx:418: characters 14-49 : Called from
lime/system/System.hx:306: characters 3-21 : Called from
lime/system/System.hx:557: characters 48-100 : Called from
Aborted

PathHelper.hx:207: Process output:
System.hx:185: Load: lime,lime_system_get_directory,3,false
System.hx:305: 305 - About to loadNekoAPI()
System.hx:413: loadNekoAPI,false
System.hx:415: 415 - __loadedNekoAPI = null
System.hx:185: Load: lime,neko_init,5,false
System.hx:240: 240 - About to load some module: lime

Error: Could not find haxelib "lime", does it need to be installed?

However it does not show up when haxelib path limeis called directly.

DeLorean:tools jakob$ haxelib path lime
-L /Users/jakob/GameDevelopment/github/openfl-lime/ndll/
/Users/jakob/GameDevelopment/github/openfl-lime/
-D lime=2.5.2

Dont know if this is related, but I've also noted that when haxelib run limeexecutes, multiple haxelib path limeprocesses run at the same time.

DeLorean:haxe jakob$ ps | grep "path" 
 1770 ttys000    0:00.64 haxe -cp /usr/local/Cellar/haxe/3.2.0/lib/haxe/extra/haxelib_src/src --run tools.haxelib.Main path lime
 1772 ttys000    0:00.15 haxe -cp /usr/local/Cellar/haxe/3.2.0/lib/haxe/extra/haxelib_src/src --run tools.haxelib.Main path lime
 1774 ttys001    0:00.00 grep path

This brings new questions:

  1. What could cause haxelib to execute code in System.hx?
  2. Why would haxelib ever want to do that?
  3. Could this be a bug far up stream in haxe/nano? (global state, pointer out of bounds etc)
  4. What's up with the 2 identical haxe -cp /usr/local/Cellar/haxe/3.2.0/lib/haxe/extra/haxelib_src/src --run tools.haxelib.Main path lime?
jordgubben commented 9 years ago

Also, looked a bit into the haxelib source. I does not look like it's doing anything with the code inside the libs when checking path. But like I stated earlier, I'm new to Haxe so I might be wrong.

https://github.com/HaxeFoundation/haxelib/blob/master/src/tools/haxelib/Main.hx

martindemello commented 9 years ago

confirming same issue on linux (ubuntu) with lime installed via haxelib install lime. i needed to set LD_LIBRARY_PATH to get around the Failed to load library : lime.ndll (lime.ndll: cannot open shared object file: No such file or directory) error, and when I did it died in PathHelper.hx

 LD_LIBRARY_PATH=/home/mdemello/opt/share/haxe/lib/lime/2,6,1/ndll/Linux64 haxelib run lime setup
Called from ? line 1
Called from CommandLineTools.hx line 1371
Called from CommandLineTools.hx line 25
Called from a C function
Called from CommandLineTools.hx line 61
Called from lime/tools/helpers/PathHelper.hx line 202
Uncaught exception - Invalid field access : split

I'll uninstall and reinstall from the nightly and see what that does.

martindemello commented 9 years ago

installing lime from nightly via haxelib local also fails the setup (same issue), though it did not need the explicit LD_LIBRARY_PATH to find lime.ndll.

martindemello commented 9 years ago

haxelib run lime setup seems to be doing something seriously weird.

$ ps ef
  PID TTY      STAT   TIME COMMAND
 6726 pts/11   Ss     0:00 -/bin/bash rvm_version=1.26.11 (latest) XDG_SESSION_ID=c2 PARINIT=rTbgqR B=.?_A_a Q=_s>|: _system_version=14.04 GIO_LAUNCHED_DESKTOP_FILE_PID=3163 DISPLAY=:0.0 XDG_SEAT=sea
 8184 pts/11   R+     0:00  \_ ps ef XDG_VTNR=7 CAML_LD_LIBRARY_PATH=/home/mdemello/ocamlbrew/ocaml-4.01.0/.opam/4.02.2/lib/stublibs MANPATH=:/home/mdemello/ocamlbrew/ocaml-4.01.0/.opam/4.02.2/man OR
 5517 pts/9    Ss     0:01 -/bin/bash rvm_version=1.26.11 (latest) XDG_SESSION_ID=c2 PARINIT=rTbgqR B=.?_A_a Q=_s>|: _system_version=14.04 GIO_LAUNCHED_DESKTOP_FILE_PID=3163 DISPLAY=:0.0 XDG_SEAT=sea
 5779 pts/9    Sl+    0:00  \_ vim tools/CommandLineTools.hx XDG_VTNR=7 CAML_LD_LIBRARY_PATH=/home/mdemello/ocamlbrew/ocaml-4.01.0/.opam/4.02.2/lib/stublibs MANPATH=:/home/mdemello/ocamlbrew/ocaml-4.
 5320 pts/4    Ss     0:00 -/bin/bash rvm_version=1.26.11 (latest) XDG_SESSION_ID=c2 PARINIT=rTbgqR B=.?_A_a Q=_s>|: _system_version=14.04 GIO_LAUNCHED_DESKTOP_FILE_PID=3163 DISPLAY=:0.0 XDG_SEAT=sea
 8013 pts/4    S+     0:00  \_ haxe -cp /usr/lib/haxe/extra/haxelib_src/src --run tools.haxelib.Main run lime setup CAML_LD_LIBRARY_PATH=/home/mdemello/ocamlbrew/ocaml-4.01.0/.opam/4.02.2/lib/stublib
 8014 pts/4    Z+     0:00      \_ [uname] <defunct>
 8015 pts/4    S+     0:00      \_ neko run.n setup /home/mdemello/Downloads/ XDG_VTNR=7 CAML_LD_LIBRARY_PATH=/home/mdemello/ocamlbrew/ocaml-4.01.0/.opam/4.02.2/lib/stublibs MANPATH=:/home/mdemello/o
 8016 pts/4    S+     0:00          \_ neko tools/tools.n setup /home/mdemello/Downloads/ CAML_LD_LIBRARY_PATH=/home/mdemello/ocamlbrew/ocaml-4.01.0/.opam/4.02.2/lib/stublibs XDG_VTNR=7 ORBIT_SOCKETD
 8017 pts/4    S+     0:01              \_ haxe -cp /usr/lib/haxe/extra/haxelib_src/src --run tools.haxelib.Main path lime XDG_VTNR=7 CAML_LD_LIBRARY_PATH=/home/mdemello/ocamlbrew/ocaml-4.01.0/.opam/
 8018 pts/4    Z+     0:00                  \_ [uname] <defunct>
 8019 pts/4    S+     0:01                  \_ haxe -cp /usr/lib/haxe/extra/haxelib_src/src --run tools.haxelib.Main path lime CAML_LD_LIBRARY_PATH=/home/mdemello/ocamlbrew/ocaml-4.01.0/.opam/4.02.2/
 8020 pts/4    Z+     0:00                      \_ [uname] <defunct>
 8021 pts/4    S+     0:01                      \_ haxe -cp /usr/lib/haxe/extra/haxelib_src/src --run tools.haxelib.Main path lime XDG_VTNR=7 CAML_LD_LIBRARY_PATH=/home/mdemello/ocamlbrew/ocaml-4.01.
 8022 pts/4    Z+     0:00                          \_ [uname] <defunct>
 8023 pts/4    S+     0:01                          \_ haxe -cp /usr/lib/haxe/extra/haxelib_src/src --run tools.haxelib.Main path lime CAML_LD_LIBRARY_PATH=/home/mdemello/ocamlbrew/ocaml-4.01.0/.opam
 8072 pts/4    Z+     0:00                              \_ [uname] <defunct>
 8073 pts/4    S+     0:01                              \_ haxe -cp /usr/lib/haxe/extra/haxelib_src/src --run tools.haxelib.Main path lime XDG_VTNR=7 CAML_LD_LIBRARY_PATH=/home/mdemello/ocamlbrew/oca
 8078 pts/4    Z+     0:00                                  \_ [uname] <defunct>
 8079 pts/4    S+     0:01                                  \_ haxe -cp /usr/lib/haxe/extra/haxelib_src/src --run tools.haxelib.Main path lime CAML_LD_LIBRARY_PATH=/home/mdemello/ocamlbrew/ocaml-4.01
 8084 pts/4    Z+     0:00                                      \_ [uname] <defunct>
 8085 pts/4    S+     0:01                                      \_ haxe -cp /usr/lib/haxe/extra/haxelib_src/src --run tools.haxelib.Main path lime XDG_VTNR=7 CAML_LD_LIBRARY_PATH=/home/mdemello/ocaml
 8086 pts/4    Z+     0:00                                          \_ [uname] <defunct>
 8087 pts/4    S+     0:00                                          \_ haxe -cp /usr/lib/haxe/extra/haxelib_src/src --run tools.haxelib.Main path lime CAML_LD_LIBRARY_PATH=/home/mdemello/ocamlbrew/oc
 8092 pts/4    Z+     0:00                                              \_ [uname] <defunct>
 8093 pts/4    S+     0:01                                              \_ haxe -cp /usr/lib/haxe/extra/haxelib_src/src --run tools.haxelib.Main path lime XDG_VTNR=7 CAML_LD_LIBRARY_PATH=/home/mdemel
 8099 pts/4    Z+     0:00                                                  \_ [uname] <defunct>
martindemello commented 9 years ago

haxelib selfupdate seems to have fixed it - the haxelib version didn't change, but the shellscript it installed as /usr/bin/haxelib changed from

#!/bin/sh
exec haxe -cp /usr/lib/haxe/extra/haxelib_src/src --run tools.haxelib.Main "$@"

(which was written as part of make install from git haxe) to

#!/bin/sh
OLDCWD=`pwd`
cd /usr/share/haxe/lib/haxelib_client/3,2,0-rc,3/src/
exec haxe -D haxelib_client=3.2.0-rc.3 --run tools.haxelib.Main -cwd $OLDCWD $@
ooz commented 8 years ago

I had the same issue as @martindemello with haxelib run lime setup spawning multiple neko and haxe processes under Ubuntu 14.04 with haxe 3.3.0.

haxelib selfupdate fixed it for me too.

AndreiRegiani commented 8 years ago

I confirm that the current OpenFL/Lime setup on Linux is very unstable.

I was getting segmentation fault when trying to setup Lime, using either haxelib version or latest from GitHub.

haxelib selfupdate didn't work for me, what seems to have worked was to use the latest from the whole stack (Haxe, Neko, Lime, OpenFL), I actually tried this before using binary distribution I guess but it didn't work previously, I suspected it was an issue with Neko, anyways after many attempts Lime setup worked, the only problem left was this:

"/usr/lib/haxe/lib/lime/git/legacy/ndll/Linux64/lime-legacy.ndll" does not exist"

But this fixed: lime rebuild linux and lime rebuild linux -Dlegacy

jeffreytgilbert commented 8 years ago

I found with my instance that I had some lingering bins installed in /usr/bin and as soon as I removed them, it instantly started working. I did also run the selfupdate, but it did not fix the problem. It just showed me what was wrong. haxelib was reporting back with the wrong version after the self update, and when it ran I got a permissions denied error, which was odd at the time, but now makes total sense. Folders were missing, libs had the wrong versions, etc.

Chuckytuh commented 8 years ago

I encountered the same problem on OSX yosemite with an installation of haxe 3.2.1 from homebrew..turned out to be a problem with permissions!

Usually homebrew installs haxe 3.2.1 into /usr/local/Cellar/haxe/3.2.1, check the permission on that folder and update it so that you get write permissions.

Found this by running haxelib selfupdate that reported no write permissions there. After that, haxelib run openfl setup worked like a charm.

hopewise commented 8 years ago

I am on OSX, using CrossOver, when I run the command in bottle's command line:

>: C:\Motion-Twin\haxe\haxelib run lime test "porject.xml"  -debug -Dfdb

I get this error:

Called from ? line 1
Called from CommandLineTools.hx line 1385
Called from CommandLineTools.hx line 25
Called from CommandLineTools.hx line 61
Called from lime/tools/helpers/PathHelper.hx line 202
Uncaught exception - Invalid field access : split
Build halted with errors.

I tried,

>C:\Motion-Twin\haxe\haxelib path lime

and it shows:

-L lime/2,7,0/ndll/
C:\haxelibs/lime/2,7,0/
-D lime

if I try:

>C:\Motion-Twin\haxe\haxelib selfupdate

I get:

Haxelib was already up to date...
Error compiling haxelib client: Error: Can't recognize 'haxelib path haxelib_client' as an internal or external command, or batch script.
ibilon commented 8 years ago

@hopewise that's a different error, please open a new issue.

hopewise commented 8 years ago

there #676

tanis2000 commented 8 years ago

I'm experiencing the same issue as @martindemello with lime 2.9.0 and Haxe 3.3 (git version).