Vulkan : Trouble compiling linux (Fedora 24) #599

Open
7oxicshadow opened this Issue Jul 13, 2016 · 11 comments

Projects

None yet

2 participants

@7oxicshadow
==== Building vulkan-loader (debug_linux) ====
Creating obj/Linux/Debug/Linux/Debug/vulkan-loader
cJSON.c
error: invalid argument '-std=c++14' not allowed with 'C/ObjC'
vulkan-loader.make:185: recipe for target 'obj/Linux/Debug/Linux/Debug/vulkan-loader/cJSON.o' failed
make[1]: *** [obj/Linux/Debug/Linux/Debug/vulkan-loader/cJSON.o] Error 1
Makefile:216: recipe for target 'vulkan-loader' failed
make: *** [vulkan-loader] Error 2

@7oxicshadow

I had some time to look into this a little further today.

It appears that the make files are autogenerated by premake. In vulkan-loader.make the -std=c++14 command appears to be appended to the ALL_CFLAGS line(s) instead of the ALL_CXXFLAGS line(s) which I believe is the correct one for C++ flags.

Manually modifying the file and then disabling the autogen build scripts allows the build to continue as expected.

The next point which it fails in when compiling "dirent_on_windows.c". Given the name i expect that this should not be included in a linux make file as it is expecting windows only headers. Again manually removing this entry allows the build to continue.

I am now stuck on the following error:

==== Building vulkan-loader (debug_linux) ====
loader.c
../third_party/vulkan/loader/loader.c:2462:31: error: expected ')'
                              DEFAULT_VK_DRIVERS_INFO, HOME_VK_DRIVERS_INFO,
                              ^
../third_party/vulkan/loader/vk_loader_platform.h:97:9: note: expanded from
      macro 'DEFAULT_VK_DRIVERS_INFO'
    "/" SYSCONFDIR VULKAN_ICDCONF_DIR ":"    

I will report back if I get any further

@7oxicshadow

The above error is the result of the following not being defined:

SYSCONFDIR
DATADIR

If I manually define them as "etc" and "share" the build continues.

Now the vulkan driver seems to fail on GCC 6 issues.

@7oxicshadow

I have managed to fix a number of GCC 6 issues and have progressed the build on linux quite far but I am stumped on the following problem.

==== Building capstone (debug_linux) ====
==== Building gflags (debug_linux) ====
==== Building glew (debug_linux) ====
==== Building glslang-spirv (debug_linux) ====
==== Building imgui (debug_linux) ====
==== Building libavutil (debug_linux) ====
==== Building libavcodec (debug_linux) ====
==== Building snappy (debug_linux) ====
==== Building spirv-tools (debug_linux) ====
==== Building vulkan-loader (debug_linux) ====
==== Building xxhash (debug_linux) ====
==== Building yaml-cpp (debug_linux) ====
==== Building xenia-base (debug_linux) ====
==== Building xenia-core (debug_linux) ====
==== Building xenia-apu (debug_linux) ====
==== Building xenia-apu-nop (debug_linux) ====
==== Building xenia-cpu (debug_linux) ====
==== Building xenia-cpu-backend-x64 (debug_linux) ====
==== Building xenia-ui (debug_linux) ====
==== Building xenia-debug-ui (debug_linux) ====
==== Building xenia-ui-spirv (debug_linux) ====
==== Building xenia-gpu (debug_linux) ====
spirv_shader_translator.cc
../src/xenia/gpu/spirv_shader_translator.cc:78:7: error: non-const lvalue
      reference to type 'vector<[...]>' cannot bind to a temporary of type
      'vector<[...]>'
      std::vector<Id>({b.makeFloatConstant(1.f), b.makeFloatConstant(1.f),
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../third_party/glslang-spirv/SpvBuilder.h:195:56: note: passing argument to
      parameter 'comps' here
    Id makeCompositeConstant(Id type, std::vector<Id>& comps, bool specC...

Any ideas?

@mdeguzis
mdeguzis commented Aug 5, 2016 edited

I have this same error (first post of yours) and parsing my logs as well, so you're not alone. I am building with pbuilder on a Debian Jessie chroot with backported clang-3.8. Maybe the autogen would work if -stdc++14 was not seemingly appended to a C object. xenia/third_party/vulkan/loader/ objects are in C, so i'd imagine premake5.lua should be language "C", not "C++".

@mdeguzis
mdeguzis commented Aug 5, 2016 edited

If I correct the language to "C" in the premake file, I get farther on, but seems an include for io.h is missing:

==== Building vulkan-loader (debug_linux) ====
Creating obj/Linux/Debug/Linux/Debug/vulkan-loader
cJSON.c
debug_report.c
dev_ext_trampoline.c
dirent_on_windows.c
../third_party/vulkan/loader/dirent_on_windows.c:12:10: fatal error: 'io.h' file not found
#include <io.h> /* _findfirst and _findnext set errno iff they return -1 */
         ^
1 error generated.
vulkan-loader.make:194: recipe for target 'obj/Linux/Debug/Linux/Debug/vulkan-loader/dirent_on_windows.o' failed
make[3]: *** [obj/Linux/Debug/Linux/Debug/vulkan-loader/dirent_on_windows.o] Error 1
Makefile:219: recipe for target 'vulkan-loader' failed

But... I see that defined in said file:

#include <dirent_on_windows.h>
#include <errno.h>
#include <io.h> /* _findfirst and _findnext set errno iff they return -1 */

Log:http://sprunge.us/cMdY

Not sure where io.h is to be pulled from, if not in the same directory.

@7oxicshadow

there are a number of changes required. I removed dirent_on_windows from the vulkan-loader.make as i dont believe it is required for linux. It will build further then. There are a number of files that fail after that because they need #include <math.h> in order to progress and then there is another file that fails on a case statement because the { } brackets are not included and GCC 6 does not like it.

@mdeguzis
mdeguzis commented Aug 5, 2016

Anything in the open PR for that catches your eye?

@7oxicshadow

comment should have been #include math.h with chevron brackets. the comment section removes them......

I checked the PR. Nothing related to the issue I am having. I suspect if i was using GCC 5 it would progress further.

Ultimately I suspect I would get to the point where there is windows specific code and would not progress further but i will keep digging away at it when ever i get spare time.

@mdeguzis
mdeguzis commented Aug 5, 2016

Same here, glad to find someone else digging into this in a similar fashion. I mainly build packages for SteamOS or for fun regardless. I'll try not to bombard this thread unless I come up with something concrete.

@mdeguzis
mdeguzis commented Sep 13, 2016 edited

Tried this on Arch Linux (working on AUR package), I encountered the same exact bug. Arch has GCC 6.2.1.

@mdeguzis

I created https://github.com/ProfessorKaos64/xenia-aur to work on possibly seeing if this behavior can be patched will I try to learn more about what premake is doing here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment