openfl / lime

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

Cannot compile OpenFL project. Problem on the IDE settings or in the lib? #1611

Closed GitMepc7r closed 4 months ago

GitMepc7r commented 1 year ago

I made a fresh install on FlashDevelop (using https://flashdevelop.org/downloads/builds/) and Haxetoolkit were installed with

haxelib install lime
haxelib run lime setup
lime install openfl

And some even simple projects may not work.

In a simple display image OpenFl project compiled to neko (that is my target build for windows, I have issues building Action Script 3 but that later), I noticed all of them do not auto-complete existing items when I type 'import openfl.' as if something is not added?

import openfl.Assets;
import openfl.display.Bitmap;
import openfl.display.BitmapData;
import openfl.display.Sprite;

At one point it was Type not found errors,

In the project.xml I have these added too

<!-- classpath, haxe libs -->
    <source path="src" />
    <haxelib name="openfl" />

    <!-- assets -->
    <icon path="assets/openfl.svg" />
    <assets path="assets/img" rename="img" />

But now most commonly I get this when failing to compile:


Called from ? line 1
Called from CommandLineTools.hx line 1904
Called from CommandLineTools.hx line 22
Called from CommandLineTools.hx line 124
Called from CommandLineTools.hx line 1589
Called from lime/tools/ConfigHelper.hx line 17
Called from lime/tools/ConfigHelper.hx line 71
Called from hxp/System.hx line 653
Called from /Users/runner/hostedtoolcache/haxe/4.2.5/x64/std/neko/_std/sys/FileSystem.hx line 82
Uncaught exception - std@sys_create_dir
Build halted with errors.

Project is linked to haxeToolkit folder, so it gets the libraries above are installed there. It looks like I am missing something but I cant explain why I cant build anything. Can I use that new haxe version? Project expects version 3.1.3 and I have 4.2.5

player-03 commented 1 year ago

Looking for where the error happens, the final two steps (System.hx and FileSystem.hx) are just carrying out the instruction given to them. Sure it fails on sys_create_dir, but the error is in the function that chooses which directory to create, and that's ConfigHelper.hx line 71.

Well, actually, a couple lines above that.

configPath = home + "/.lime/config.xml";

if (System.hostPlatform == WINDOWS)
{
  configPath = configPath.split("/").join("\\");
}

if (!FileSystem.exists(configPath))
{
  System.mkdir(Path.directory(configPath));

So on *nix systems, it'll look for $HOME/.lime/config.xml. On Windows, it'll look for %HOME%.lime\config.xml. And either way, the error happens when it tries to create the .lime directory. It's probably some kind of permission error that I'm sure you can fix, but it's probably easier just to create the .lime directory by hand, since you'll only ever need to do it once.

GitMepc7r commented 1 year ago

So in C:\Users(MyUsername) I need to have .lime folder? It asks for permission each time I create a folder there. And when trying to compile after doing it, it gives the same and Uncaught exception - [file_open,C:\Users\(MyUserName)\.lime\config.xml]

Can I direct it to another folder because this one is Read-only and would stay this way even if I uncheck? Where can I modify this path so it makes it elsewhere, is it good to be in HaxeToolkit or the FlashDevelop folders?

player-03 commented 1 year ago

Honestly, I should have suggested creating .lime within a directory you controlled, then moving it into %HOME%. That way, you would have already been the owner. Now you either have to delete it and retry, or take ownership.

Or, of course, set the LIME_CONFIG environment variable to some other path. You'll need to provide the whole path, including "config.xml" at the end. You don't need to actually create the file at that location, as long as you own the folder it's in.

GitMepc7r commented 1 year ago

I used Windows to edit Environment variables and added the path for LIME_CONFIG to be in .lime folder but FlashDevelop would ask for Config file, so I cannot create a dummy file config.xml as it would say "contains invalid XML data" is there some config file for lime that is preset that it needs to target? Is this lime error also the reason why when I type "import openfl.(something)" in the Main.hx class nothing shows up as if a library is not included?

player-03 commented 1 year ago

LIME_CONFIG is for picking a file location other than %HOME%/.lime/config.xml. If you've claimed .lime you shouldn't need LIME_CONFIG at all.

Either way, run lime setup again to generate the config file. (Maybe also lime setup [target] while you're at it.)

I haven't used HaxeDevelop in years, but I'm pretty sure it uses the Haxe completion server just like VS Code (the new popular editor). In that case, yeah, Lime's setup errors can and will prevent code completion from working.

GitMepc7r commented 1 year ago

I do not mind using VS Code, I already have VS Community but VS Code needs haxe and lime extensions. And once again fails it wants to write in C:\Users\MyUserName\ and i add this to a shortcut --extensions-dir ".vscode\extensions" to overcome permissions when using another location

On a side note for Haxe/flashdevelop I just need the lime config.xml file, I tried to use a example.hxcpp_config.xml renamed to config.xml still fails to compile but the library may be back because I can now "import openfl.(something" So just need the correct config.xml since it gets generated nowhere not when I set setup lime (after using this fake config: Uncaught exception - Could not find NekoAPI interface.), it cant write files in users\user so, is there no downloadable config file anywhere?

Some change has done:

 Moved Lime config from ~/.hxcpp_config.xml to ~/.lime/config.xml
* Added a new "lime config" command to print the current config
player-03 commented 1 year ago

Uncaught exception - Could not find NekoAPI interface

Did you install Lime via Git? If so, you'll be missing the binaries in the NDLL folder. These can be rebuilt using lime rebuild and/or lime rebuild <target>, but it's usually easier to copy them from the latest Haxelib release.

is there no downloadable config file anywhere?

Not that I'm aware of; I don't think there's been much demand for such a thing.

Here's what mine looks like:

<?xml version="1.0" encoding="utf-8"?>
<config>

    <section id="defines">

    </section>
    <define name="ANDROID_SDK" value="[SDK folder]" />
    <define name="ANDROID_NDK_ROOT" value="[NDK folder]" />
    <define name="JAVA_HOME" value="[Java folder]" />
    <define name="ANDROID_SETUP" value="true" />

</config>

...which seems wrong. Maybe it's actually reading from the old .hxcpp_config.xml file I still have?

In any case, I'd say try this and see if Lime can set up the rest:

<?xml version="1.0" encoding="utf-8"?>
<config>
    <section id="defines">
        <define name="ANDROID_SETUP" value="false" />
    </section>
</config>