Building kit-extensions-template-cpp with --no-docker

Hi!

I am trying to build the kit-extensions-template-cpp repo on Ubuntu 22.04 with the --no-docker flag on the build.sh script.

When invoking build.sh without parameters, building works fine, as long as Docker is installed.
But once I try to use the --no-docker flag (after a clean), I get linker errors.

...
/usr/bin/ld: ../../../_build/intermediate/linux-x86_64/omni.example.cpp.ui_widget.python/x86_64/debug/BindCppWidget.o: in function `void omni::ui::StyleContainer::_initializeBlock<omni::ui::StyleColorProperty, char const*>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, omni::ui::StyleColorProperty, char const*)':
/home/jacobs/kit-extension-template-cpp/_compiler/gmake2/omni.example.cpp.ui_widget.python/../../../_build/linux-x86_64/debug/kit/dev/include/omni/ui/StyleContainer.h:319: undefined reference to `omni::ui::StyleContainer::_parseScopeString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, omni::ui::StyleContainer::State&)'
/usr/bin/ld: /home/jacobs/kit-extension-template-cpp/_compiler/gmake2/omni.example.cpp.ui_widget.python/../../../_build/linux-x86_64/debug/kit/dev/include/omni/ui/StyleContainer.h:327: undefined reference to `omni::ui::StyleContainer::_createStyleStateGroup(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:107: ../../../_build/linux-x86_64/debug/exts/omni.example.cpp.ui_widget/omni/example/cpp/ui_widget/_example_cpp_widget.cpython-37m-x86_64-linux-gnu.so] Error 1
make: *** [Makefile:140: omni.example.cpp.ui_widget.python] Error 2
make: *** Waiting for unfinished jobs....
ExampleUsdExtension.cpp
g++   -MMD -MP -DDEBUG -DOMNI_COMPILE_AS_MODULE -DNOMINMAX -DNDEBUG -I../../../include -I../../../_build/target-deps -I../../../_build/target-deps/carb_sdk_plugins/include -I../../../_build/linux-x86_64/debug/kit/dev/include -I../../../source/extensions/omni.example.cpp.usd/include -I../../../source/extensions/omni.example.cpp.usd/plugins/omni.example.cpp.usd -I../../../_build/target-deps/nv_usd/release/include -I../../../_build/target-deps/python/include/python3.7m -m64 -Werror -Wundef -O0 -fPIC -g -std=c++17 -Wall -fvisibility=hidden -D_FILE_OFFSET_BITS=64 -D_GLIBCXX_USE_CXX11_ABI=0 -Wno-deprecated-declarations -Wno-deprecated -Wno-unused-variable -pthread -lstdc++fs -Wno-undef  -o "../../../_build/intermediate/linux-x86_64/omni.example.cpp.usd.plugin/x86_64/debug/ExampleUsdExtension.o" -MF "../../../_build/intermediate/linux-x86_64/omni.example.cpp.usd.plugin/x86_64/debug/ExampleUsdExtension.d" -c "../../../source/extensions/omni.example.cpp.usd/plugins/omni.example.cpp.usd/ExampleUsdExtension.cpp"
Linking omni.example.cpp.usd.plugin
g++ -o "../../../_build/linux-x86_64/debug/exts/omni.example.cpp.usd/bin/libomni.example.cpp.usd.plugin.so" ../../../_build/intermediate/linux-x86_64/omni.example.cpp.usd.plugin/x86_64/debug/ExampleUsdExtension.o   -L../../../_build/target-deps/carb_sdk_plugins/_build/linux-x86_64/debug -L../../../_build/linux-x86_64/debug/kit/plugins -L../../../_build/target-deps/nv_usd/release/lib -L/usr/lib64 -m64 -shared -Wl,-soname=libomni.example.cpp.usd.plugin.so -Wl,-rpath,'$ORIGIN' -Wl,--export-dynamic -Wl,--disable-new-dtags -Wl,-rpath,../../../_build/target-deps/nv_usd/release/lib:../../../_build/target-deps/python/lib: -larch -lgf -lsdf -ltf -lusd -lusdGeom -lusdUtils
[2023-01-18 14:47:11,176][ERROR][omni.repo.man.utils] error running: ['make', '--directory=/home/jacobs/kit-extension-template-cpp/_compiler/gmake2', '--stop', 'config=debug_x86_64', '-j24', '--output-sync', 'verbose=1'], code: 2, message: ""
BUILD FAILED for debug
[2023-01-18 14:47:11,176][ERROR][omni.repo.man.entry] Tool exited with return code: 2, raising exception.
[2023-01-18 14:47:11,176][ERROR][omni.repo.man.entry] Exception encountered while running repo_build via ['tools/repoman/repoman.py', 'build', '--no-docker']:
Traceback (most recent call last):
  File "/home/jacobs/kit-extension-template-cpp/_repo/deps/repo_man/omni/repo/man/entry.py", line 350, in run_tool
    options.func(options)
  File "/home/jacobs/kit-extension-template-cpp/_repo/deps/repo_man/omni/repo/man/entry.py", line 201, in <lambda>
    func=lambda args, func=func, config=merged_tool_config: func(args, config),
  File "/home/jacobs/kit-extension-template-cpp/_repo/deps/repo_build/omni/repo/build/main.py", line 967, in run_repo_tool
    run_build(options, repo_folders, None, config)
  File "/home/jacobs/kit-extension-template-cpp/_repo/deps/repo_build/omni/repo/build/main.py", line 795, in run_build
    build_target=options.target,
  File "/home/jacobs/kit-extension-template-cpp/_repo/deps/repo_build/omni/repo/build/main.py", line 540, in build
    'error_context': settings.build_error_context,
  File "/home/jacobs/kit-extension-template-cpp/_repo/deps/repo_man/omni/repo/man/nvteamcity.py", line 145, in wrapper
    result = func(*args, **kwargs)
  File "/home/jacobs/kit-extension-template-cpp/_repo/deps/repo_build/omni/repo/build/build.py", line 397, in build_with_make
    teamcity_block_name=f"Build {make_platform_target} {config.capitalize()}"
  File "/home/jacobs/kit-extension-template-cpp/_repo/deps/repo_man/omni/repo/man/nvteamcity.py", line 190, in wrapper
    result = func(*args, **kwargs)
  File "/home/jacobs/kit-extension-template-cpp/_repo/deps/repo_build/omni/repo/build/build.py", line 191, in do_build
    sys.exit(returncode)
SystemExit: 2

Do I need special dependencies when building without docker?

Background is that I want to run the build script from an Azure pipeline, and this apparently poses some problems because of the usage of docker in the build process.

I would be interested to know if someone managed to build the repo (on Linux) without docker, and with what setup this is possible.

Any pointers on how the build the repo in an Azure pipeline would be welcome, too. The build fails in the pipeline with ubuntu-latest as base vmImage in the same way as on my local machine. To be honest I am not really familiar with Azure pipelines and their agents, though.

Thanks a lot!

Cheers,
Arne

Hi @arne.jacobs. I’m checking with the team on this.

1 Like

Hi Arne. The dev team tells me that it should be possible to build using --no-docker. You can find the linbuild script to see what it installs, but a lot of it might be project-specific.

For those who have the same problem:

I could not get the kit-extension-template-cpp repo to be built using the --no-docker flag, so I tried to solve the original problem, that the build script would not work in an Azure pipeline because apparently docker is called with -it (–interactive and --tty) arguments.

By looking through the code of linbuild.sh, which I found being installed by the build sript somewhere in /var/tmp/packman/, I came across the line of code which sets these parameters (–interactive and --tty) based on arguments to the linbuild.sh script, but also based on environment variables. As I couldn’t figure out how to hand down arguments to linbuild.sh, I set the environment variable GITLAB_CI for the build script:

GITLAB_CI=1 ./build.sh

Makes sense that the docker use with -it poses the same problems in Gitlab CI as it does in the Azure pipeline, and apparently this solves the problem.
Apparently the people who wrote the linbuild.sh use Gitlab :).

Cheers,
Arne