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

error: failed to run custom build command for ui-sys v0.1.3 #38

Closed
hasanOryx opened this issue Sep 25, 2018 · 7 comments · Fixed by #59
Closed

error: failed to run custom build command for ui-sys v0.1.3 #38

hasanOryx opened this issue Sep 25, 2018 · 7 comments · Fixed by #59
Labels
c-bug Bug - some feature is not working as expected k-buildprocess Issues with building the crate p-high High Priority

Comments

@hasanOryx
Copy link

I'm trying to execute the example in the crate.io but got this error, I read #14, #249 and #282 but did not get what shall I do exactly.

I'm at Mac.

The full error is:

Hasans-Air:hello-iui hasan$ cargo build
Compiling proc-macro2 v0.4.19
Compiling unicode-xid v0.1.0
Compiling cc v1.0.25
Compiling failure_derive v0.1.2
Compiling libc v0.2.43
Compiling cfg-if v0.1.5
Compiling rustc-demangle v0.1.9
Compiling bitflags v1.0.4
Compiling backtrace v0.3.9
Compiling cmake v0.1.34
Compiling ui-sys v0.1.3
Compiling quote v0.6.8
Compiling syn v0.14.9
error: failed to run custom build command for ui-sys v0.1.3
process didn't exit successfully: /Users/hasan/hello-iui/target/debug/build/ui-sys-0fdbd7b46e2e8b27/build-script-build (exit code: 101)
--- stdout
git version 2.17.1
running: "cmake" "/Users/hasan/.cargo/registry/src/github.com-1ecc6299db9ec823/ui-sys-0.1.3/libui" "-DCMAKE_INSTALL_PREFIX=/Users/hasan/hello-iui/target/debug/build/ui-sys-95463f95efa66ad5/out" "-DCMAKE_C_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_C_COMPILER=/usr/bin/cc" "-DCMAKE_CXX_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_CXX_COMPILER=/usr/bin/c++" "-DCMAKE_BUILD_TYPE=release"
-- The C compiler identification is AppleClang 10.0.0.10001044
-- The CXX compiler identification is AppleClang 10.0.0.10001044
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- broken
-- Configuring incomplete, errors occurred!
See also "/Users/hasan/hello-iui/target/debug/build/ui-sys-95463f95efa66ad5/out/build/CMakeFiles/CMakeOutput.log".
See also "/Users/hasan/hello-iui/target/debug/build/ui-sys-95463f95efa66ad5/out/build/CMakeFiles/CMakeError.log".

--- stderr
fatal: not a git repository (or any of the parent directories): .git
CMake Error at /usr/local/Cellar/cmake/3.11.4/share/cmake/Modules/CMakeTestCXXCompiler.cmake:45 (message):
The C++ compiler

"/usr/bin/c++"

is not able to compile a simple test program.

It fails with the following output:

Change Dir: /Users/hasan/hello-iui/target/debug/build/ui-sys-95463f95efa66ad5/out/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_31f52/fast"
/Library/Developer/CommandLineTools/usr/bin/make -f CMakeFiles/cmTC_31f52.dir/build.make CMakeFiles/cmTC_31f52.dir/build
Building CXX object CMakeFiles/cmTC_31f52.dir/testCXXCompiler.cxx.o
/usr/bin/c++    -ffunction-sections -fdata-sections -fPIC -m64  -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -mmacosx-version-min=10.8   -o CMakeFiles/cmTC_31f52.dir/testCXXCompiler.cxx.o -c /Users/hasan/hello-iui/target/debug/build/ui-sys-95463f95efa66ad5/out/build/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
warning: include path for stdlibc++ headers not found; pass '-std=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]
1 warning generated.
Linking CXX executable cmTC_31f52
/usr/local/Cellar/cmake/3.11.4/bin/cmake -E cmake_link_script CMakeFiles/cmTC_31f52.dir/link.txt --verbose=1
/usr/bin/c++   -ffunction-sections -fdata-sections -fPIC -m64  -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -mmacosx-version-min=10.8 -Wl,-search_paths_first -Wl,-headerpad_max_install_names   CMakeFiles/cmTC_31f52.dir/testCXXCompiler.cxx.o  -o cmTC_31f52 
clang: warning: libstdc++ is deprecated; move to libc++ with a minimum deployment target of OS X 10.9 [-Wdeprecated]
ld: library not found for -lstdc++
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [cmTC_31f52] Error 1
make: *** [cmTC_31f52/fast] Error 2

CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:35 (project)

thread 'main' panicked at '
command did not execute successfully, got: exit code: 1

build script failed, must exit now', /Users/hasan/.cargo/registry/src/github.com-1ecc6299db9ec823/cmake-0.1.34/src/lib.rs:776:5
note: Run with RUST_BACKTRACE=1 for a backtrace.

warning: build failed, waiting for other jobs to finish...
error: build failed

@ghost
Copy link

ghost commented Oct 8, 2018

@hajsf as a temporary workaround you could try doing the following:

Open /Library/Developer/CommandLineTools/Packages/.
Run the package macOS_SDK_headers_for_macOS_10.14.pkg.

Found at https://blog.driftingruby.com/updated-to-mojave/.
I did not personally test it, hence can't confidently say whether it'd work.

@ghost
Copy link

ghost commented Oct 8, 2018

CXXFLAGS+=-stdlib=libc++ cargo build

The above seems to be also a working solution.

@NoraCodes NoraCodes added c-bug Bug - some feature is not working as expected p-high High Priority k-buildprocess Issues with building the crate labels Oct 17, 2018
@muellermartin
Copy link

I have the same issue.

The solution with the package did not work for me as the directory does not exist on my system. This is probably because I'm still running on macOS 10.13.

The other solution (libc++ as standard library in C++ flags) did work though.

@pomettini
Copy link

pomettini commented Dec 24, 2018

I have the same problem on macOS Mojave 10.14.2. That is a shame, I really wanted to use this library for my next projects 😞

@barzamin
Copy link
Member

i'll look into fixing this over the next few weeks, if nobody else gets around to it.

@barzamin
Copy link
Member

this is an upstream issue in libui (andlabs/libui#422) caused by an even further upstream issue in CMake

@barzamin
Copy link
Member

and I think I was able to fix it on our side! logic is basically just adding --stdlib=libc++ to CXXFLAGS when TARGET is an apple triple, via some code in build.rs. PR is #59.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c-bug Bug - some feature is not working as expected k-buildprocess Issues with building the crate p-high High Priority
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants