google / shaderc

A collection of tools, libraries, and tests for Vulkan shader compilation.
Other
1.84k stars 361 forks source link

Build fail [88/99] ar -M #47

Closed sistr22 closed 8 years ago

sistr22 commented 8 years ago

While trying to compile on MacOS it works fine at first but stopped near the end, during linking:

****-macbookpro:build ****$ ninja
[35/99] Building CXX object third_party/glslang/SPIRV/CMakeFiles/SPIRV.dir/GlslangToSpv.cpp.o
../third_party/glslang/SPIRV/GlslangToSpv.cpp:1561:33: warning: comparison of constant 4294967295 with expression of type 'spv::BuiltIn' is always true [-Wtautological-constant-out-of-range-compare]
                    if (builtIn != spv::BadValue)
                        ~~~~~~~ ^  ~~~~~~~~~~~~~
../third_party/glslang/SPIRV/GlslangToSpv.cpp:3023:17: warning: comparison of constant 4294967295 with expression of type 'spv::BuiltIn' is always true [-Wtautological-constant-out-of-range-compare]
    if (builtIn != spv::BadValue)
        ~~~~~~~ ^  ~~~~~~~~~~~~~
../third_party/glslang/SPIRV/GlslangToSpv.cpp:3032:13: warning: comparison of constant 4294967295 with expression of type 'spv::Decoration' is always true [-Wtautological-constant-out-of-range-compare]
    if (dec != spv::BadValue)
        ~~~ ^  ~~~~~~~~~~~~~
../third_party/glslang/SPIRV/GlslangToSpv.cpp:3039:13: warning: comparison of constant 4294967295 with expression of type 'spv::Decoration' is always true [-Wtautological-constant-out-of-range-compare]
    if (dec != spv::BadValue)
        ~~~ ^  ~~~~~~~~~~~~~
../third_party/glslang/SPIRV/GlslangToSpv.cpp:3046:13: warning: comparison of constant 4294967295 with expression of type 'spv::Decoration' is always true [-Wtautological-constant-out-of-range-compare]
    if (dec != spv::BadValue)
        ~~~ ^  ~~~~~~~~~~~~~
5 warnings generated.
[88/99] Generating libshaderc_combined.a
FAILED: cd /Users/****/Documents/dev/vulkan/sharder_compiler/shaderc/build/libshaderc && /bin/echo -e create\ libshaderc_combined.a\\naddlib\ /Users/****/Documents/dev/vulkan/sharder_compiler/shaderc/build/libshaderc/libshaderc.a\\naddlib\ /Users/****/Documents/dev/vulkan/sharder_compiler/shaderc/build/third_party/glslang/SPIRV/libSPIRV.a\\naddlib\ /Users/****/Documents/dev/vulkan/sharder_compiler/shaderc/build/libshaderc_util/libshaderc_util.a\\naddlib\ /Users/****/Documents/dev/vulkan/sharder_compiler/shaderc/build/third_party/glslang/glslang/libglslang.a\\naddlib\ /Users/****/Documents/dev/vulkan/sharder_compiler/shaderc/build/third_party/glslang/OGLCompilersDLL/libOGLCompiler.a\\naddlib\ /Users/****/Documents/dev/vulkan/sharder_compiler/shaderc/build/third_party/glslang/glslang/OSDependent/Unix/libOSDependent.a\\nsave\\nend | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar -M
usage:  ar -d [-TLsv] archive file ...
    ar -m [-TLsv] archive file ...
    ar -m [-abiTLsv] position archive file ...
    ar -p [-TLsv] archive [file ...]
    ar -q [-cTLsv] archive file ...
    ar -r [-cuTLsv] archive file ...
    ar -r [-abciuTLsv] position archive file ...
    ar -t [-TLsv] archive [file ...]
    ar -x [-ouTLsv] archive [file ...]
[88/99] Building CXX object libshaderc/CMakeFiles/shaderc_shaderc_cpp_test.dir/src/shaderc_cpp_test.cc.o
ninja: build stopped: subcommand failed.
****-macbookpro:build ****$ 

I haven't found a work around yet (And I've never used ninja ...)

dekimir commented 8 years ago

Thanks, @Whiteseeker for reporting this. We don't build regularly on MacOS, so support for it will be sporadic.

This looks like it's caused by the GNU-specific ar flag -M in the combine_static_lib function (defined in cmake/utils.cmake). If you can figure out how to achieve the same operation in a portable manner, you can fix this. Alternatively, if you don't care about the libshaderc_combined target, you can modify line 27 of libshaderc/CMakeLists.txt to skip this step for both Windows and MacOS.

sistr22 commented 8 years ago

Thx for the quick fix ! I just did: if (NOT "${MSVC}" AND NOT APPLE) at line 27 There is definitely a way to merge libraries in a cross platform way like that: ar -rcT libmerged.a lib1.a lib2.a But I I'm not super familliar with cmake. Again thx !

dekimir commented 8 years ago

Glad this worked for you. Would you consider contributing your fix to the repo?

sistr22 commented 8 years ago

You mean ... making a pull request for one line change ? I would gladly ofc, I'll do that.

Thx

Damien

On Tue, 1 Dec 2015 at 16:35 Dejan Mircevski notifications@github.com wrote:

Glad this worked for you. Would you consider contributing your fix to the repo?

— Reply to this email directly or view it on GitHub https://github.com/google/shaderc/issues/47#issuecomment-161024194.

dekimir commented 8 years ago

Prolly more than one line, as you should also add yourself to CONTRIBUTORS. ;)

sistr22 commented 8 years ago

PR submitted! It took some time but at least it's a "real" fix, it also create the shared lib on mac and pass the test. Currently it only fail the last test on mac:

14/14 Test #14: glslc_tests ......................***Failed 0.11 sec

Thx !

On Tue, 1 Dec 2015 at 17:50 Dejan Mircevski notifications@github.com wrote:

Prolly more than one line, as you should also add yourself to CONTRIBUTORS. ;)

— Reply to this email directly or view it on GitHub https://github.com/google/shaderc/issues/47#issuecomment-161045954.

sistr22 commented 8 years ago

Closing