Kode / Kha

Ultra-portable, high performance, open source multimedia framework.
http://kha.tech
zlib License
1.49k stars 172 forks source link

Cannot build for Windows x86 - "Project file not found" #671

Closed prabab closed 6 years ago

prabab commented 7 years ago

The image is pretty self explanatory. MSBuild says that project file doesn't exist, even if it's clearly there. What am I doing wrong? image I don't have any special characters in the path to the project folder. I'm using Windows 10, if that's any help.

Update 1: I've tried manually changing the build.bat to include the full path to file and after that the project compiled, however it still doesn't work in the end - as soon as I launch the EXE file, it turns off. Update 2: After copying resource files from the /windows folder to the newly created /Release folder - the game works! But I'm not very fond of these extra steps and if possible would've preferred to avoid them in the first place.

sh-dave commented 7 years ago

Try to run the cmdline manually and see if that changes anything. In your project folder run:

node Kha/make windows --run

This should build the project files, compile, and run the project. As an alternative just open the generated sln file in MSVC.

prabab commented 7 years ago

So, this is what happens: image I've installed Haxe and Kha following the Lewis Lepton's tutorials. I'm not that good at Node, but it seems like there's something I still need to do to have everything working properly?

After compiling the project from .sln, the result is pretty much the same as when I modified .bat to contain full path to the project, meaning that there's tons of unnecessary weird files left in the /Release folder and all assets still need to be copied in there manually. Or is this the expected behaviour?

sh-dave commented 7 years ago

Edit:

prabab commented 7 years ago

Through cmd, after navigating to project's folder and entering Kha/make windows --run, I get the same error as before: "Project file does not exist". image

As for the vs2013, I get a "--compile not yet implemented on this platform" error. Microsoft's website says that VS2017 it compatible with VS2013 and VS2015, but I'm having doubts when it comes to these claims.

Should I install VS2013 instead?

RobDangerous commented 7 years ago

Can you open and compile the vcxproj in Visual Studio?

sh-dave commented 7 years ago

No, you shouldn't have to install vs2013, it was just an example (i overlooked that it actually says vs2017 in the screenhost in your opening post).

It seems you run a (i think) polish windows?, so do you maybe have "strange characters" in your path especially in the blacked out parts (something with accents/ticks like Ù or some such) that might be a problem?

Also your projects seems to be on drive D:\ and your Kha on C:\, maybe that causes path problems as well. You could try to put them both on the same drive for testing.

prabab commented 7 years ago

@RobDangerous image This is what VS told me after opening the vcxproj.

So, I did this "retarget solution" thing and the app did compile. But I encountered the same issue as before:

@sh-dave No unusual characters in the path, not even spaces as for now. To get a clean state I've uninstalled Haxe (since you mentioned Kode Studio is self sufficient) and moved Kode to the same drive as project... But I think I might have... broken something? Not exactly sure what's going on here. image Update: I've updated the path in korefile.js and the issue went away. Update 2: Still, after moving everything to the same drive as project, VS doesn't compile - "Project file does not exist". image

So, to reiterate, here's what happens with every approach I tried:

sh-dave commented 7 years ago

Can you run the project in VS (via F5), because the working directory should point to /build/windows (where the exported assets are located)? Check with: 1) rightclick on your project -> properties 2) in the dialog go to 'Configuration Properties' -> Debugging 3) check the 'Working Directory' path. It should point to an absolute path to your project/build/windows

image

Yes, ton's of obj files for c++ builds is normal. You basically get a cpp file for every single haxe class.

prabab commented 7 years ago

@sh-dave

RobDangerous commented 7 years ago

With the exception of the "project file does not exist" thing that's all as it should be. Kha is designed to be minimally invasive to native development in Visual Studio, Xcode,... The whole object files chaos, exe in Debug/Release,... all of that is standard Visual Studio behavior. Assets are exported to build/windows - to ship something grab the exe from build/windows-build/Release and copy it to build/windows. During development you should usually use the exe from build/windows-build/Debug.

prabab commented 7 years ago

@RobDangerous Thank you, that's a relief. It's good to know that I can still build projects despite of this weird issue, even if it needs some additional steps to go through with it. What else might be causing the problem with VS saying that project file doesn't exist?

Changes I've made to try to fix the problem:

...but project still doesn't compile straight from the Kode Studio.

Jarrio commented 6 years ago

After I reinstalled windows (just as a regular thing I do for a fresh start) I am now also experiencing this issue. I am running Windows 10 | x64 | UK | English. Same setup as before, the only thing that has really changed in my setup is the new windows update that was released maybe around a week or two ago?

My project file exists, the path is correct and contains no special characters or spaces. But prior to the reinstall everything worked fine. I am also unable to compile the project at all for cpp windows

My compile output:

Using Kha from P:\Development\HaxeToolkit\haxe\lib\kha\git
Creating Kha project.
Exporting asset 1 of 1 (Roboto.ttf).
Compiling shader 1 of 8 (painter-colored.frag.glsl).
Compiling shader 2 of 8 (painter-colored.vert.glsl).
Compiling shader 3 of 8 (painter-image.frag.glsl).
Compiling shader 4 of 8 (painter-text.frag.glsl).
Compiling shader 5 of 8 (painter-image.vert.glsl).
Compiling shader 6 of 8 (painter-video.frag.glsl).
Compiling shader 7 of 8 (painter-text.vert.glsl).
Compiling shader 8 of 8 (painter-video.vert.glsl).
korefile found.
Creating Windows project files.
Compiling...
**********************************************************************
** Visual Studio 2017 Developer Command Prompt v15.4.1
** Copyright (c) 2017 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x86'
Microsoft (R) Build Engine version 15.4.8.50001 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

MSBUILD : error MSB1009: Project file does not exist.
Switch: MemoryPractice.vcxproj
Compilation failed.
The terminal process terminated with exit code: 1
RobDangerous commented 6 years ago

Same question, can you open and compile the vcxproj in Visual Studio?

Yanrishatum commented 6 years ago

Pretty much same log as with Jarrio, except VS17 prompt version is 15.4.5 and different Kha path (E:\HaxeToolkit\kha).
Same thing both for manual kha -t windows --compile command and via Kode F1 -> Compile Kha Project -> Windows or Windows Universal.
Opening .sln file and compiling manually do work.
Win10x64 It may be related on how Kha compiles. First line of build.bat which launches vcvars32.bat redirect current directory:

C:\_work\2017\khatest\build\windows-build
λ call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\Build\vcvars32.bat"
**********************************************************************
** Visual Studio 2017 Developer Command Prompt v15.4.5
** Copyright (c) 2017 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x86'

C:\Users\Yanrishatum\source
λ

Then error with "Project file does not exist" is pretty obvious, as that directory indeed does not contains it. @RobDangerous

RobDangerous commented 6 years ago

Sadly I can't reproduce at all. Tried the fanciest paths to no avail. The build process creates a build.bat file in build/windows-build and just calls that. Does that file work when you run it manually? Do the contents look ok? For me it looks like

@call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars32.bat"
@MSBuild.exe "Blocks.vcxproj" /m /p:Configuration=Release,Platform=Win32
Yanrishatum commented 6 years ago

No it doesn't. As I said - in my case (and I'm pretty sure in all other cases of "not found" in this issue) first line with call of vcvars32.bat changes current directory, resulting in second line failing. And if I edit it to go back to proper directory, compilation fails with whooping 366 errors, probably because my CMD doesn't have all environmental variables set as it expects. And if I try to compile it via calling kha - it regenerates build.bat and removes directory fix.

UPD: And yes, it's look basically same except instead of Community it's Professional. And project name, obviously.

RobDangerous commented 6 years ago

Ah, I missed your current dir comment. That shouldn't happen. And your system prints a lambda on both lines instead of the @ (which in batch files just means don't print this line). That's weird though because @ is ASCII. I'll removed it for now, maybe it helps.

Yanrishatum commented 6 years ago

It shows lambdas because I use Cmder for primary console host :) But same thing happens in just plain CMD:

cmd.exe log

``` Microsoft Windows [Version 10.0.15063] (c) 2017 Microsoft Corporation. All rights reserved. C:\Users\Yanrishatum>cd C:\_work\2017\khatest\build\windows-build C:\_work\2017\khatest\build\windows-build>build.bat ********************************************************************** ** Visual Studio 2017 Developer Command Prompt v15.4.5 ** Copyright (c) 2017 Microsoft Corporation ********************************************************************** [vcvarsall.bat] Environment initialized for: 'x86' Microsoft (R) Build Engine version 15.4.8.50001 for .NET Framework Copyright (C) Microsoft Corporation. All rights reserved. MSBUILD : error MSB1009: Project file does not exist. Switch: Khatest.vcxproj C:\Users\Yanrishatum\source> ```

Removing @ does not solve the problem. It seems that is a bug in VS where some versions of vacvars by some reason change current directory. Source

RobDangerous commented 6 years ago

Aha. OK, that's fixed then. Thanks a lot for the help. @Jarrio and @prabab please re-check.

RobDangerous commented 6 years ago

Please reopen if you still run into issues.