lerouxrgd / datachannel-rs

Rust wrappers for libdatachannel
Mozilla Public License 2.0
134 stars 26 forks source link

datachannel-sys does not compile on Apple Silicon #35

Closed francisbonneau closed 10 months ago

francisbonneau commented 1 year ago

Hey there! Thank you for your work on this library.

I haven't touched this part of my app for a while but I think it used to work on my M1 macbook? Currently the compilation by Cargo fails with the error below.

Thanks!

  ...
  install ./include/openssl/tls1.h -> /Users/user/work/rust_app/core_bin/target/debug/build/datachannel-sys-0d687241e2ffca33/out/openssl-build/install/include/openssl/tls1.h
  install ./include/openssl/ts.h -> /Users/user/work/rust_app/core_bin/target/debug/build/datachannel-sys-0d687241e2ffca33/out/openssl-build/install/include/openssl/ts.h
  install ./include/openssl/tserr.h -> /Users/user/work/rust_app/core_bin/target/debug/build/datachannel-sys-0d687241e2ffca33/out/openssl-build/install/include/openssl/tserr.h
  install ./include/openssl/txt_db.h -> /Users/user/work/rust_app/core_bin/target/debug/build/datachannel-sys-0d687241e2ffca33/out/openssl-build/install/include/openssl/txt_db.h
  install ./include/openssl/ui.h -> /Users/user/work/rust_app/core_bin/target/debug/build/datachannel-sys-0d687241e2ffca33/out/openssl-build/install/include/openssl/ui.h
  install ./include/openssl/uierr.h -> /Users/user/work/rust_app/core_bin/target/debug/build/datachannel-sys-0d687241e2ffca33/out/openssl-build/install/include/openssl/uierr.h
  install ./include/openssl/whrlpool.h -> /Users/user/work/rust_app/core_bin/target/debug/build/datachannel-sys-0d687241e2ffca33/out/openssl-build/install/include/openssl/whrlpool.h
  install ./include/openssl/x509.h -> /Users/user/work/rust_app/core_bin/target/debug/build/datachannel-sys-0d687241e2ffca33/out/openssl-build/install/include/openssl/x509.h
  install ./include/openssl/x509_vfy.h -> /Users/user/work/rust_app/core_bin/target/debug/build/datachannel-sys-0d687241e2ffca33/out/openssl-build/install/include/openssl/x509_vfy.h
  install ./include/openssl/x509err.h -> /Users/user/work/rust_app/core_bin/target/debug/build/datachannel-sys-0d687241e2ffca33/out/openssl-build/install/include/openssl/x509err.h
  install ./include/openssl/x509v3.h -> /Users/user/work/rust_app/core_bin/target/debug/build/datachannel-sys-0d687241e2ffca33/out/openssl-build/install/include/openssl/x509v3.h
  install ./include/openssl/x509v3err.h -> /Users/user/work/rust_app/core_bin/target/debug/build/datachannel-sys-0d687241e2ffca33/out/openssl-build/install/include/openssl/x509v3err.h
  install libcrypto.a -> /Users/user/work/rust_app/core_bin/target/debug/build/datachannel-sys-0d687241e2ffca33/out/openssl-build/install/lib/libcrypto.a
  install libssl.a -> /Users/user/work/rust_app/core_bin/target/debug/build/datachannel-sys-0d687241e2ffca33/out/openssl-build/install/lib/libssl.a
  created directory `/Users/user/work/rust_app/core_bin/target/debug/build/datachannel-sys-0d687241e2ffca33/out/openssl-build/install/lib/pkgconfig'
  install libcrypto.pc -> /Users/user/work/rust_app/core_bin/target/debug/build/datachannel-sys-0d687241e2ffca33/out/openssl-build/install/lib/pkgconfig/libcrypto.pc
  install libssl.pc -> /Users/user/work/rust_app/core_bin/target/debug/build/datachannel-sys-0d687241e2ffca33/out/openssl-build/install/lib/pkgconfig/libssl.pc
  install openssl.pc -> /Users/user/work/rust_app/core_bin/target/debug/build/datachannel-sys-0d687241e2ffca33/out/openssl-build/install/lib/pkgconfig/openssl.pc
  CMAKE_TOOLCHAIN_FILE_aarch64-apple-darwin = None
  CMAKE_TOOLCHAIN_FILE_aarch64_apple_darwin = None
  HOST_CMAKE_TOOLCHAIN_FILE = None
  CMAKE_TOOLCHAIN_FILE = None
  CMAKE_GENERATOR_aarch64-apple-darwin = None
  CMAKE_GENERATOR_aarch64_apple_darwin = None
  HOST_CMAKE_GENERATOR = None
  CMAKE_GENERATOR = None
  CMAKE_PREFIX_PATH_aarch64-apple-darwin = None
  CMAKE_PREFIX_PATH_aarch64_apple_darwin = None
  HOST_CMAKE_PREFIX_PATH = None
  CMAKE_PREFIX_PATH = None
  CMAKE_aarch64-apple-darwin = None
  CMAKE_aarch64_apple_darwin = None
  HOST_CMAKE = None
  CMAKE = None
  running: cd "/Users/user/work/rust_app/core_bin/target/debug/build/datachannel-sys-0d687241e2ffca33/out/build" && CMAKE_PREFIX_PATH="" "cmake" "/Users/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/datachannel-sys-0.18.3/libdatachannel" "-DCMAKE_OSX_ARCHITECTURES=arm64" "-DNO_WEBSOCKET=ON" "-DNO_EXAMPLES=ON" "-DNO_MEDIA=ON" "-DOPENSSL_ROOT_DIR=/Users/user/work/rust_app/core_bin/target/debug/build/datachannel-sys-0d687241e2ffca33/out/openssl-build/install" "-DOPENSSL_USE_STATIC_LIBS=TRUE" "-DCMAKE_INSTALL_PREFIX=/Users/user/work/rust_app/core_bin/target/debug/build/datachannel-sys-0d687241e2ffca33/out" "-DCMAKE_C_FLAGS= -ffunction-sections -fdata-sections -fPIC -arch arm64" "-DCMAKE_C_COMPILER=/usr/bin/cc" "-DCMAKE_CXX_FLAGS= -ffunction-sections -fdata-sections -fPIC -arch arm64" "-DCMAKE_CXX_COMPILER=/usr/bin/c++" "-DCMAKE_ASM_FLAGS= -ffunction-sections -fdata-sections -fPIC -arch arm64" "-DCMAKE_ASM_COMPILER=/usr/bin/cc" "-DCMAKE_BUILD_TYPE=Debug"
  -- have_sa_len
  -- have_sin_len
  -- have_sin6_len
  -- HAVE_SCONN_LEN
  -- Compiler flags (CMAKE_C_FLAGS):  -ffunction-sections -fdata-sections -fPIC -arch arm64 -std=c99 -pedantic -Wall -Wextra -Wfloat-equal -Wshadow -Wpointer-arith -Wunreachable-code -Winit-self -Wno-unused-function -Wno-unused-parameter -Wno-unreachable-code -Wstrict-prototypes -Werror
  -- Configuring done (0.1s)
  -- Generating done (0.0s)
  -- Build files have been written to: /Users/user/work/rust_app/core_bin/target/debug/build/datachannel-sys-0d687241e2ffca33/out/build
  running: cd "/Users/user/work/rust_app/core_bin/target/debug/build/datachannel-sys-0d687241e2ffca33/out/build" && MAKEFLAGS="-j --jobserver-fds=7,8 --jobserver-auth=7,8" "cmake" "--build" "." "--target" "datachannel-static" "--config" "Debug"
  [ 22%] Built target juice-static
  [ 22%] Building C object deps/usrsctp/usrsctplib/CMakeFiles/usrsctp.dir/netinet/sctp_output.c.o
  [ 22%] Building C object deps/usrsctp/usrsctplib/CMakeFiles/usrsctp.dir/netinet/sctp_indata.c.o
  [ 24%] Building C object deps/usrsctp/usrsctplib/CMakeFiles/usrsctp.dir/netinet/sctp_pcb.c.o
  [ 26%] Building C object deps/usrsctp/usrsctplib/CMakeFiles/usrsctp.dir/netinet/sctp_sysctl.c.o

  --- stderr
  ar: creating archive apps/libapps.a
  ar: creating archive libcrypto.a
  ar: creating archive libssl.a
  /Users/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/datachannel-sys-0.18.3/libdatachannel/deps/usrsctp/usrsctplib/netinet/sctp_sysctl.c:64:18: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
  sctp_init_sysctls()
                   ^
                    void
  1 error generated.
  make[4]: *** [deps/usrsctp/usrsctplib/CMakeFiles/usrsctp.dir/netinet/sctp_sysctl.c.o] Error 1
  make[4]: *** Waiting for unfinished jobs....
  /Users/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/datachannel-sys-0.18.3/libdatachannel/deps/usrsctp/usrsctplib/netinet/sctp_indata.c:3323:6: error: variable 'tot_retrans' set but not used [-Werror,-Wunused-but-set-variable]
          int tot_retrans = 0;
              ^
  1 error generated.
  make[4]: *** [deps/usrsctp/usrsctplib/CMakeFiles/usrsctp.dir/netinet/sctp_indata.c.o] Error 1
  /Users/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/datachannel-sys-0.18.3/libdatachannel/deps/usrsctp/usrsctplib/netinet/sctp_pcb.c:7939:11: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
  sctp_drain()
            ^
             void
  1 error generated.
  /Users/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/datachannel-sys-0.18.3/libdatachannel/deps/usrsctp/usrsctplib/netinet/sctp_output.c:10018:33: error: variable 'cnt_thru' set but not used [-Werror,-Wunused-but-set-variable]
          int no_fragmentflg, bundle_at, cnt_thru;
                                         ^
  make[4]: *** [deps/usrsctp/usrsctplib/CMakeFiles/usrsctp.dir/netinet/sctp_pcb.c.o] Error 1
  1 error generated.
  make[4]: *** [deps/usrsctp/usrsctplib/CMakeFiles/usrsctp.dir/netinet/sctp_output.c.o] Error 1
  make[3]: *** [deps/usrsctp/usrsctplib/CMakeFiles/usrsctp.dir/all] Error 2
  make[2]: *** [CMakeFiles/datachannel-static.dir/rule] Error 2
  make[1]: *** [datachannel-static] Error 2
  thread 'main' panicked at '
  command did not execute successfully, got: exit status: 2

  build script failed, must exit now', /Users/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cmake-0.1.50/src/lib.rs:1098:5
  stack backtrace:
     0: rust_begin_unwind
               at /rustc/458d4dae845ec155b285681a5b88305641abb868/library/std/src/panicking.rs:578:5
     1: core::panicking::panic_fmt
               at /rustc/458d4dae845ec155b285681a5b88305641abb868/library/core/src/panicking.rs:67:14
     2: cmake::fail
     3: cmake::run
     4: cmake::Config::build
     5: build_script_build::main
     6: core::ops::function::FnOnce::call_once
  note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
make: *** [b] Error 101
francisbonneau commented 1 year ago

Saw the note in the readme, I tried again with the following env variables, but I got the same error

export LDFLAGS="-L/opt/homebrew/opt/openssl@3/lib"
export CPPFLAGS="-I/opt/homebrew/opt/openssl@3/include"

export OPENSSL_ROOT_DIR="/opt/homebrew/opt/openssl@3/"
export OPENSSL_LIBRARIES="/opt/homebrew/opt/openssl@3/lib"
francisbonneau commented 1 year ago

Just tried again with the latest changes ( commit bdace62 )

datachannel = { git = "https://github.com/lerouxrgd/datachannel-rs" }

cargo build

...
  install ./include/openssl/storeerr.h -> /Users/user/work/rust_app/target/debug/build/datachannel-sys-b60a6eb0d726573e/out/openssl-build/install/include/openssl/storeerr.h
  install ./include/openssl/symhacks.h -> /Users/user/work/rust_app/target/debug/build/datachannel-sys-b60a6eb0d726573e/out/openssl-build/install/include/openssl/symhacks.h
  install ./include/openssl/tls1.h -> /Users/user/work/rust_app/target/debug/build/datachannel-sys-b60a6eb0d726573e/out/openssl-build/install/include/openssl/tls1.h
  install ./include/openssl/trace.h -> /Users/user/work/rust_app/target/debug/build/datachannel-sys-b60a6eb0d726573e/out/openssl-build/install/include/openssl/trace.h
  install ./include/openssl/ts.h -> /Users/user/work/rust_app/target/debug/build/datachannel-sys-b60a6eb0d726573e/out/openssl-build/install/include/openssl/ts.h
  install ./include/openssl/tserr.h -> /Users/user/work/rust_app/target/debug/build/datachannel-sys-b60a6eb0d726573e/out/openssl-build/install/include/openssl/tserr.h
  install ./include/openssl/txt_db.h -> /Users/user/work/rust_app/target/debug/build/datachannel-sys-b60a6eb0d726573e/out/openssl-build/install/include/openssl/txt_db.h
  install ./include/openssl/types.h -> /Users/user/work/rust_app/target/debug/build/datachannel-sys-b60a6eb0d726573e/out/openssl-build/install/include/openssl/types.h
  install ./include/openssl/ui.h -> /Users/user/work/rust_app/target/debug/build/datachannel-sys-b60a6eb0d726573e/out/openssl-build/install/include/openssl/ui.h
  install ./include/openssl/uierr.h -> /Users/user/work/rust_app/target/debug/build/datachannel-sys-b60a6eb0d726573e/out/openssl-build/install/include/openssl/uierr.h
  install ./include/openssl/whrlpool.h -> /Users/user/work/rust_app/target/debug/build/datachannel-sys-b60a6eb0d726573e/out/openssl-build/install/include/openssl/whrlpool.h
  install ./include/openssl/x509.h -> /Users/user/work/rust_app/target/debug/build/datachannel-sys-b60a6eb0d726573e/out/openssl-build/install/include/openssl/x509.h
  install ./include/openssl/x509_vfy.h -> /Users/user/work/rust_app/target/debug/build/datachannel-sys-b60a6eb0d726573e/out/openssl-build/install/include/openssl/x509_vfy.h
  install ./include/openssl/x509err.h -> /Users/user/work/rust_app/target/debug/build/datachannel-sys-b60a6eb0d726573e/out/openssl-build/install/include/openssl/x509err.h
  install ./include/openssl/x509v3.h -> /Users/user/work/rust_app/target/debug/build/datachannel-sys-b60a6eb0d726573e/out/openssl-build/install/include/openssl/x509v3.h
  install ./include/openssl/x509v3err.h -> /Users/user/work/rust_app/target/debug/build/datachannel-sys-b60a6eb0d726573e/out/openssl-build/install/include/openssl/x509v3err.h
  install libcrypto.a -> /Users/user/work/rust_app/target/debug/build/datachannel-sys-b60a6eb0d726573e/out/openssl-build/install/lib/libcrypto.a
  install libssl.a -> /Users/user/work/rust_app/target/debug/build/datachannel-sys-b60a6eb0d726573e/out/openssl-build/install/lib/libssl.a
  created directory `/Users/user/work/rust_app/target/debug/build/datachannel-sys-b60a6eb0d726573e/out/openssl-build/install/lib/pkgconfig'
  install libcrypto.pc -> /Users/user/work/rust_app/target/debug/build/datachannel-sys-b60a6eb0d726573e/out/openssl-build/install/lib/pkgconfig/libcrypto.pc
  install libssl.pc -> /Users/user/work/rust_app/target/debug/build/datachannel-sys-b60a6eb0d726573e/out/openssl-build/install/lib/pkgconfig/libssl.pc
  install openssl.pc -> /Users/user/work/rust_app/target/debug/build/datachannel-sys-b60a6eb0d726573e/out/openssl-build/install/lib/pkgconfig/openssl.pc
  CMAKE_TOOLCHAIN_FILE_aarch64-apple-darwin = None
  CMAKE_TOOLCHAIN_FILE_aarch64_apple_darwin = None
  HOST_CMAKE_TOOLCHAIN_FILE = None
  CMAKE_TOOLCHAIN_FILE = None
  CMAKE_GENERATOR_aarch64-apple-darwin = None
  CMAKE_GENERATOR_aarch64_apple_darwin = None
  HOST_CMAKE_GENERATOR = None
  CMAKE_GENERATOR = None
  CMAKE_PREFIX_PATH_aarch64-apple-darwin = None
  CMAKE_PREFIX_PATH_aarch64_apple_darwin = None
  HOST_CMAKE_PREFIX_PATH = None
  CMAKE_PREFIX_PATH = None
  CMAKE_aarch64-apple-darwin = None
  CMAKE_aarch64_apple_darwin = None
  HOST_CMAKE = None
  CMAKE = None
  running: cd "/Users/user/work/rust_app/target/debug/build/datachannel-sys-b60a6eb0d726573e/out/build" && CMAKE_PREFIX_PATH="" "cmake" "/Users/user/.cargo/git/checkouts/datachannel-rs-53818dc2b1b154f1/bdace62/datachannel-sys/libdatachannel" "-DCMAKE_OSX_ARCHITECTURES=arm64" "-DNO_WEBSOCKET=ON" "-DNO_EXAMPLES=ON" "-DNO_MEDIA=ON" "-DOPENSSL_ROOT_DIR=/Users/user/work/rust_app/target/debug/build/datachannel-sys-b60a6eb0d726573e/out/openssl-build/install" "-DOPENSSL_USE_STATIC_LIBS=TRUE" "-DCMAKE_INSTALL_PREFIX=/Users/user/work/rust_app/target/debug/build/datachannel-sys-b60a6eb0d726573e/out" "-DCMAKE_C_FLAGS= -ffunction-sections -fdata-sections -fPIC -arch arm64" "-DCMAKE_C_COMPILER=/usr/bin/cc" "-DCMAKE_CXX_FLAGS= -ffunction-sections -fdata-sections -fPIC -arch arm64" "-DCMAKE_CXX_COMPILER=/usr/bin/c++" "-DCMAKE_ASM_FLAGS= -ffunction-sections -fdata-sections -fPIC -arch arm64" "-DCMAKE_ASM_COMPILER=/usr/bin/cc" "-DCMAKE_BUILD_TYPE=Debug"
  -- The CXX compiler identification is AppleClang 14.0.3.14030022
  -- Detecting CXX compiler ABI info
  -- Detecting CXX compiler ABI info - done
  -- Check for working CXX compiler: /usr/bin/c++ - skipped
  -- Detecting CXX compile features
  -- Detecting CXX compile features - done
  -- Performing Test CMAKE_HAVE_LIBC_PTHREAD
  -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
  -- Found Threads: TRUE
  -- The C compiler identification is AppleClang 14.0.3.14030022
  -- Detecting C compiler ABI info
  -- Detecting C compiler ABI info - done
  -- Check for working C compiler: /usr/bin/cc - skipped
  -- Detecting C compile features
  -- Detecting C compile features - done
  -- Looking for include file sys/queue.h
  -- Looking for include file sys/queue.h - found
  -- Looking for include files sys/socket.h, linux/if_addr.h
  -- Looking for include files sys/socket.h, linux/if_addr.h - not found
  -- Looking for include files sys/socket.h, linux/rtnetlink.h
  -- Looking for include files sys/socket.h, linux/rtnetlink.h - not found
  -- Looking for 4 include files sys/types.h, ..., netinet/ip_icmp.h
  -- Looking for 4 include files sys/types.h, ..., netinet/ip_icmp.h - found
  -- Looking for 3 include files sys/types.h, ..., net/route.h
  -- Looking for 3 include files sys/types.h, ..., net/route.h - found
  -- Looking for include file stdatomic.h
  -- Looking for include file stdatomic.h - found
  -- Looking for usrsctp.h
  -- Looking for usrsctp.h - found
  -- Performing Test have_sa_len
  -- Performing Test have_sa_len - Success
  -- have_sa_len
  -- Performing Test have_sin_len
  -- Performing Test have_sin_len - Success
  -- have_sin_len
  -- Performing Test have_sin6_len
  -- Performing Test have_sin6_len - Success
  -- have_sin6_len
  -- Performing Test have_sconn_len
  -- Performing Test have_sconn_len - Success
  -- HAVE_SCONN_LEN
  -- Performing Test has_wfloat_equal
  -- Performing Test has_wfloat_equal - Success
  -- Performing Test has_wshadow
  -- Performing Test has_wshadow - Success
  -- Performing Test has_wpointer_aritih
  -- Performing Test has_wpointer_aritih - Success
  -- Performing Test has_wunreachable_code
  -- Performing Test has_wunreachable_code - Success
  -- Performing Test has_winit_self
  -- Performing Test has_winit_self - Success
  -- Performing Test has_wno_unused_function
  -- Performing Test has_wno_unused_function - Success
  -- Performing Test has_wno_unused_parameter
  -- Performing Test has_wno_unused_parameter - Success
  -- Performing Test has_wno_unreachable_code
  -- Performing Test has_wno_unreachable_code - Success
  -- Performing Test has_wstrict_prototypes
  -- Performing Test has_wstrict_prototypes - Success
  -- Compiler flags (CMAKE_C_FLAGS):  -ffunction-sections -fdata-sections -fPIC -arch arm64 -std=c99 -pedantic -Wall -Wextra -Wfloat-equal -Wshadow -Wpointer-arith -Wunreachable-code -Winit-self -Wno-unused-function -Wno-unused-parameter -Wno-unreachable-code -Wstrict-prototypes -Werror
  -- Performing Test has_wno_address_of_packed_member
  -- Performing Test has_wno_address_of_packed_member - Success
  -- Performing Test has_wno_deprecated_declarations
  -- Performing Test has_wno_deprecated_declarations - Success
  -- Found OpenSSL: /Users/user/work/rust_app/target/debug/build/datachannel-sys-b60a6eb0d726573e/out/openssl-build/install/lib/libcrypto.a (found version "3.1.0")
  -- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY
  -- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY - Success
  -- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY
  -- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY - Success
  -- Performing Test COMPILER_HAS_DEPRECATED_ATTR
  -- Performing Test COMPILER_HAS_DEPRECATED_ATTR - Success
  -- Configuring done (3.5s)
  -- Generating done (0.0s)
  -- Build files have been written to: /Users/user/work/rust_app/target/debug/build/datachannel-sys-b60a6eb0d726573e/out/build
  running: cd "/Users/user/work/rust_app/target/debug/build/datachannel-sys-b60a6eb0d726573e/out/build" && MAKEFLAGS="-j --jobserver-fds=15,18 --jobserver-auth=15,18" "cmake" "--build" "." "--target" "datachannel-static" "--config" "Debug"
  [  2%] Building C object deps/usrsctp/usrsctplib/CMakeFiles/usrsctp.dir/netinet/sctp_asconf.c.o
  [  2%] Building C object deps/usrsctp/usrsctplib/CMakeFiles/usrsctp.dir/netinet/sctp_auth.c.o
  [  4%] Building C object deps/libjuice/CMakeFiles/juice-static.dir/src/const_time.c.o
  [  4%] Building C object deps/libjuice/CMakeFiles/juice-static.dir/src/agent.c.o
  [  4%] Building C object deps/libjuice/CMakeFiles/juice-static.dir/src/crc32.c.o
  [  4%] Building C object deps/usrsctp/usrsctplib/CMakeFiles/usrsctp.dir/netinet/sctp_bsd_addr.c.o
  [  6%] Building C object deps/libjuice/CMakeFiles/juice-static.dir/src/addr.c.o
  [  8%] Building C object deps/usrsctp/usrsctplib/CMakeFiles/usrsctp.dir/netinet/sctp_callout.c.o
  [ 10%] Building C object deps/libjuice/CMakeFiles/juice-static.dir/src/conn.c.o
  [ 10%] Building C object deps/libjuice/CMakeFiles/juice-static.dir/src/conn_poll.c.o
  [ 12%] Building C object deps/libjuice/CMakeFiles/juice-static.dir/src/conn_thread.c.o
  [ 12%] Building C object deps/usrsctp/usrsctplib/CMakeFiles/usrsctp.dir/netinet/sctp_cc_functions.c.o
  [ 14%] Building C object deps/usrsctp/usrsctplib/CMakeFiles/usrsctp.dir/netinet/sctp_crc32.c.o
  [ 14%] Building C object deps/usrsctp/usrsctplib/CMakeFiles/usrsctp.dir/netinet/sctp_indata.c.o
  [ 14%] Building C object deps/libjuice/CMakeFiles/juice-static.dir/src/conn_mux.c.o
  [ 16%] Building C object deps/libjuice/CMakeFiles/juice-static.dir/src/base64.c.o
  [ 18%] Building C object deps/usrsctp/usrsctplib/CMakeFiles/usrsctp.dir/netinet/sctp_input.c.o
  [ 18%] Building C object deps/libjuice/CMakeFiles/juice-static.dir/src/hash.c.o
  [ 20%] Building C object deps/libjuice/CMakeFiles/juice-static.dir/src/hmac.c.o
  [ 20%] Building C object deps/usrsctp/usrsctplib/CMakeFiles/usrsctp.dir/netinet/sctp_output.c.o
  [ 22%] Building C object deps/usrsctp/usrsctplib/CMakeFiles/usrsctp.dir/netinet/sctp_pcb.c.o
  [ 22%] Building C object deps/libjuice/CMakeFiles/juice-static.dir/src/ice.c.o
  [ 24%] Building C object deps/libjuice/CMakeFiles/juice-static.dir/src/juice.c.o
  [ 24%] Building C object deps/libjuice/CMakeFiles/juice-static.dir/src/log.c.o
  [ 26%] Building C object deps/libjuice/CMakeFiles/juice-static.dir/src/random.c.o
  [ 26%] Building C object deps/libjuice/CMakeFiles/juice-static.dir/src/server.c.o
  [ 26%] Building C object deps/libjuice/CMakeFiles/juice-static.dir/src/timestamp.c.o
  [ 28%] Building C object deps/libjuice/CMakeFiles/juice-static.dir/src/stun.c.o
  [ 28%] Building C object deps/libjuice/CMakeFiles/juice-static.dir/src/udp.c.o
  [ 30%] Building C object deps/libjuice/CMakeFiles/juice-static.dir/src/turn.c.o
  [ 32%] Linking C static library libjuice-static.a
  [ 32%] Built target juice-static

  --- stderr
  CMake Warning:
    Manually-specified variables were not used by the project:

      CMAKE_ASM_COMPILER
      CMAKE_ASM_FLAGS

  /Users/user/.cargo/git/checkouts/datachannel-rs-53818dc2b1b154f1/bdace62/datachannel-sys/libdatachannel/deps/libjuice/src/agent.c:118:26: warning: macro 'ATOMIC_VAR_INIT' has been marked as deprecated [-Wdeprecated-pragma]
          agent->selected_entry = ATOMIC_VAR_INIT(NULL);
                                  ^
  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.3/include/stdatomic.h:51:41: note: macro marked 'deprecated' here
  #pragma clang deprecated(ATOMIC_VAR_INIT)
                                          ^
  1 warning generated.
  /Users/user/.cargo/git/checkouts/datachannel-rs-53818dc2b1b154f1/bdace62/datachannel-sys/libdatachannel/deps/usrsctp/usrsctplib/netinet/sctp_indata.c:3323:6: error: variable 'tot_retrans' set but not used [-Werror,-Wunused-but-set-variable]
          int tot_retrans = 0;
              ^
  1 error generated.
  make[4]: *** [deps/usrsctp/usrsctplib/CMakeFiles/usrsctp.dir/netinet/sctp_indata.c.o] Error 1
  make[4]: *** Waiting for unfinished jobs....
  /Users/user/.cargo/git/checkouts/datachannel-rs-53818dc2b1b154f1/bdace62/datachannel-sys/libdatachannel/deps/libjuice/src/log.c:36:46: warning: macro 'ATOMIC_VAR_INIT' has been marked as deprecated [-Wdeprecated-pragma]
  static atomic(juice_log_level_t) log_level = ATOMIC_VAR_INIT(JUICE_LOG_LEVEL_WARN);
                                               ^
  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.3/include/stdatomic.h:51:41: note: macro marked 'deprecated' here
  #pragma clang deprecated(ATOMIC_VAR_INIT)
                                          ^
  1 warning generated.
  /Users/user/.cargo/git/checkouts/datachannel-rs-53818dc2b1b154f1/bdace62/datachannel-sys/libdatachannel/deps/usrsctp/usrsctplib/netinet/sctp_output.c:10018:33: error: variable 'cnt_thru' set but not used [-Werror,-Wunused-but-set-variable]
          int no_fragmentflg, bundle_at, cnt_thru;
                                         ^
  /Users/user/.cargo/git/checkouts/datachannel-rs-53818dc2b1b154f1/bdace62/datachannel-sys/libdatachannel/deps/usrsctp/usrsctplib/netinet/sctp_pcb.c:7939:11: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
  sctp_drain()
            ^
             void
  1 error generated.
  make[4]: *** [deps/usrsctp/usrsctplib/CMakeFiles/usrsctp.dir/netinet/sctp_pcb.c.o] Error 1
  1 error generated.
  make[4]: *** [deps/usrsctp/usrsctplib/CMakeFiles/usrsctp.dir/netinet/sctp_output.c.o] Error 1
  make[3]: *** [deps/usrsctp/usrsctplib/CMakeFiles/usrsctp.dir/all] Error 2
  make[3]: *** Waiting for unfinished jobs....
  make[2]: *** [CMakeFiles/datachannel-static.dir/rule] Error 2
  make[1]: *** [datachannel-static] Error 2
  thread 'main' panicked at '
  command did not execute successfully, got: exit status: 2

  build script failed, must exit now', /Users/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cmake-0.1.50/src/lib.rs:1098:5
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
make: *** [b] Error 101
lerouxrgd commented 1 year ago

Hello,

Sorry for the late reply, I am indeed trying to fix this when I manage to find some time.

Your last error is quite strange since on the CI it works fine for macos-latest... (I don't have a mac to test differently than with the CI sadly)

francisbonneau commented 1 year ago

No worries- thank you for your work on this!

Looking at the Github actions docs if seems that the macos-latest runner image runs macOS 12... while on my machine I'm running the latest version (13.4).

There is a macos-13 runner image in beta, if it builds successfully on that then I suppose it could be a problem with my machine? Or a difference between the x86_64 and arm env?

From the error message, do you think it could be an issue with the underlying dependencies, like usrsctp?

lerouxrgd commented 1 year ago

Do you manage to compile libdatachannel locally if you follow these instructions ?

francisbonneau commented 1 year ago

Hmm no it doesn't compile either, same error it seems

cmake -B build -DUSE_GNUTLS=0 -DUSE_NICE=0 -DCMAKE_BUILD_TYPE=Release
-- have_sa_len
-- have_sin_len
-- have_sin6_len
-- HAVE_SCONN_LEN
-- Compiler flags (CMAKE_C_FLAGS):  -std=c99 -pedantic -Wall -Wextra -Wfloat-equal -Wshadow -Wpointer-arith -Wunreachable-code -Winit-self -Wno-unused-function -Wno-unused-parameter -Wno-unreachable-code -Wstrict-prototypes -Werror
-- Found OpenSSL: /opt/homebrew/opt/openssl@3/lib/libcrypto.dylib (found suitable version "3.1.0", minimum required is "1.1.0")
-- Using warnings: -Wall;-pedantic;-Wextra;-Werror
-- Found PCAP: pcap
-- Found OpenSSL: /opt/homebrew/opt/openssl@3/lib/libcrypto.dylib (found version "3.1.0")
-- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY
-- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY - Success
-- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY
-- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY - Success
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR - Success
-- Using the single-header code from /Users/user/work/libdatachannel/deps/json/single_include/
-- Configuring done (0.7s)
-- Generating done (0.1s)
-- Build files have been written to: /Users/user/work/libdatachannel/build
make -j2
[  0%] Building C object deps/libjuice/CMakeFiles/juice-static.dir/src/addr.c.o
[  0%] Building C object deps/usrsctp/usrsctplib/CMakeFiles/usrsctp.dir/netinet/sctp_asconf.c.o
[  0%] Building C object deps/libjuice/CMakeFiles/juice-static.dir/src/agent.c.o
/Users/user/work/libdatachannel/deps/libjuice/src/agent.c:118:26: warning: macro 'ATOMIC_VAR_INIT' has been marked as deprecated [-Wdeprecated-pragma]
        agent->selected_entry = ATOMIC_VAR_INIT(NULL);
                                ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.3/include/stdatomic.h:51:41: note: macro marked 'deprecated' here
#pragma clang deprecated(ATOMIC_VAR_INIT)
                                        ^
[  1%] Building C object deps/usrsctp/usrsctplib/CMakeFiles/usrsctp.dir/netinet/sctp_auth.c.o
1 warning generated.
[  3%] Building C object deps/libjuice/CMakeFiles/juice-static.dir/src/crc32.c.o
[  3%] Building C object deps/usrsctp/usrsctplib/CMakeFiles/usrsctp.dir/netinet/sctp_bsd_addr.c.o
[  3%] Building C object deps/libjuice/CMakeFiles/juice-static.dir/src/const_time.c.o
[  5%] Building C object deps/usrsctp/usrsctplib/CMakeFiles/usrsctp.dir/netinet/sctp_callout.c.o
[  7%] Building C object deps/libjuice/CMakeFiles/juice-static.dir/src/conn.c.o
[  7%] Building C object deps/libjuice/CMakeFiles/juice-static.dir/src/conn_poll.c.o
[  7%] Building C object deps/usrsctp/usrsctplib/CMakeFiles/usrsctp.dir/netinet/sctp_cc_functions.c.o
[  7%] Building C object deps/libjuice/CMakeFiles/juice-static.dir/src/conn_thread.c.o
[  8%] Building C object deps/libjuice/CMakeFiles/juice-static.dir/src/conn_mux.c.o
[  8%] Building C object deps/usrsctp/usrsctplib/CMakeFiles/usrsctp.dir/netinet/sctp_crc32.c.o
[ 10%] Building C object deps/usrsctp/usrsctplib/CMakeFiles/usrsctp.dir/netinet/sctp_indata.c.o
[ 10%] Building C object deps/libjuice/CMakeFiles/juice-static.dir/src/base64.c.o
[ 10%] Building C object deps/libjuice/CMakeFiles/juice-static.dir/src/hash.c.o
/Users/user/work/libdatachannel/deps/usrsctp/usrsctplib/netinet/sctp_indata.c:3323:6: error: variable 'tot_retrans' set but not used [-Werror,-Wunused-but-set-variable]
        int tot_retrans = 0;
            ^
1 error generated.
make[2]: *** [deps/usrsctp/usrsctplib/CMakeFiles/usrsctp.dir/netinet/sctp_indata.c.o] Error 1
make[1]: *** [deps/usrsctp/usrsctplib/CMakeFiles/usrsctp.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 12%] Building C object deps/libjuice/CMakeFiles/juice-static.dir/src/hmac.c.o
[ 12%] Building C object deps/libjuice/CMakeFiles/juice-static.dir/src/ice.c.o
[ 12%] Building C object deps/libjuice/CMakeFiles/juice-static.dir/src/juice.c.o
[ 14%] Building C object deps/libjuice/CMakeFiles/juice-static.dir/src/log.c.o
[ 14%] Building C object deps/libjuice/CMakeFiles/juice-static.dir/src/random.c.o
/Users/user/work/libdatachannel/deps/libjuice/src/log.c:36:46: warning: macro 'ATOMIC_VAR_INIT' has been marked as deprecated [-Wdeprecated-pragma]
static atomic(juice_log_level_t) log_level = ATOMIC_VAR_INIT(JUICE_LOG_LEVEL_WARN);
                                             ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.3/include/stdatomic.h:51:41: note: macro marked 'deprecated' here
#pragma clang deprecated(ATOMIC_VAR_INIT)
                                        ^
1 warning generated.
[ 14%] Building C object deps/libjuice/CMakeFiles/juice-static.dir/src/server.c.o
[ 16%] Building C object deps/libjuice/CMakeFiles/juice-static.dir/src/stun.c.o
[ 16%] Building C object deps/libjuice/CMakeFiles/juice-static.dir/src/timestamp.c.o
[ 16%] Building C object deps/libjuice/CMakeFiles/juice-static.dir/src/turn.c.o
[ 17%] Building C object deps/libjuice/CMakeFiles/juice-static.dir/src/udp.c.o
[ 17%] Linking C static library libjuice-static.a
[ 17%] Built target juice-static
make: *** [all] Error 2

I will create an issue on the libdatachannel repository- thanks!

francisbonneau commented 1 year ago

Managed to compile libdatachannel after changing a few lines in usrsctp! I created an issue on that repo.

Do you think I should also create an issue on the libdatachannel repo so that they update usrsctp if/when the changes are made? Thanks again

lerouxrgd commented 1 year ago

Yes I think it could be worth reporting it in libdatachannel

paullouisageneau commented 1 year ago

@francisbonneau The compilation errors you encounter seem already fixed by https://github.com/sctplab/usrsctp/commit/e19d122c9f015fc281d7fc541929c887eebe3114 on current usrsctp master branch, so I don't think they should be reported. Could you please confirm that checking out master in deps/usrsctp allows you to compile successfully?

francisbonneau commented 1 year ago

@paullouisageneau you are right, I updated the git submodules and libdatachannel was able to compile successfully on my mac laptop!

cd libdatachannel

git submodule update --recursive --remote
remote: Enumerating objects: 444, done.
remote: Counting objects: 100% (444/444), done.
remote: Compressing objects: 100% (328/328), done.
remote: Total 370 (delta 104), reused 153 (delta 33), pack-reused 0
Receiving objects: 100% (370/370), 3.53 MiB | 11.31 MiB/s, done.
Resolving deltas: 100% (104/104), completed with 52 local objects.
From https://github.com/nlohmann/json
 * [new tag]         v3.10.5    -> v3.10.5
Submodule path '../deps/json': checked out 'a0c1318830519eac027a31edec1a99ce1ae5670e'
From https://github.com/cisco/libsrtp
 * [new tag]         v2         -> v2
 * [new tag]         v2.5       -> v2.5
 * [new tag]         v2.5.0     -> v2.5.0
Submodule path '../deps/libsrtp': checked out '00a7f9bfa23a3ba54e45404f9aab193b953b3ffc'
Submodule path '../deps/plog': checked out '348785326a9e248d25853ff34f624e132c8e43ab'
Submodule path '../deps/usrsctp': checked out 'ac559d2a95277e5e0827e9ee5a1d3b1b50e0822a'
make -j2
[  0%] Building C object deps/libjuice/CMakeFiles/juice-static.dir/src/addr.c.o
[  0%] Building C object deps/usrsctp/usrsctplib/CMakeFiles/usrsctp.dir/netinet/sctp_asconf.c.o
[  0%] Building C object deps/libjuice/CMakeFiles/juice-static.dir/src/agent.c.o
[  1%] Building C object deps/usrsctp/usrsctplib/CMakeFiles/usrsctp.dir/netinet/sctp_auth.c.o
/Users/franck/Desktop/libdatachannel/deps/libjuice/src/agent.c:118:26: warning: macro 'ATOMIC_VAR_INIT' has been marked as deprecated [-Wdeprecated-pragma]
        agent->selected_entry = ATOMIC_VAR_INIT(NULL);
                                ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.3/include/stdatomic.h:51:41: note: macro marked 'deprecated' here
#pragma clang deprecated(ATOMIC_VAR_INIT)
                                        ^
[  1%] Building C object deps/usrsctp/usrsctplib/CMakeFiles/usrsctp.dir/netinet/sctp_bsd_addr.c.o
1 warning generated.
[  3%] Building C object deps/libjuice/CMakeFiles/juice-static.dir/src/crc32.c.o
[  5%] Building C object deps/usrsctp/usrsctplib/CMakeFiles/usrsctp.dir/netinet/sctp_callout.c.o
...
[ 98%] Building CXX object examples/streamer/CMakeFiles/streamer.dir/fileparser.cpp.o
[ 98%] Built target datachannel-copy-paste-capi-offerer
[100%] Building CXX object examples/streamer/CMakeFiles/streamer.dir/stream.cpp.o
[100%] Building CXX object examples/streamer/CMakeFiles/streamer.dir/ArgParser.cpp.o
[100%] Building C object examples/copy-paste-capi/CMakeFiles/datachannel-copy-paste-capi-answerer.dir/answerer.c.o
[100%] Linking C executable answerer
[100%] Built target datachannel-copy-paste-capi-answerer
[100%] Linking CXX executable streamer
[100%] Built target streamer

Merci à vous deux!

lerouxrgd commented 10 months ago

@francisbonneau this should be fixed in 0.11.0, could you give it a try and let me know how it goes ?

francisbonneau commented 10 months ago

It builds now on my M1 Mac!

$ cargo add datachannel
    Updating crates.io index
      Adding datachannel v0.11.0 to dependencies.
             Features:
             + log
             - media
             - tracing
             - vendored
    Updating crates.io index

  $ cargo build
    Updating crates.io index
   Compiling proc-macro2 v1.0.69
   Compiling unicode-ident v1.0.12
   ...
   Compiling derivative v2.2.0
   Compiling datachannel-sys v0.19.1
   Compiling datachannel v0.11.0
   Compiling test_datachannel v0.1.0 (/Users/user/Desktop/test_datachannel)
   Finished dev [unoptimized + debuginfo] target(s) in 20.30s

Merci !!