[davidak@gaming:~/code/nixpkgs]$ nix-build . --system i686-linux -A tbb_2021_8
this derivation will be built:
/nix/store/47s2xyikl9lmd5s699n3cshyf5spgvwh-tbb-2021.8.0.drv
tbb-i686-linux> building '/nix/store/47s2xyikl9lmd5s699n3cshyf5spgvwh-tbb-2021.8.0.drv'
tbb-i686-linux> unpacking sources
tbb-i686-linux> unpacking source archive /nix/store/1xdswxmmyf7dwldb9cz1b9mv4l00wkg0-source
tbb-i686-linux> source root is source
tbb-i686-linux> patching sources
tbb-i686-linux> applying patch /nix/store/2gkdhjwdwr5zgf9h2sd4dfqx56y3c7p5-musl.patch
tbb-i686-linux> patching file src/tbbmalloc_proxy/proxy.h
tbb-i686-linux> configuring
tbb-i686-linux> fixing cmake files...
tbb-i686-linux> cmake flags: -DCMAKE_FIND_USE_SYSTEM_PACKAGE_REGISTRY=OFF -DCMAKE_FIND_USE_PACKAGE_REGISTRY=OFF -DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF -DCMAKE_INSTALL_LOCALEDIR=/nix/store/94bqpc5hyhlif9pj2hwax7wdwd56jwa7-tbb-2021.8.0/share/locale -DCMAKE_INSTALL_LIBEXECDIR=/nix/store/94bqpc5hyhlif9pj2hwax7wdwd56jwa7-tbb-2021.8.0/libexec -DCMAKE_INSTALL_LIBDIR=/nix/store/94bqpc5hyhlif9pj2hwax7wdwd56jwa7-tbb-2021.8.0/lib -DCMAKE_INSTALL_DOCDIR=/nix/store/94bqpc5hyhlif9pj2hwax7wdwd56jwa7-tbb-2021.8.0/share/doc/TBB -DCMAKE_INSTALL_INFODIR=/nix/store/94bqpc5hyhlif9pj2hwax7wdwd56jwa7-tbb-2021.8.0/share/info -DCMAKE_INSTALL_MANDIR=/nix/store/94bqpc5hyhlif9pj2hwax7wdwd56jwa7-tbb-2021.8.0/share/man -DCMAKE_INSTALL_OLDINCLUDEDIR=/nix/store/rk815jajkmdy0655j5n1wvpqb5chrcxf-tbb-2021.8.0-dev/include -DCMAKE_INSTALL_INCLUDEDIR=/nix/store/rk815jajkmdy0655j5n1wvpqb5chrcxf-tbb-2021.8.0-dev/include -DCMAKE_INSTALL_SBINDIR=/nix/store/94bqpc5hyhlif9pj2hwax7wdwd56jwa7-tbb-2021.8.0/sbin -DCMAKE_INSTALL_BINDIR=/nix/store/94bqpc5hyhlif9pj2hwax7wdwd56jwa7-tbb-2021.8.0/bin -DCMAKE_INSTALL_NAME_DIR=/nix/store/94bqpc5hyhlif9pj2hwax7wdwd56jwa7-tbb-2021.8.0/lib -DCMAKE_POLICY_DEFAULT_CMP0025=NEW -DCMAKE_OSX_SYSROOT= -DCMAKE_FIND_FRAMEWORK=LAST -DCMAKE_STRIP=/nix/store/d2vcl1p2fcxlp85i4pdi4dw3j5z1l5d0-gcc-wrapper-11.3.0/bin/strip -DCMAKE_RANLIB=/nix/store/d2vcl1p2fcxlp85i4pdi4dw3j5z1l5d0-gcc-wrapper-11.3.0/bin/ranlib -DCMAKE_AR=/nix/store/d2vcl1p2fcxlp85i4pdi4dw3j5z1l5d0-gcc-wrapper-11.3.0/bin/ar -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_INSTALL_PREFIX=/nix/store/94bqpc5hyhlif9pj2hwax7wdwd56jwa7-tbb-2021.8.0 -DCMAKE_CXX_FLAGS=-m32
tbb-i686-linux> -- The CXX compiler identification is GNU 11.3.0
tbb-i686-linux> -- Detecting CXX compiler ABI info
tbb-i686-linux> -- Detecting CXX compiler ABI info - done
tbb-i686-linux> -- Check for working CXX compiler: /nix/store/d2vcl1p2fcxlp85i4pdi4dw3j5z1l5d0-gcc-wrapper-11.3.0/bin/g++ - skipped
tbb-i686-linux> -- Detecting CXX compile features
tbb-i686-linux> -- Detecting CXX compile features - done
tbb-i686-linux> -- Performing Test CMAKE_HAVE_LIBC_PTHREAD
tbb-i686-linux> -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
tbb-i686-linux> -- Found Threads: TRUE
tbb-i686-linux> -- IPO enabled
tbb-i686-linux> -- The C compiler identification is GNU 11.3.0
tbb-i686-linux> -- Detecting C compiler ABI info
tbb-i686-linux> -- Detecting C compiler ABI info - done
tbb-i686-linux> -- Check for working C compiler: /nix/store/d2vcl1p2fcxlp85i4pdi4dw3j5z1l5d0-gcc-wrapper-11.3.0/bin/gcc - skipped
tbb-i686-linux> -- Detecting C compile features
tbb-i686-linux> -- Detecting C compile features - done
tbb-i686-linux> -- HWLOC target HWLOC::hwloc_1_11 doesn't exist. The tbbbind target cannot be created
tbb-i686-linux> -- HWLOC target HWLOC::hwloc_2 doesn't exist. The tbbbind_2_0 target cannot be created
tbb-i686-linux> -- HWLOC target HWLOC::hwloc_2_5 doesn't exist. The tbbbind_2_5 target cannot be created
tbb-i686-linux> -- Configuring done
tbb-i686-linux> -- Generating done
tbb-i686-linux> CMake Warning:
tbb-i686-linux> Manually-specified variables were not used by the project:
tbb-i686-linux>
tbb-i686-linux> BUILD_TESTING
tbb-i686-linux> CMAKE_EXPORT_NO_PACKAGE_REGISTRY
tbb-i686-linux> CMAKE_POLICY_DEFAULT_CMP0025
tbb-i686-linux>
tbb-i686-linux>
tbb-i686-linux> -- Build files have been written to: /build/source/build
tbb-i686-linux> building
tbb-i686-linux> build flags: -j16 SHELL=/nix/store/wd2bpdy4iwdjxl10pmcfnrkrp64drbpx-bash-5.2-p15/bin/bash
tbb-i686-linux> [ 0%] Building CXX object test/CMakeFiles/_test_malloc_lib_unload.dir/tbbmalloc/test_malloc_lib_unload.cpp.o
tbb-i686-linux> [ 1%] Building CXX object src/tbb/CMakeFiles/tbb.dir/address_waiter.cpp.o
tbb-i686-linux> [ 1%] Building CXX object src/tbb/CMakeFiles/tbb.dir/allocator.cpp.o
...
tbb-i686-linux> [ 45%] Linking CXX executable ../gnu_11.3_cxx11_32_release/test_flow_graph
tbb-i686-linux> [ 45%] Built target test_flow_graph
tbb-i686-linux> [ 45%] Building CXX object test/CMakeFiles/test_join_node_preview.dir/tbb/test_join_node_preview.cpp.o
tbb-i686-linux> during RTL pass: expand
tbb-i686-linux> In file included from /build/source/src/tbb/../../include/tbb/flow_graph.h:17,
tbb-i686-linux> from /build/source/test/tbb/test_flow_graph_whitebox.cpp:35:
tbb-i686-linux> /build/source/src/tbb/../../include/tbb/../oneapi/tbb/flow_graph.h: In member function 'bool tbb::detail::d1::limiter_node<int, int>::_ZThn20_N3tbb6detail2d112limiter_nodeIiiE18register_successorERNS1_8receiverIiEE.artificial_thunk.0(tbb::detail::d1::limiter_node<int, int>::successor_type&)':
tbb-i686-linux> /build/source/src/tbb/../../include/tbb/../oneapi/tbb/flow_graph.h:2032:38: internal compiler error: in expand_expr_real_1, at expr.c:10281
tbb-i686-linux> 2032 | spin_mutex::scoped_lock lock(my_mutex);
tbb-i686-linux> | ^~~~~~~~
tbb-i686-linux> 0x9301fc9 diagnostic_impl(rich_location*, diagnostic_metadata const*, int, char const*, char**, diagnostic_t)
tbb-i686-linux> ???:0
tbb-i686-linux> 0x930218b internal_error(char const*, ...)
tbb-i686-linux> ???:0
tbb-i686-linux> 0x82791d5 fancy_abort(char const*, int, char const*)
tbb-i686-linux> ???:0
tbb-i686-linux> 0x82461f7 expand_expr_real_1(tree_node*, rtx_def*, machine_mode, expand_modifier, rtx_def**, bool) [clone .cold]
tbb-i686-linux> ???:0
tbb-i686-linux> 0x85f68a3 expand_operands(tree_node*, tree_node*, rtx_def*, rtx_def**, rtx_def**, expand_modifier)
tbb-i686-linux> ???:0
tbb-i686-linux> 0x86041fa expand_expr_real_2(separate_ops*, rtx_def*, machine_mode, expand_modifier)
tbb-i686-linux> ???:0
tbb-i686-linux> 0x85f274e expand_expr_real_1(tree_node*, rtx_def*, machine_mode, expand_modifier, rtx_def**, bool)
tbb-i686-linux> ???:0
tbb-i686-linux> 0x85fc165 expand_expr_addr_expr_1(tree_node*, rtx_def*, scalar_int_mode, expand_modifier, unsigned char)
tbb-i686-linux> ???:0
tbb-i686-linux> 0x85fbecf expand_expr_addr_expr_1(tree_node*, rtx_def*, scalar_int_mode, expand_modifier, unsigned char)
tbb-i686-linux> ???:0
tbb-i686-linux> 0x85f23e3 expand_expr_real_1(tree_node*, rtx_def*, machine_mode, expand_modifier, rtx_def**, bool)
tbb-i686-linux> ???:0
tbb-i686-linux> 0x85fe985 store_expr(tree_node*, rtx_def*, int, bool, bool)
tbb-i686-linux> ???:0
tbb-i686-linux> 0x8600098 expand_assignment(tree_node*, tree_node*, bool) [clone .part.0]
tbb-i686-linux> ???:0
tbb-i686-linux> 0x84f4b8a expand_gimple_stmt(gimple*)
tbb-i686-linux> ???:0
tbb-i686-linux> 0x84fb309 (anonymous namespace)::pass_expand::execute(function*)
tbb-i686-linux> ???:0
tbb-i686-linux> Please submit a full bug report,
tbb-i686-linux> with preprocessed source if appropriate.
tbb-i686-linux> Please include the complete backtrace with any bug report.
tbb-i686-linux> See <https://gcc.gnu.org/bugs/> for instructions.
tbb-i686-linux> make[2]: *** [test/CMakeFiles/test_flow_graph_whitebox.dir/build.make:76: test/CMakeFiles/test_flow_graph_whitebox.dir/tbb/test_flow_graph_whitebox.cpp.o] Error 1
tbb-i686-linux> make[1]: *** [CMakeFiles/Makefile2:1558: test/CMakeFiles/test_flow_graph_whitebox.dir/all] Error 2
tbb-i686-linux> make[1]: *** Waiting for unfinished jobs....
tbb-i686-linux> [ 46%] Linking CXX executable ../gnu_11.3_cxx11_32_release/test_multifunction_node
tbb-i686-linux> [ 46%] Built target test_multifunction_node
tbb-i686-linux> [ 46%] Linking CXX executable ../gnu_11.3_cxx11_32_release/test_flow_graph_priorities
tbb-i686-linux> [ 46%] Built target test_flow_graph_priorities
tbb-i686-linux> [ 46%] Linking CXX executable ../gnu_11.3_cxx11_32_release/test_parallel_pipeline
tbb-i686-linux> [ 46%] Built target test_parallel_pipeline
tbb-i686-linux> during RTL pass: expand
tbb-i686-linux> In file included from /build/source/src/tbb/../../include/tbb/flow_graph.h:17,
tbb-i686-linux> from /build/source/test/tbb/test_eh_flow_graph.cpp:25:
tbb-i686-linux> /build/source/src/tbb/../../include/tbb/../oneapi/tbb/flow_graph.h: In member function 'bool tbb::detail::d1::input_node<CheckType<int> >::_ZThn16_N3tbb6detail2tbb-i686-linux> /build/source/src/tbb/../../include/tbb/../oneapi/tbb/flow_graph.h:594:38: internal compiler error: in expand_expr_real_1, at expr.c:10281
tbb-i686-linux> 594 | spin_mutex::scoped_lock lock(my_mutex);
tbb-i686-linux> | ^~~~~~~~
tbb-i686-linux> 0x9301fc9 diagnostic_impl(rich_location*, diagnostic_metadata const*, int, char const*, char**, diagnostic_t)
tbb-i686-linux> ???:0
tbb-i686-linux> 0x930218b internal_error(char const*, ...)
tbb-i686-linux> ???:0
tbb-i686-linux> 0x82791d5 fancy_abort(char const*, int, char const*)
tbb-i686-linux> ???:0
tbb-i686-linux> 0x82461f7 expand_expr_real_1(tree_node*, rtx_def*, machine_mode, expand_modifier, rtx_def**, bool) [clone .cold]
tbb-i686-linux> ???:0
tbb-i686-linux> 0x85f68a3 expand_operands(tree_node*, tree_node*, rtx_def*, rtx_def**, rtx_def**, expand_modifier)
tbb-i686-linux> ???:0
tbb-i686-linux> 0x86041fa expand_expr_real_2(separate_ops*, rtx_def*, machine_mode, expand_modifier)
tbb-i686-linux> ???:0
tbb-i686-linux> 0x85f274e expand_expr_real_1(tree_node*, rtx_def*, machine_mode, expand_modifier, rtx_def**, bool)
tbb-i686-linux> ???:0
tbb-i686-linux> 0x85fc165 expand_expr_addr_expr_1(tree_node*, rtx_def*, scalar_int_mode, expand_modifier, unsigned char)
tbb-i686-linux> ???:0
tbb-i686-linux> 0x85fbecf expand_expr_addr_expr_1(tree_node*, rtx_def*, scalar_int_mode, expand_modifier, unsigned char)
tbb-i686-linux> ???:0
tbb-i686-linux> 0x85f23e3 expand_expr_real_1(tree_node*, rtx_def*, machine_mode, expand_modifier, rtx_def**, bool)
tbb-i686-linux> ???:0
tbb-i686-linux> 0x85fe985 store_expr(tree_node*, rtx_def*, int, bool, bool)
tbb-i686-linux> ???:0
tbb-i686-linux> 0x8600098 expand_assignment(tree_node*, tree_node*, bool) [clone .part.0]
tbb-i686-linux> ???:0
tbb-i686-linux> 0x84f4b8a expand_gimple_stmt(gimple*)
tbb-i686-linux> ???:0
tbb-i686-linux> 0x84fb309 (anonymous namespace)::pass_expand::execute(function*)
tbb-i686-linux> ???:0
tbb-i686-linux> Please submit a full bug report,
tbb-i686-linux> with preprocessed source if appropriate.
tbb-i686-linux> Please include the complete backtrace with any bug report.
tbb-i686-linux> See <https://gcc.gnu.org/bugs/> for instructions.
tbb-i686-linux> make[2]: *** [test/CMakeFiles/test_eh_flow_graph.dir/build.make:76: test/CMakeFiles/test_eh_flow_graph.dir/tbb/test_eh_flow_graph.cpp.o] Error 1
tbb-i686-linux> make[1]: *** [CMakeFiles/Makefile2:1480: test/CMakeFiles/test_eh_flow_graph.dir/all] Error 2
tbb-i686-linux> [ 47%] Linking CXX executable ../gnu_11.3_cxx11_32_release/test_indexer_node
tbb-i686-linux> [ 47%] Built target test_indexer_node
tbb-i686-linux> [ 47%] Linking CXX executable ../gnu_11.3_cxx11_32_release/test_join_node_preview
tbb-i686-linux> [ 47%] Built target test_join_node_preview
tbb-i686-linux> [ 47%] Linking CXX executable ../gnu_11.3_cxx11_32_release/test_concurrent_set
tbb-i686-linux> [ 47%] Linking CXX executable ../gnu_11.3_cxx11_32_release/test_concurrent_map
tbb-i686-linux> [ 47%] Built target test_concurrent_set
tbb-i686-linux> [ 47%] Built target test_concurrent_map
tbb-i686-linux> [ 47%] Linking CXX executable ../gnu_11.3_cxx11_32_release/test_concurrent_hash_map
tbb-i686-linux> [ 47%] Built target test_concurrent_hash_map
tbb-i686-linux> [ 47%] Linking CXX executable ../gnu_11.3_cxx11_32_release/test_join_node_msg_key_matching
tbb-i686-linux> [ 47%] Built target test_join_node_msg_key_matching
tbb-i686-linux> [ 48%] Linking CXX executable ../gnu_11.3_cxx11_32_release/test_concurrent_unordered_set
tbb-i686-linux> [ 48%] Built target test_concurrent_unordered_set
tbb-i686-linux> [ 48%] Linking CXX executable ../gnu_11.3_cxx11_32_release/test_concurrent_unordered_map
tbb-i686-linux> [ 48%] Built target test_concurrent_unordered_map
tbb-i686-linux> [ 49%] Linking CXX executable ../gnu_11.3_cxx11_32_release/test_join_node_msg_key_matching_n_args
tbb-i686-linux> [ 49%] Built target test_join_node_msg_key_matching_n_args
tbb-i686-linux> [ 49%] Linking CXX executable ../gnu_11.3_cxx11_32_release/test_join_node_key_matching
tbb-i686-linux> [ 49%] Built target test_join_node_key_matching
tbb-i686-linux> [ 50%] Linking CXX executable ../gnu_11.3_cxx11_32_release/test_join_node
tbb-i686-linux> [ 50%] Built target test_join_node
tbb-i686-linux> make: *** [Makefile:166: all] Error 2
error: builder for '/nix/store/47s2xyikl9lmd5s699n3cshyf5spgvwh-tbb-2021.8.0.drv' failed with exit code 2;
Tested on NixOS (Linux) 22.11.2620.de5448dab58 (x86_64-linux).
Tested on NixOS (Linux) 22.11.2620.de5448dab58 (x86_64-linux).
I have set
-DCMAKE_CXX_FLAGS=-m32ascmakeFlagsaccording to: https://github.com/oneapi-src/oneTBB/blob/v2021.8.0/cmake/README.md#build-for-32-bitWas also reported at NixOS/nixpkgs#214762 (comment)
and at gcc https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108854