Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[runtime-library] CMake build of runtime-library failed #93

Closed
wangkuiyi opened this issue Jan 16, 2023 · 1 comment · Fixed by iree-org/iree#11871
Closed

[runtime-library] CMake build of runtime-library failed #93

wangkuiyi opened this issue Jan 16, 2023 · 1 comment · Fixed by iree-org/iree#11871

Comments

@wangkuiyi
Copy link
Contributor

Ignored this CMake configuration warning, I kept moving on building runtime-library with the command cmake --build build, which printed the following error:

[173/185] Building C object CMakeFiles/ireert_test.dir/test_api.c.o
FAILED: CMakeFiles/ireert_test.dir/test_api.c.o
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -DCPUINFO_SUPPORTED_PLATFORM=1 -I/Users/y/w/iree-samples/runtime-library/build/include -I/Users/y/w/iree/third_party/cpuinfo/include -isystem /Users/y/w/iree -isystem /Users/y/w/iree-samples/runtime-library/build/iree_core -isystem /Users/y/w/iree/third_party/flatcc/include -O3 -DNDEBUG -flto=thin -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk -fvisibility=hidden -Werror -Wall -Wno-ambiguous-member-template -Wno-char-subscripts -Wno-extern-c-compat -Wno-gnu-alignof-expression -Wno-gnu-variable-sized-type-not-at-end -Wno-ignored-optimization-argument -Wno-invalid-offsetof -Wno-invalid-source-encoding -Wno-mismatched-tags -Wno-pointer-sign -Wno-reserved-user-defined-literal -Wno-return-type-c-linkage -Wno-self-assign-overloaded -Wno-sign-compare -Wno-signed-unsigned-wchar -Wno-strict-overflow -Wno-trigraphs -Wno-unknown-pragmas -Wno-unknown-warning-option -Wno-unused-command-line-argument -Wno-unused-const-variable -Wno-unused-function -Wno-unused-local-typedef -Wno-unused-private-field -Wno-user-defined-warnings -Wctad-maybe-unsupported -Wfloat-overflow-conversion -Wfloat-zero-conversion -Wfor-loop-analysis -Wformat-security -Wgnu-redeclared-enum -Wimplicit-fallthrough -Winfinite-recursion -Wliteral-conversion -Wnon-virtual-dtor -Woverloaded-virtual -Wpointer-arith -Wself-assign -Wstring-conversion -Wtautological-overlap-compare -Wthread-safety -Wthread-safety-beta -Wunused-comparison -Wvla -fno-lax-vector-conversions -fmacro-prefix-map=/Users/y/w/iree=iree -MD -MT CMakeFiles/ireert_test.dir/test_api.c.o -MF CMakeFiles/ireert_test.dir/test_api.c.o.d -o CMakeFiles/ireert_test.dir/test_api.c.o -c /Users/y/w/iree-samples/runtime-library/test_api.c
In file included from /Users/y/w/iree-samples/runtime-library/test_api.c:10:
In file included from /Users/y/w/iree-samples/runtime-library/build/include/iree/hal/api.h:12:
In file included from /Users/y/w/iree-samples/runtime-library/build/include/iree/hal/allocator.h:13:
In file included from /Users/y/w/iree-samples/runtime-library/build/include/iree/base/api.h:82:
In file included from /Users/y/w/iree-samples/runtime-library/build/include/iree/base/allocator.h:17:
In file included from /Users/y/w/iree-samples/runtime-library/build/include/iree/base/status.h:22:
/Users/y/w/iree-samples/runtime-library/build/include/iree/base/string_view.h:67:27: error: suggest braces around initialization of subobject [-Werror,-Wmissing-braces]
  iree_string_pair_t v = {iree_string_view_empty(), iree_string_view_empty()};
                          ^~~~~~~~~~~~~~~~~~~~~~~~
                          {                       }
/Users/y/w/iree-samples/runtime-library/build/include/iree/base/string_view.h:67:53: error: suggest braces around initialization of subobject [-Werror,-Wmissing-braces]
  iree_string_pair_t v = {iree_string_view_empty(), iree_string_view_empty()};
                                                    ^~~~~~~~~~~~~~~~~~~~~~~~
                                                    {                       }
/Users/y/w/iree-samples/runtime-library/build/include/iree/base/string_view.h:74:27: error: suggest braces around initialization of subobject [-Werror,-Wmissing-braces]
  iree_string_pair_t v = {first, second};
                          ^~~~~
                          {    }
/Users/y/w/iree-samples/runtime-library/build/include/iree/base/string_view.h:74:34: error: suggest braces around initialization of subobject [-Werror,-Wmissing-braces]
  iree_string_pair_t v = {first, second};
                                 ^~~~~~
                                 {     }
4 errors generated.
[183/185] Building C object iree_core/runtime/src/iree/vm/CMakeFiles/iree_vm_bytecode_module.objects.dir/bytecode_disasm.c.o
ninja: build stopped: subcommand failed.
@wangkuiyi
Copy link
Contributor Author

wangkuiyi commented Jan 16, 2023

I changed the code into the very plain C style like the following,

  v.first = first, v.second = second;

Then everything went alright.

[2/2] Linking CXX executable bin/ireert_test

And I got build/lib/libireeert.a.

Looks like we wrote "string view.h" as a C++ header file, but including it in "test api.c" makes the compiler think it is a C file.

@wangkuiyi wangkuiyi changed the title CMake build of runtime-library failed [runtime-library] CMake build of runtime-library failed Jan 19, 2023
jpienaar pushed a commit to iree-org/iree that referenced this issue May 1, 2023
This pleases Clang when cross compiling towards iOS (simulator).

Fixes #11865
Fixes iree-org/iree-experimental#93
Thanks to @wangkuiyi for discovering the issue and fix.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant