usd-rs
usd-rs copied to clipboard
Build fails on macOS
error: failed to run custom build command for `usd-cpp v0.1.1 (/Users/moritz/code/crates/usd-rs/usd-cpp)`
Caused by:
process didn't exit successfully: `/Users/moritz/code/crates/usd-rs/target/debug/build/usd-cpp-103d19c2b61e87e6/build-script-build` (exit code: 101)
--- stdout
cargo:rerun-if-changed=thirdparty/USD
Downloading dependencies and building USD c++ library
Building with settings:
USD source directory /Users/moritz/code/crates/usd-rs/usd-cpp/thirdparty/USD
USD install directory /Users/moritz/code/crates/usd-rs/target/debug/build/usd-cpp-6db59cde01cd4cb4/out/install
3rd-party source directory /Users/moritz/code/crates/usd-rs/target/debug/build/usd-cpp-6db59cde01cd4cb4/out/install/src
3rd-party install directory /Users/moritz/code/crates/usd-rs/target/debug/build/usd-cpp-6db59cde01cd4cb4/out/install
Build directory /Users/moritz/code/crates/usd-rs/target/debug/build/usd-cpp-6db59cde01cd4cb4/out/install/build
CMake generator Default
Downloader curl
Building Monolithic shared library
Config Release
Imaging Off
Ptex support: Off
OpenVDB support: Off
OpenImageIO support: Off
OpenColorIO support: Off
PRMan support: Off
UsdImaging Off
usdview: Off
Python support Off
Python 3: Off
Documentation Off
Tests Off
Examples Off
Tutorials Off
Tools Off
Alembic Plugin Off
HDF5 support: Off
Draco Plugin Off
MaterialX Plugin Off
Dependencies zlib, boost, TBB
STATUS: Installing zlib...
STATUS: Installing boost...
2020-12-25 03:10
./bootstrap.sh --prefix="/Users/moritz/code/crates/usd-rs/target/debug/build/usd-cpp-6db59cde01cd4cb4/out/install"
Building Boost.Build engine with toolset darwin...
Failed to build Boost.Build build engine
Consult 'bootstrap.log' for more details
ERROR: Failed to run './bootstrap.sh --prefix="/Users/moritz/code/crates/usd-rs/target/debug/build/usd-cpp-6db59cde01cd4cb4/out/install"'
See /Users/moritz/code/crates/usd-rs/target/debug/build/usd-cpp-6db59cde01cd4cb4/out/install/src/boost_1_61_0/log.txt for more details.
--- stderr
thread 'main' panicked at 'assertion failed: result.success()', usd-cpp/build.rs:54:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
The reason seems to be -werror. See attached bootstrap.log.
On that note: kudos for starting this wrapper and happy holidays! 🎄🦀🥳
thanks! kudos for being one of the few people testing it.
Looks like it's failing in the general usd download and build.
Can you tell me what versions of clang and cmake you're on ? I'm on mac also.
cmake 3.19.2
Apple clang version 12.0.0 (clang-1200.0.32.27)
Ah sorry have been off the radar for a short while. I'm building on clang 11. Could be the 12 has additional warnings. Might be able to patch the build for boost to disable -werror.
I ran into the same issue. If it helps, this is bootstrap.log:
###
### Using 'darwin' toolset.
###
rm -rf bootstrap
mkdir bootstrap
cc -o bootstrap/jam0 command.c compile.c constants.c debug.c execcmd.c frames.c function.c glob.c hash.c hdrmacro.c headers.c jam.c jambase.c jamgram.c lists.c make.c make1.c object.c option.c output.c parse.c pathsys.c regexp.c rules.c scan.c search.c subst.c timestamp.c variable.c modules.c strings.c filesys.c builtins.c class.c cwd.c native.c md5.c w32_getreg.c modules/set.c modules/path.c modules/regex.c modules/property-set.c modules/sequence.c modules/order.c execunix.c fileunix.c pathunix.c
execcmd.c:120:5: error: implicit declaration of function 'out_printf' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
out_printf( "...interrupted\n" );
^
1 error generated.
make.c:132:13: error: implicit declaration of function 'out_printf' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
out_printf( "...found %d target%s...\n", counts->targets,
^
make.c:184:17: error: implicit declaration of function 'out_printf' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
out_printf( "fate change %s from %s to %s (as dependant of %s)\n",
^
make.c:215:17: error: implicit declaration of function 'out_printf' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
out_printf( "fate change %s from %s to %s (by rebuild)\n",
^
make.c:300:9: error: implicit declaration of function 'out_printf' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
out_printf( "make\t--\t%s%s\n", spaces( depth ), object_str( t->name ) );
^
make.c:300:41: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int]
out_printf( "make\t--\t%s%s\n", spaces( depth ), object_str( t->name ) );
^~~~~~~~~~~~~~~
make.c:85:44: note: expanded from macro 'spaces'
#define spaces(x) ( " " + ( x > 20 ? 0 : 20-x ) )
~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
make.c:300:41: note: use array indexing to silence this warning
make.c:85:44: note: expanded from macro 'spaces'
#define spaces(x) ( " " + ( x > 20 ? 0 : 20-x ) )
^
make.c:307:41: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int]
out_printf( "make\t--\t%s%s\n", spaces( depth ), object_str( t->name ) );
^~~~~~~~~~~~~~~
make.c:85:44: note: expanded from macro 'spaces'
#define spaces(x) ( " " + ( x > 20 ? 0 : 20-x ) )
~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
make.c:307:41: note: use array indexing to silence this warning
make.c:85:44: note: expanded from macro 'spaces'
#define spaces(x) ( " " + ( x > 20 ? 0 : 20-x ) )
^
make.c:380:49: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int]
out_printf( "bind\t--\t%s%s: %s\n", spaces( depth ),
^~~~~~~~~~~~~~~
make.c:85:44: note: expanded from macro 'spaces'
#define spaces(x) ( " " + ( x > 20 ? 0 : 20-x ) )
~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
make.c:380:49: note: use array indexing to silence this warning
make.c:85:44: note: expanded from macro 'spaces'
#define spaces(x) ( " " + ( x > 20 ? 0 : 20-x ) )
^
make.c:388:49: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int]
out_printf( "time\t--\t%s%s: %s\n", spaces( depth ),
^~~~~~~~~~~~~~~
make.c:85:44: note: expanded from macro 'spaces'
#define spaces(x) ( " " + ( x > 20 ? 0 : 20-x ) )
~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
make.c:388:49: note: use array indexing to silence this warning
make.c:85:44: note: expanded from macro 'spaces'
#define spaces(x) ( " " + ( x > 20 ? 0 : 20-x ) )
^
make.c:393:49: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int]
out_printf( "time\t--\t%s%s: %s\n", spaces( depth ),
^~~~~~~~~~~~~~~
make.c:85:44: note: expanded from macro 'spaces'
#define spaces(x) ( " " + ( x > 20 ? 0 : 20-x ) )
~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
make.c:393:49: note: use array indexing to silence this warning
make.c:85:44: note: expanded from macro 'spaces'
#define spaces(x) ( " " + ( x > 20 ? 0 : 20-x ) )
^
make.c:735:13: error: implicit declaration of function 'out_flush' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
out_flush();
^
make.c:758:13: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int]
spaces( depth ), object_str( t->name ) );
^~~~~~~~~~~~~~~
make.c:85:44: note: expanded from macro 'spaces'
#define spaces(x) ( " " + ( x > 20 ? 0 : 20-x ) )
~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
make.c:758:13: note: use array indexing to silence this warning
make.c:85:44: note: expanded from macro 'spaces'
#define spaces(x) ( " " + ( x > 20 ? 0 : 20-x ) )
^
6 warnings and 5 errors generated.
filesys.c:360:10: error: implicit declaration of function 'filelist_empty' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
if ( filelist_empty( archive->members ) )
^
filesys.c:496:10: error: implicit declaration of function 'filelist_empty' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
if ( filelist_empty( list ) )
^
filesys.c:534:10: error: implicit declaration of function 'filelist_empty' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
if ( filelist_empty( list ) )
^
filesys.c:570:10: error: implicit declaration of function 'filelist_empty' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
if ( filelist_empty( list ) ) return list;
^
filesys.c:593:11: error: implicit declaration of function 'filelist_empty' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
if ( !filelist_empty( list ) ) result = list->size;
^
filesys.c:602:10: error: implicit declaration of function 'filelist_empty' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
if ( filelist_empty( list ) ) return;
^
6 errors generated.
modules/path.c:16:12: error: implicit declaration of function 'file_query' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
return file_query( list_front( lol_get( frame->args, 0 ) ) ) ?
^
1 error generated.
fileunix.c:233:10: error: implicit declaration of function 'filelist_empty' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
if ( filelist_empty( archive->members ) )
^
fileunix.c:235:14: error: implicit declaration of function 'file_collect_archive_content_' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
if ( file_collect_archive_content_( archive ) < 0 )
^
fileunix.c:235:14: note: did you mean 'file_collect_dir_content_'?
fileunix.c:110:5: note: 'file_collect_dir_content_' declared here
int file_collect_dir_content_( file_info_t * const d )
^
fileunix.c:294:12: error: implicit declaration of function 'filelist_empty' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
if ( ! filelist_empty( archive->members ) ) filelist_free( archive->members );
^
3 errors generated.
It looks related to this issue: https://www.gitmemory.com/issue/boostorg/build/664/714882384 "Clang now reports an error when you use a function without an explicit declaration when building C or Objective-C code for macOS (-Werror=implicit-function-declaration flag is on). This additional error detection unifies Clang’s behavior for iOS/tvOS and macOS 64-bit targets for this diagnostic. (49917738)"
ok thanks, it's an issue with usd build itself. usd-rs is downloading and building usd. I'll try to fix this up tomorrow to ignore. @virtualritz and @woelper. What if I change the crate to only download and build usd if a feature is enabled. This would allow you guys to build it yourselves and usd-rs can point to your build. That seems like a more standard approach ... ?
What if I change the crate to only download and build usd if a feature is enabled.
That is the approach I use with my nsi crate but it's for a binary (runtime) dependency – 3Delight.
What do for my *-sys crates mostly now is that I have a subrepo for each C/C++ dependency (and dependencies of dedpencies etc.). I try to build all of them via build.rs.
Since they're subrepos they do not add baggage if someone just clones the repo w/o --recursive.
Option two is behind a feature flag, as you suggested. Then the build instead uses something like FOO_ROOT for a libfoo dependency, to find it.
A third option (behind an aptly named feature too) is to use the vcpkg crate to install deps w/o haggling with stuff like the cmake etc. crates.
But that requires an existing vcpkg installation, all deps avaiable in there, the vcpkg builds working for all targeted platforms and with the right feature flags set that you depend on for each dep. A lot of boxes to tick as one learns when using vcpkg.
I.e. ideally (maximum build time ergonomics), the crate user can select one of three:
- Build all
C/C++deps. from subrepo sources (default). - Use
vcpkgto build deps. - Try to find deps on the system/use an env. var to tell the
build.rswhere to look for them.
That's a sweet looking crate (nsi)! I'm gonna have to try it.
I'm gonna have to try it. Please do! :) And please do not hesitate to give honest feedback. If something could be better/different, tell me. It was my first Rust binding and I rewrote it about three times from scratch along the way. In fact, I am working on another iteration now but it's mostly the same, for the end user.
I tried to find a sweet spot with the Rust API. Replicating the original, C, one & a bit of the C++ wrapper but staying true to Rust idioms too.
Not sure how much I succeeded. Particularly with the output feature that uses Rust closures to replicate C callbacks. There would be other options on how to map this to Rust.
Good intro to NSI is here. NSI is basically a successor for the RenderMan Interface + RenderMan Shading Language. Aka: NSI + OSL.
Updating USD and passing --generator Xcode to the USD build script, I was able to get this to build on MacOS: https://github.com/HackerFoo/usd-rs/commit/33c5c0d54db2207c3ad934cd6edf0588cb5610c5
Now I'm trying to get it to build for iOS, which requires a staticlib.
EDIT: It's probably not feasible any time soon: https://github.com/PixarAnimationStudios/USD/issues/700
Wow awesome job! Can you make a PR and I'll merge it?
Sent from ProtonMail mobile
-------- Original Message -------- On 29 Aug 2021, 20:28, Dusty DeWeese wrote:
Updating USD and passing --generator Xcode to the USD build script, I was able to get this to build on MacOS: @.***(https://github.com/HackerFoo/usd-rs/commit/33c5c0d54db2207c3ad934cd6edf0588cb5610c5)
Now I'm trying to get it to build for iOS, which requires a staticlib.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.
EDIT: It's probably not feasible any time soon
Yeah TBB is a pain for this. They explicitly do not support staticlib. I think at some point the vfx industry needs to agree on a basic abstraction for threading which can have the back end swapped out.
I initially looked at doing a static build for this lib then decided it was best to keep it shared for the moment.
@virtualritz I've pushed a branch with changes suggested by @HackerFoo .
https://github.com/luke-titley/usd-rs/tree/feature/update_to_v21.08
Am working from linux at the moment. If you want to test...