armory3d / armory

3D Engine with Blender Integration
https://armory3d.org
zlib License
3.06k stars 315 forks source link

[Linux (C)] unable to compile project #1452

Open onelsonic opened 4 years ago

onelsonic commented 4 years ago

unable to compile a Linux (C) HashLink project on Ubuntu.

Armory is producing the linux (C) HashLink project correctly, using the lastest SDK. But the project will not compile manually.

I tried the command "make" in the produced "Release" directory as per the documentation :

_Afterwards, you can compile the project using the generated makefile in blend_file_location/buildprojectname/linux-hl-build/Release

but it will return a full list of errors when trying to compile, and return the following:

makefile:11: recipe for target 'kore_sources.o' failed

moxiaomomo commented 4 years ago

I ran into the same problem. Have you solved it?

moxiaomomo commented 4 years ago

Check the : Build status

After I installed CodeBlocks IDE on Ubuntu, it seems that the project is able to compile in CodeBlocks now...

Refer to the WIKI: https://github.com/Kode/Kha/wiki/Linux

The Linux target creates C++ and OpenGL or Vulkan based project files for Code::Blocks and CLion in addition to a makefile. To make the CLion project work it can be necessary to restart CLion once after loading the project.

onelsonic commented 4 years ago

@moxiaomomo first time I see this page. thanks you for pointing it, I will give it a try.

the Armory documentation will need to be updated as well : https://github.com/armory3d/armory/wiki/linux

RLP9GHR60I commented 4 years ago

I updated the wiki according to what worked in my machine (see diff). I wasn't able to build with the makefile, even after I installed codeblocks.

Were you able to build with the makefile at all? If not, this may be a bug in Kha.

Clockwork-Muse commented 4 years ago

This is not a workable resolution - I'm building things as part of CI/CD, so I can't open the project inside Codeblocks to perform the build. I need a working makefile.

(For what it's worth, I can't build inside Codeblocks even to test things out, so this is pointing to a Kha/Kinc issue)

tong commented 4 years ago

@Clockwork-Muse make CFLAGS=-std=c11 in the Release directory works for me.

Clockwork-Muse commented 4 years ago

@tong - So I discovered (essentially).

Given that the makefile has gcc -std=c++11, I'm assuming that something in Kha is substituting the wrong flag set.

notwarp commented 4 years ago

i solved replacing inside the ../linux-hl-build/Release/makefile "gcc -std=c++11" with "gcc -std=c11" on all rows, and set CFLAGS=-std=c11 on top of the makefile. After that you can run make <projectname> from Release folder than put the executable inside linux-hl (the one with datas) folder and run it from there with ./__

i created a script that shoul automate this task, note you should put the correct path name inside the script

Screenshot at 2020-09-26 17-36-44

#!/bin/bash
cd **<REPLACE_WITH_BUILD_PATH_NAME>**/linux-hl-build/Release
sed -i 's/CFLAGS=-std=c99/CFLAGS=-std=c11/g' makefile
sed -i 's/gcc -std=c++11/gcc -std=c11/g' makefile
make **<REPLACE_WITH_NAME_USED_IN_ARMORY_EXPORTER_SETTINGS>**
cp **<REPLACE_WITH_NAME_USED_IN_ARMORY_EXPORTER_SETTINGS>** ../../linux-hl/
cd ../../linux-hl
./**<REPLACE_WITH_NAME_USED_IN_ARMORY_EXPORTER_SETTINGS>**

put that file inside blender project folder and make it executable with chmod +x than run it

notwarp commented 4 years ago

I've noticed that it compile end run fine only with OpenGL, vulkan compiles but give me this error during execution Starting KoreHL ArmorySDK/Kha/Kinc/Backends/Graphics5/Vulkan/Sources/Kore/CommandList5Impl.cpp:224: void flush_init_cmd(): Assertion '!err' failed. Aborted (core dumped)

Clockwork-Muse commented 4 years ago

.... same, although in my case I can (bizarrely) only get OpenGL to run under a debugger....

onelsonic commented 3 years ago

@notwarp thanks for looking into this, that's great. Are you able to compile a Linux (C) HashLink exported project now, does it compile completely without errors? And are you on Ubuntu?

Wondering if this can be closed?

notwarp commented 3 years ago

@notwarp thanks for looking into this, that's great. Are you able to compile a Linux (C) HashLink exported project now, does it compile completely without errors? And are you on Ubuntu?

Wondering if this can be closed?

Hi, what i wrote is a workaround, it is not meant to be a real solution, but yes i'm able to compile without errors just remember to put the correct name inside the script and select opengl inside the armory properties within blender.

Anyway we should look deeper for find where the CFLAGS are set duriing build of the project

onelsonic commented 3 years ago

ok this will need further review then. thanks

notwarp commented 3 years ago

with the SDK version 2021-8 a new problem prevent me compile the project : ArmorySDK/Kha/Backends/KoreHL/KoreC/system.cpp:49:37: error: no matching function for call to ‘Kore::Mouse::unlock(int&)’ Kore::Mouse::the()->unlock(windowId); ArmorySDK/Kha/Backends/KoreHL/KoreC/system.cpp:53:45: error: no matching function for call to ‘Kore::Mouse::canLock(int&)’ return Kore::Mouse::the()->canLock(windowId); ArmorySDK/Kha/Backends/KoreHL/KoreC/system.cpp:57:46: error: no matching function for call to ‘Kore::Mouse::isLocked(int&)’ return Kore::Mouse::the()->isLocked(windowId);

for improve the makefile generation there is, inside the file in ArmorySDK/Kha/Kinc/Tools/kincmake/out/Exporters/LinuxExporter.js, the code for generate the makefile.

Can someone give a look at this?

onelsonic commented 3 years ago

Kha needs to be updated, similar issues for Win/Android here. https://github.com/armory3d/armory/issues/2267#issuecomment-895213813

notwarp commented 3 years ago

ok thanks I've just updated the SDK in the addon panel of Armory. Is still impossible for me compile using Vulkan API, that you know, there are some steps other than the installation of the Vulkan SDK to do before build the project?