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

OpenSSL static linking for Mac M1(arm64) #229

Closed
murat-dogan opened this issue Mar 19, 2024 · 13 comments
Closed

OpenSSL static linking for Mac M1(arm64) #229

murat-dogan opened this issue Mar 19, 2024 · 13 comments

Comments

@murat-dogan
Copy link
Owner

Currently we are linking OpenSSL as dynamically and want to change that.

if(NOT ${NODE_ARCH} STREQUAL "arm64")
set(OPENSSL_USE_STATIC_LIBS TRUE)
find_package(OpenSSL REQUIRED)
endif()

@murat-dogan
Copy link
Owner Author

I created a branch for that and built the binary.
The binary size is too small for me, so I suspect it is not statically built yet.
https://github.com/murat-dogan/node-datachannel/releases/download/v0.5.6-dev/node-datachannel-v0.5.6-dev-napi-v8-darwin-arm64.tar.gz

Also, the binary size is the same as v0.5.5

If this is the case, then it should be statically built.
Could you please confirm that?
#178 (comment)

@murat-dogan
Copy link
Owner Author

Also from action log as I see it is linking as static.

- Found OpenSSL: /tmp/opt/R/arm64/lib/libcrypto.a (found suitable version "1.1.1o", minimum required is "1.1.0")  
-- Found PCAP: pcap  
-- Found OpenSSL: /tmp/opt/R/arm64/lib/libcrypto.a (found version "1.1.1o")  

https://github.com/murat-dogan/node-datachannel/actions/runs/8332998451/job/22803445206

@SgtPooki
Copy link

If this is the case, then it should be statically built.
Could you please confirm that?
#178 (comment)

Do you need more from me here? I believe the changes previously mentioned build fine on macos. I can attempt to uninstall openssl3 or at least block access to it if that would help

@murat-dogan
Copy link
Owner Author

Yes please also test to be sure that it is statically built.
As I mentioned the binary size is suspicious.

@SgtPooki
Copy link

Note for me to check if node-datachannel is building universal binary. (And links for looking later)

fails-components/webtransport#96 creates arm builds that actually references this project

Comments in https://stackoverflow.com/a/65811061 talk about how to do this prior to building cmakelist

@SgtPooki
Copy link

latest otool shows:

╰─ ✘ INT ❯ otool -L /Users/sgtpooki/Downloads/build/Release/node_datachannel.node
/Users/sgtpooki/Downloads/build/Release/node_datachannel.node:
	@rpath/node_datachannel.node (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1200.3.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1311.0.0)

build of arm64-static-openssl branch shows:

> [email protected] build
> cmake-js build

[
  '/Users/sgtpooki/.asdf/installs/nodejs/18.16.1/bin/node',
  '/Users/sgtpooki/code/work/foss/murat-dogan/node-datachannel/node_modules/.bin/cmake-js',
  'build'
]
info TOOL Using Unix Makefiles generator.
info CMD CONFIGURE
info RUN [
info RUN   'cmake',
info RUN   '/Users/sgtpooki/code/work/foss/murat-dogan/node-datachannel',
info RUN   '--no-warn-unused-cli',
info RUN   '-G',
info RUN   'Unix Makefiles',
info RUN   '-DCMAKE_JS_VERSION=6.3.2',
info RUN   '-DCMAKE_BUILD_TYPE=Release',
info RUN   '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/Users/sgtpooki/code/work/foss/murat-dogan/node-datachannel/build/Release',
info RUN   '-DCMAKE_JS_INC=/Users/sgtpooki/.cmake-js/node-arm64/v18.16.1/include/node',
info RUN   '-DCMAKE_JS_SRC=',
info RUN   '-DNODE_RUNTIME=node',
info RUN   '-DNODE_RUNTIMEVERSION=18.16.1',
info RUN   '-DNODE_ARCH=arm64',
info RUN   '-DCMAKE_OSX_ARCHITECTURES=arm64',
info RUN   '-DCMAKE_CXX_FLAGS=-D_DARWIN_USE_64_BIT_INODE=1 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DBUILDING_NODE_EXTENSION',
info RUN   '-DCMAKE_SHARED_LINKER_FLAGS=-undefined dynamic_lookup'
info RUN ]
Not searching for unused variables given on the command line.
-- The C compiler identification is AppleClang 15.0.0.15000309
-- The CXX compiler identification is AppleClang 15.0.0.15000309
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found OpenSSL: /opt/homebrew/Cellar/openssl@3/3.2.1/lib/libcrypto.a (found version "3.2.1")  
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- 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):  -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
-- 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
-- Looking for arpa/inet.h
-- Looking for arpa/inet.h - found
-- Looking for byteswap.h
-- Looking for byteswap.h - not found
-- Looking for inttypes.h
-- Looking for inttypes.h - found
-- Looking for machine/types.h
-- Looking for machine/types.h - found
-- Looking for netinet/in.h
-- Looking for netinet/in.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stdlib.h
-- Looking for stdlib.h - found
-- Looking for sys/int_types.h
-- Looking for sys/int_types.h - not found
-- Looking for sys/socket.h
-- Looking for sys/socket.h - found
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for unistd.h
-- Looking for unistd.h - found
-- Looking for windows.h
-- Looking for windows.h - not found
-- Looking for winsock2.h
-- Looking for winsock2.h - not found
-- Looking for sigaction
-- Looking for sigaction - found
-- Looking for inet_aton
-- Looking for inet_aton - found
-- Looking for inet_pton
-- Looking for inet_pton - found
-- Looking for usleep
-- Looking for usleep - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of uint8_t
-- Check size of uint8_t - done
-- Check size of uint16_t
-- Check size of uint16_t - done
-- Check size of uint32_t
-- Check size of uint32_t - done
-- Check size of uint64_t
-- Check size of uint64_t - done
-- Check size of int32_t
-- Check size of int32_t - done
-- Check size of unsigned long
-- Check size of unsigned long - done
-- Check size of unsigned long long
-- Check size of unsigned long long - done
-- Performing Test HAVE_INLINE
-- Performing Test HAVE_INLINE - Success
-- Found OpenSSL: /opt/homebrew/Cellar/openssl@3/3.2.1/lib/libcrypto.a (found suitable version "3.2.1", minimum required is "1.1.0")  
-- Found PCAP: pcap  
-- Found OpenSSL: /opt/homebrew/Cellar/openssl@3/3.2.1/lib/libcrypto.a (found version "3.2.1")  
-- 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 multi-header code from /Users/sgtpooki/code/work/foss/murat-dogan/node-datachannel/build/_deps/libdatachannel-src/deps/json/include/
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/sgtpooki/code/work/foss/murat-dogan/node-datachannel/build
info CMD BUILD
info RUN [
info RUN   'cmake',
info RUN   '--build',
info RUN   '/Users/sgtpooki/code/work/foss/murat-dogan/node-datachannel/build',
info RUN   '--config',
info RUN   'Release'
info RUN ]
[  2%] Building C object _deps/libdatachannel-build/deps/libjuice/CMakeFiles/juice-static.dir/src/addr.c.o
[  2%] Building C object _deps/libdatachannel-build/deps/libjuice/CMakeFiles/juice-static.dir/src/agent.c.o
/Users/sgtpooki/code/work/foss/murat-dogan/node-datachannel/build/_deps/libdatachannel-src/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/15.0.0/include/stdatomic.h:54:41: note: macro marked 'deprecated' here
#pragma clang deprecated(ATOMIC_VAR_INIT)
                                        ^
1 warning generated.
[  2%] Building C object _deps/libdatachannel-build/deps/libjuice/CMakeFiles/juice-static.dir/src/crc32.c.o
[  4%] Building C object _deps/libdatachannel-build/deps/libjuice/CMakeFiles/juice-static.dir/src/const_time.c.o
[  4%] Building C object _deps/libdatachannel-build/deps/libjuice/CMakeFiles/juice-static.dir/src/conn.c.o
[  4%] Building C object _deps/libdatachannel-build/deps/libjuice/CMakeFiles/juice-static.dir/src/conn_poll.c.o
[  6%] Building C object _deps/libdatachannel-build/deps/libjuice/CMakeFiles/juice-static.dir/src/conn_thread.c.o
[  6%] Building C object _deps/libdatachannel-build/deps/libjuice/CMakeFiles/juice-static.dir/src/conn_mux.c.o
[  8%] Building C object _deps/libdatachannel-build/deps/libjuice/CMakeFiles/juice-static.dir/src/base64.c.o
[  8%] Building C object _deps/libdatachannel-build/deps/libjuice/CMakeFiles/juice-static.dir/src/hash.c.o
[  8%] Building C object _deps/libdatachannel-build/deps/libjuice/CMakeFiles/juice-static.dir/src/hmac.c.o
[ 10%] Building C object _deps/libdatachannel-build/deps/libjuice/CMakeFiles/juice-static.dir/src/ice.c.o
[ 10%] Building C object _deps/libdatachannel-build/deps/libjuice/CMakeFiles/juice-static.dir/src/juice.c.o
[ 10%] Building C object _deps/libdatachannel-build/deps/libjuice/CMakeFiles/juice-static.dir/src/log.c.o
/Users/sgtpooki/code/work/foss/murat-dogan/node-datachannel/build/_deps/libdatachannel-src/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/15.0.0/include/stdatomic.h:54:41: note: macro marked 'deprecated' here
#pragma clang deprecated(ATOMIC_VAR_INIT)
                                        ^
1 warning generated.
[ 12%] Building C object _deps/libdatachannel-build/deps/libjuice/CMakeFiles/juice-static.dir/src/random.c.o
[ 12%] Building C object _deps/libdatachannel-build/deps/libjuice/CMakeFiles/juice-static.dir/src/server.c.o
[ 12%] Building C object _deps/libdatachannel-build/deps/libjuice/CMakeFiles/juice-static.dir/src/stun.c.o
[ 14%] Building C object _deps/libdatachannel-build/deps/libjuice/CMakeFiles/juice-static.dir/src/timestamp.c.o
[ 14%] Building C object _deps/libdatachannel-build/deps/libjuice/CMakeFiles/juice-static.dir/src/turn.c.o
[ 14%] Building C object _deps/libdatachannel-build/deps/libjuice/CMakeFiles/juice-static.dir/src/udp.c.o
[ 17%] Linking C static library libjuice-static.a
[ 17%] Built target juice-static
[ 17%] Building C object _deps/libdatachannel-build/deps/usrsctp/usrsctplib/CMakeFiles/usrsctp.dir/netinet/sctp_asconf.c.o
[ 19%] Building C object _deps/libdatachannel-build/deps/usrsctp/usrsctplib/CMakeFiles/usrsctp.dir/netinet/sctp_auth.c.o
[ 19%] Building C object _deps/libdatachannel-build/deps/usrsctp/usrsctplib/CMakeFiles/usrsctp.dir/netinet/sctp_bsd_addr.c.o
[ 19%] Building C object _deps/libdatachannel-build/deps/usrsctp/usrsctplib/CMakeFiles/usrsctp.dir/netinet/sctp_callout.c.o
[ 21%] Building C object _deps/libdatachannel-build/deps/usrsctp/usrsctplib/CMakeFiles/usrsctp.dir/netinet/sctp_cc_functions.c.o
[ 21%] Building C object _deps/libdatachannel-build/deps/usrsctp/usrsctplib/CMakeFiles/usrsctp.dir/netinet/sctp_crc32.c.o
[ 21%] Building C object _deps/libdatachannel-build/deps/usrsctp/usrsctplib/CMakeFiles/usrsctp.dir/netinet/sctp_indata.c.o
[ 23%] Building C object _deps/libdatachannel-build/deps/usrsctp/usrsctplib/CMakeFiles/usrsctp.dir/netinet/sctp_input.c.o
[ 23%] Building C object _deps/libdatachannel-build/deps/usrsctp/usrsctplib/CMakeFiles/usrsctp.dir/netinet/sctp_output.c.o
[ 25%] Building C object _deps/libdatachannel-build/deps/usrsctp/usrsctplib/CMakeFiles/usrsctp.dir/netinet/sctp_pcb.c.o
[ 25%] Building C object _deps/libdatachannel-build/deps/usrsctp/usrsctplib/CMakeFiles/usrsctp.dir/netinet/sctp_peeloff.c.o
[ 25%] Building C object _deps/libdatachannel-build/deps/usrsctp/usrsctplib/CMakeFiles/usrsctp.dir/netinet/sctp_sha1.c.o
[ 27%] Building C object _deps/libdatachannel-build/deps/usrsctp/usrsctplib/CMakeFiles/usrsctp.dir/netinet/sctp_ss_functions.c.o
[ 27%] Building C object _deps/libdatachannel-build/deps/usrsctp/usrsctplib/CMakeFiles/usrsctp.dir/netinet/sctp_sysctl.c.o
[ 27%] Building C object _deps/libdatachannel-build/deps/usrsctp/usrsctplib/CMakeFiles/usrsctp.dir/netinet/sctp_timer.c.o
[ 29%] Building C object _deps/libdatachannel-build/deps/usrsctp/usrsctplib/CMakeFiles/usrsctp.dir/netinet/sctp_userspace.c.o
[ 29%] Building C object _deps/libdatachannel-build/deps/usrsctp/usrsctplib/CMakeFiles/usrsctp.dir/netinet/sctp_usrreq.c.o
[ 29%] Building C object _deps/libdatachannel-build/deps/usrsctp/usrsctplib/CMakeFiles/usrsctp.dir/netinet/sctputil.c.o
[ 31%] Building C object _deps/libdatachannel-build/deps/usrsctp/usrsctplib/CMakeFiles/usrsctp.dir/netinet6/sctp6_usrreq.c.o
[ 31%] Building C object _deps/libdatachannel-build/deps/usrsctp/usrsctplib/CMakeFiles/usrsctp.dir/user_environment.c.o
[ 31%] Building C object _deps/libdatachannel-build/deps/usrsctp/usrsctplib/CMakeFiles/usrsctp.dir/user_mbuf.c.o
[ 34%] Building C object _deps/libdatachannel-build/deps/usrsctp/usrsctplib/CMakeFiles/usrsctp.dir/user_recv_thread.c.o
[ 34%] Building C object _deps/libdatachannel-build/deps/usrsctp/usrsctplib/CMakeFiles/usrsctp.dir/user_socket.c.o
[ 36%] Linking C static library libusrsctp.a
[ 36%] Built target usrsctp
[ 38%] Building C object _deps/libdatachannel-build/deps/libsrtp/CMakeFiles/srtp2.dir/srtp/srtp.c.o
[ 38%] Building C object _deps/libdatachannel-build/deps/libsrtp/CMakeFiles/srtp2.dir/crypto/cipher/cipher.c.o
[ 40%] Building C object _deps/libdatachannel-build/deps/libsrtp/CMakeFiles/srtp2.dir/crypto/cipher/cipher_test_cases.c.o
[ 40%] Building C object _deps/libdatachannel-build/deps/libsrtp/CMakeFiles/srtp2.dir/crypto/cipher/null_cipher.c.o
[ 40%] Building C object _deps/libdatachannel-build/deps/libsrtp/CMakeFiles/srtp2.dir/crypto/cipher/aes_icm_ossl.c.o
[ 42%] Building C object _deps/libdatachannel-build/deps/libsrtp/CMakeFiles/srtp2.dir/crypto/cipher/aes_gcm_ossl.c.o
[ 42%] Building C object _deps/libdatachannel-build/deps/libsrtp/CMakeFiles/srtp2.dir/crypto/hash/auth.c.o
[ 42%] Building C object _deps/libdatachannel-build/deps/libsrtp/CMakeFiles/srtp2.dir/crypto/hash/auth_test_cases.c.o
[ 44%] Building C object _deps/libdatachannel-build/deps/libsrtp/CMakeFiles/srtp2.dir/crypto/hash/null_auth.c.o
[ 44%] Building C object _deps/libdatachannel-build/deps/libsrtp/CMakeFiles/srtp2.dir/crypto/hash/hmac_ossl.c.o
[ 44%] Building C object _deps/libdatachannel-build/deps/libsrtp/CMakeFiles/srtp2.dir/crypto/kernel/alloc.c.o
[ 46%] Building C object _deps/libdatachannel-build/deps/libsrtp/CMakeFiles/srtp2.dir/crypto/kernel/crypto_kernel.c.o
[ 46%] Building C object _deps/libdatachannel-build/deps/libsrtp/CMakeFiles/srtp2.dir/crypto/kernel/err.c.o
[ 46%] Building C object _deps/libdatachannel-build/deps/libsrtp/CMakeFiles/srtp2.dir/crypto/kernel/key.c.o
[ 48%] Building C object _deps/libdatachannel-build/deps/libsrtp/CMakeFiles/srtp2.dir/crypto/math/datatypes.c.o
[ 48%] Building C object _deps/libdatachannel-build/deps/libsrtp/CMakeFiles/srtp2.dir/crypto/replay/rdb.c.o
[ 51%] Building C object _deps/libdatachannel-build/deps/libsrtp/CMakeFiles/srtp2.dir/crypto/replay/rdbx.c.o
[ 51%] Linking C static library libsrtp2.a
[ 51%] Built target srtp2
[ 51%] Building CXX object _deps/libdatachannel-build/CMakeFiles/datachannel-static.dir/src/candidate.cpp.o
[ 51%] Building CXX object _deps/libdatachannel-build/CMakeFiles/datachannel-static.dir/src/channel.cpp.o
[ 53%] Building CXX object _deps/libdatachannel-build/CMakeFiles/datachannel-static.dir/src/configuration.cpp.o
[ 53%] Building CXX object _deps/libdatachannel-build/CMakeFiles/datachannel-static.dir/src/datachannel.cpp.o
[ 55%] Building CXX object _deps/libdatachannel-build/CMakeFiles/datachannel-static.dir/src/description.cpp.o
[ 55%] Building CXX object _deps/libdatachannel-build/CMakeFiles/datachannel-static.dir/src/mediahandler.cpp.o
[ 55%] Building CXX object _deps/libdatachannel-build/CMakeFiles/datachannel-static.dir/src/global.cpp.o
[ 57%] Building CXX object _deps/libdatachannel-build/CMakeFiles/datachannel-static.dir/src/message.cpp.o
[ 57%] Building CXX object _deps/libdatachannel-build/CMakeFiles/datachannel-static.dir/src/peerconnection.cpp.o
[ 57%] Building CXX object _deps/libdatachannel-build/CMakeFiles/datachannel-static.dir/src/rtcpreceivingsession.cpp.o
[ 59%] Building CXX object _deps/libdatachannel-build/CMakeFiles/datachannel-static.dir/src/track.cpp.o
[ 59%] Building CXX object _deps/libdatachannel-build/CMakeFiles/datachannel-static.dir/src/websocket.cpp.o
[ 59%] Building CXX object _deps/libdatachannel-build/CMakeFiles/datachannel-static.dir/src/websocketserver.cpp.o
[ 61%] Building CXX object _deps/libdatachannel-build/CMakeFiles/datachannel-static.dir/src/rtppacketizationconfig.cpp.o
[ 61%] Building CXX object _deps/libdatachannel-build/CMakeFiles/datachannel-static.dir/src/rtcpsrreporter.cpp.o
[ 61%] Building CXX object _deps/libdatachannel-build/CMakeFiles/datachannel-static.dir/src/rtppacketizer.cpp.o
[ 63%] Building CXX object _deps/libdatachannel-build/CMakeFiles/datachannel-static.dir/src/h264rtppacketizer.cpp.o
[ 63%] Building CXX object _deps/libdatachannel-build/CMakeFiles/datachannel-static.dir/src/nalunit.cpp.o
[ 63%] Building CXX object _deps/libdatachannel-build/CMakeFiles/datachannel-static.dir/src/h265rtppacketizer.cpp.o
[ 65%] Building CXX object _deps/libdatachannel-build/CMakeFiles/datachannel-static.dir/src/h265nalunit.cpp.o
[ 65%] Building CXX object _deps/libdatachannel-build/CMakeFiles/datachannel-static.dir/src/av1rtppacketizer.cpp.o
[ 68%] Building CXX object _deps/libdatachannel-build/CMakeFiles/datachannel-static.dir/src/rtcpnackresponder.cpp.o
[ 68%] Building CXX object _deps/libdatachannel-build/CMakeFiles/datachannel-static.dir/src/rtp.cpp.o
[ 68%] Building CXX object _deps/libdatachannel-build/CMakeFiles/datachannel-static.dir/src/capi.cpp.o
[ 70%] Building CXX object _deps/libdatachannel-build/CMakeFiles/datachannel-static.dir/src/plihandler.cpp.o
[ 70%] Building CXX object _deps/libdatachannel-build/CMakeFiles/datachannel-static.dir/src/impl/certificate.cpp.o
[ 70%] Building CXX object _deps/libdatachannel-build/CMakeFiles/datachannel-static.dir/src/impl/channel.cpp.o
[ 72%] Building CXX object _deps/libdatachannel-build/CMakeFiles/datachannel-static.dir/src/impl/datachannel.cpp.o
[ 72%] Building CXX object _deps/libdatachannel-build/CMakeFiles/datachannel-static.dir/src/impl/dtlssrtptransport.cpp.o
[ 72%] Building CXX object _deps/libdatachannel-build/CMakeFiles/datachannel-static.dir/src/impl/dtlstransport.cpp.o
[ 74%] Building CXX object _deps/libdatachannel-build/CMakeFiles/datachannel-static.dir/src/impl/icetransport.cpp.o
[ 74%] Building CXX object _deps/libdatachannel-build/CMakeFiles/datachannel-static.dir/src/impl/init.cpp.o
[ 74%] Building CXX object _deps/libdatachannel-build/CMakeFiles/datachannel-static.dir/src/impl/peerconnection.cpp.o
[ 76%] Building CXX object _deps/libdatachannel-build/CMakeFiles/datachannel-static.dir/src/impl/logcounter.cpp.o
[ 76%] Building CXX object _deps/libdatachannel-build/CMakeFiles/datachannel-static.dir/src/impl/sctptransport.cpp.o
[ 78%] Building CXX object _deps/libdatachannel-build/CMakeFiles/datachannel-static.dir/src/impl/threadpool.cpp.o
[ 78%] Building CXX object _deps/libdatachannel-build/CMakeFiles/datachannel-static.dir/src/impl/tls.cpp.o
[ 78%] Building CXX object _deps/libdatachannel-build/CMakeFiles/datachannel-static.dir/src/impl/track.cpp.o
[ 80%] Building CXX object _deps/libdatachannel-build/CMakeFiles/datachannel-static.dir/src/impl/utils.cpp.o
[ 80%] Building CXX object _deps/libdatachannel-build/CMakeFiles/datachannel-static.dir/src/impl/processor.cpp.o
[ 80%] Building CXX object _deps/libdatachannel-build/CMakeFiles/datachannel-static.dir/src/impl/sha.cpp.o
[ 82%] Building CXX object _deps/libdatachannel-build/CMakeFiles/datachannel-static.dir/src/impl/pollinterrupter.cpp.o
[ 82%] Building CXX object _deps/libdatachannel-build/CMakeFiles/datachannel-static.dir/src/impl/pollservice.cpp.o
[ 82%] Building CXX object _deps/libdatachannel-build/CMakeFiles/datachannel-static.dir/src/impl/http.cpp.o
[ 85%] Building CXX object _deps/libdatachannel-build/CMakeFiles/datachannel-static.dir/src/impl/httpproxytransport.cpp.o
[ 85%] Building CXX object _deps/libdatachannel-build/CMakeFiles/datachannel-static.dir/src/impl/tcpserver.cpp.o
[ 85%] Building CXX object _deps/libdatachannel-build/CMakeFiles/datachannel-static.dir/src/impl/tcptransport.cpp.o
[ 87%] Building CXX object _deps/libdatachannel-build/CMakeFiles/datachannel-static.dir/src/impl/tlstransport.cpp.o
[ 87%] Building CXX object _deps/libdatachannel-build/CMakeFiles/datachannel-static.dir/src/impl/transport.cpp.o
[ 87%] Building CXX object _deps/libdatachannel-build/CMakeFiles/datachannel-static.dir/src/impl/verifiedtlstransport.cpp.o
[ 89%] Building CXX object _deps/libdatachannel-build/CMakeFiles/datachannel-static.dir/src/impl/websocket.cpp.o
[ 89%] Building CXX object _deps/libdatachannel-build/CMakeFiles/datachannel-static.dir/src/impl/websocketserver.cpp.o
[ 91%] Building CXX object _deps/libdatachannel-build/CMakeFiles/datachannel-static.dir/src/impl/wstransport.cpp.o
[ 91%] Building CXX object _deps/libdatachannel-build/CMakeFiles/datachannel-static.dir/src/impl/wshandshake.cpp.o
[ 91%] Linking CXX static library libdatachannel-static.a
[ 91%] Built target datachannel-static
[ 91%] Building CXX object CMakeFiles/node_datachannel.dir/src/rtc-wrapper.cpp.o
[ 93%] Building CXX object CMakeFiles/node_datachannel.dir/src/media-direction.cpp.o
[ 93%] Building CXX object CMakeFiles/node_datachannel.dir/src/media-rtcpreceivingsession-wrapper.cpp.o
/Users/sgtpooki/code/work/foss/murat-dogan/node-datachannel/src/media-rtcpreceivingsession-wrapper.cpp:56:18: warning: 'requestBitrate' is deprecated: Use Track::requestBitrate() [-Wdeprecated-declarations]
    mSessionPtr->requestBitrate(bitRate);
                 ^
/Users/sgtpooki/code/work/foss/murat-dogan/node-datachannel/build/_deps/libdatachannel-src/include/rtc/rtcpreceivingsession.hpp:36:4: note: 'requestBitrate' has been explicitly marked deprecated here
        [[deprecated("Use Track::requestBitrate()")]] inline void requestBitrate(unsigned int) {};
          ^
/Users/sgtpooki/code/work/foss/murat-dogan/node-datachannel/src/media-rtcpreceivingsession-wrapper.cpp:62:49: warning: 'requestKeyframe' is deprecated: Use Track::requestKeyframe() [-Wdeprecated-declarations]
    return Napi::Boolean::New(env, mSessionPtr->requestKeyframe());
                                                ^
/Users/sgtpooki/code/work/foss/murat-dogan/node-datachannel/build/_deps/libdatachannel-src/include/rtc/rtcpreceivingsession.hpp:35:4: note: 'requestKeyframe' has been explicitly marked deprecated here
        [[deprecated("Use Track::requestKeyframe()")]] inline bool requestKeyframe() { return false; };
          ^
2 warnings generated.
[ 93%] Building CXX object CMakeFiles/node_datachannel.dir/src/media-track-wrapper.cpp.o
[ 95%] Building CXX object CMakeFiles/node_datachannel.dir/src/media-audio-wrapper.cpp.o
[ 95%] Building CXX object CMakeFiles/node_datachannel.dir/src/media-video-wrapper.cpp.o
[ 95%] Building CXX object CMakeFiles/node_datachannel.dir/src/data-channel-wrapper.cpp.o
[ 97%] Building CXX object CMakeFiles/node_datachannel.dir/src/peer-connection-wrapper.cpp.o
/Users/sgtpooki/code/work/foss/murat-dogan/node-datachannel/src/peer-connection-wrapper.cpp:534:38: warning: 'type' is deprecated: Use maxPacketLifeTime or maxRetransmits [-Wdeprecated-declarations]
                    init.reliability.type = rtc::Reliability::Type::Reliable;
                                     ^
/Users/sgtpooki/code/work/foss/murat-dogan/node-datachannel/build/_deps/libdatachannel-src/include/rtc/reliability.hpp:36:5: note: 'type' has been explicitly marked deprecated here
                [[deprecated("Use maxPacketLifeTime or maxRetransmits")]] Type type;
                  ^
/Users/sgtpooki/code/work/foss/murat-dogan/node-datachannel/src/peer-connection-wrapper.cpp:537:38: warning: 'type' is deprecated: Use maxPacketLifeTime or maxRetransmits [-Wdeprecated-declarations]
                    init.reliability.type = rtc::Reliability::Type::Rexmit;
                                     ^
/Users/sgtpooki/code/work/foss/murat-dogan/node-datachannel/build/_deps/libdatachannel-src/include/rtc/reliability.hpp:36:5: note: 'type' has been explicitly marked deprecated here
                [[deprecated("Use maxPacketLifeTime or maxRetransmits")]] Type type;
                  ^
/Users/sgtpooki/code/work/foss/murat-dogan/node-datachannel/src/peer-connection-wrapper.cpp:540:38: warning: 'type' is deprecated: Use maxPacketLifeTime or maxRetransmits [-Wdeprecated-declarations]
                    init.reliability.type = rtc::Reliability::Type::Timed;
                                     ^
/Users/sgtpooki/code/work/foss/murat-dogan/node-datachannel/build/_deps/libdatachannel-src/include/rtc/reliability.hpp:36:5: note: 'type' has been explicitly marked deprecated here
                [[deprecated("Use maxPacketLifeTime or maxRetransmits")]] Type type;
                  ^
/Users/sgtpooki/code/work/foss/murat-dogan/node-datachannel/src/peer-connection-wrapper.cpp:596:30: warning: 'type' is deprecated: Use maxPacketLifeTime or maxRetransmits [-Wdeprecated-declarations]
            init.reliability.type = rtc::Reliability::Type::Timed;
                             ^
/Users/sgtpooki/code/work/foss/murat-dogan/node-datachannel/build/_deps/libdatachannel-src/include/rtc/reliability.hpp:36:5: note: 'type' has been explicitly marked deprecated here
                [[deprecated("Use maxPacketLifeTime or maxRetransmits")]] Type type;
                  ^
/Users/sgtpooki/code/work/foss/murat-dogan/node-datachannel/src/peer-connection-wrapper.cpp:601:30: warning: 'type' is deprecated: Use maxPacketLifeTime or maxRetransmits [-Wdeprecated-declarations]
            init.reliability.type = rtc::Reliability::Type::Rexmit;
                             ^
/Users/sgtpooki/code/work/foss/murat-dogan/node-datachannel/build/_deps/libdatachannel-src/include/rtc/reliability.hpp:36:5: note: 'type' has been explicitly marked deprecated here
                [[deprecated("Use maxPacketLifeTime or maxRetransmits")]] Type type;
                  ^
/Users/sgtpooki/code/work/foss/murat-dogan/node-datachannel/src/peer-connection-wrapper.cpp:606:30: warning: 'type' is deprecated: Use maxPacketLifeTime or maxRetransmits [-Wdeprecated-declarations]
            init.reliability.type = rtc::Reliability::Type::Reliable;
                             ^
/Users/sgtpooki/code/work/foss/murat-dogan/node-datachannel/build/_deps/libdatachannel-src/include/rtc/reliability.hpp:36:5: note: 'type' has been explicitly marked deprecated here
                [[deprecated("Use maxPacketLifeTime or maxRetransmits")]] Type type;
                  ^
6 warnings generated.
[ 97%] Building CXX object CMakeFiles/node_datachannel.dir/src/thread-safe-callback.cpp.o
[ 97%] Building CXX object CMakeFiles/node_datachannel.dir/src/main.cpp.o
[100%] Linking CXX shared library Release/node_datachannel.node
[100%] Built target node_datachannel

@SgtPooki
Copy link

otool result for version I built:

╰─ ✔ ❯ otool -L build/Release/node_datachannel.node
build/Release/node_datachannel.node:
	@rpath/node_datachannel.node (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1700.255.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1345.100.2)

diff between the otool result of the binary I downloaded from https://github.com/murat-dogan/node-datachannel/releases/download/v0.5.6-dev/node-datachannel-v0.5.6-dev-napi-v8-darwin-arm64.tar.gz & the one I built:

╰─ ✔ ❯ diff otool.txt otool-downloaded.txt
1c1
< build/Release/node_datachannel.node:
---
> /Users/sgtpooki/Downloads/build/Release/node_datachannel.node:
3,4c3,4
< 	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1700.255.0)
< 	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1345.100.2)
---
> 	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1200.3.0)
> 	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1311.0.0)

@SgtPooki
Copy link

lmk if there's anything else you need from me @murat-dogan

@SgtPooki
Copy link

SgtPooki commented Mar 27, 2024

binary size differences:

╰─ ✔ ❯ du -hs build/Release/node_datachannel.node
6.6M	build/Release/node_datachannel.node

╰─ ✔ ❯ du -hs /Users/sgtpooki/Downloads/build/Release/node_datachannel.node
4.6M	/Users/sgtpooki/Downloads/build/Release/node_datachannel.node

file output:

╰─ ✔ ❯ file build/Release/node_datachannel.node
build/Release/node_datachannel.node: Mach-O 64-bit dynamically linked shared library arm64

╰─ ✔ ❯ file /Users/sgtpooki/Downloads/build/Release/node_datachannel.node
/Users/sgtpooki/Downloads/build/Release/node_datachannel.node: Mach-O 64-bit dynamically linked shared library arm64

seems it's still dynamically linked?

@murat-dogan
Copy link
Owner Author

Thanks @SgtPooki
Mach-O 64-bit dynamically linked shared library arm64 this is not a problem.

Do you need more from me here? I believe the changes previously mentioned build fine on macos. I can attempt to uninstall openssl3 or at least block access to it if that would help

Did you try this?

@SgtPooki
Copy link

SgtPooki commented Apr 3, 2024

If I remove openssl with brew uninstall --ignore-dependencies openssl and then build, I get an error on build:

> [email protected] build
> cmake-js build

[
  '/nix/store/xjgg53kjjhwcx4p3dmywjmqjbv82xhyn-nodejs-20.11.1/bin/node',
  '/Users/sgtpooki/code/work/foss/murat-dogan/node-datachannel/node_modules/.bin/cmake-js',
  'build'
]
info TOOL Using Unix Makefiles generator.
info CMD CONFIGURE
info RUN [
info RUN   'cmake',
info RUN   '/Users/sgtpooki/code/work/foss/murat-dogan/node-datachannel',
info RUN   '--no-warn-unused-cli',
info RUN   '-G',
info RUN   'Unix Makefiles',
info RUN   '-DCMAKE_JS_VERSION=6.3.2',
info RUN   '-DCMAKE_BUILD_TYPE=Release',
info RUN   '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/Users/sgtpooki/code/work/foss/murat-dogan/node-datachannel/build/Release',
info RUN   '-DCMAKE_JS_INC=/Users/sgtpooki/.cmake-js/node-arm64/v20.11.1/include/node',
info RUN   '-DCMAKE_JS_SRC=',
info RUN   '-DNODE_RUNTIME=node',
info RUN   '-DNODE_RUNTIMEVERSION=20.11.1',
info RUN   '-DNODE_ARCH=arm64',
info RUN   '-DCMAKE_OSX_ARCHITECTURES=arm64',
info RUN   '-DCMAKE_CXX_FLAGS=-D_DARWIN_USE_64_BIT_INODE=1 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DBUILDING_NODE_EXTENSION',
info RUN   '-DCMAKE_SHARED_LINKER_FLAGS=-undefined dynamic_lookup'
info RUN ]
Not searching for unused variables given on the command line.
-- The C compiler identification is Clang 16.0.6
-- The CXX compiler identification is Clang 16.0.6
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /nix/store/24ljvc5iwbs01svv9s8zvfcl5qs876kp-clang-wrapper-16.0.6/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /nix/store/24ljvc5iwbs01svv9s8zvfcl5qs876kp-clang-wrapper-16.0.6/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at /Users/sgtpooki/.asdf/installs/cmake/3.22.1/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the
  system variable OPENSSL_ROOT_DIR (missing: OPENSSL_CRYPTO_LIBRARY
  OPENSSL_INCLUDE_DIR)
Call Stack (most recent call first):
  /Users/sgtpooki/.asdf/installs/cmake/3.22.1/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
  /Users/sgtpooki/.asdf/installs/cmake/3.22.1/share/cmake-3.22/Modules/FindOpenSSL.cmake:574 (find_package_handle_standard_args)
  CMakeLists.txt:24 (find_package)

@SgtPooki
Copy link

SgtPooki commented Apr 3, 2024

If I build with openssl installed, and then remove it, and then run the test with npm run test, it succeeds fine.

[nix-shell:~/code/work/foss/murat-dogan/node-datachannel]$ brew uninstall --ignore-dependencies openssl
Uninstalling /opt/homebrew/Cellar/openssl@3/3.2.1... (6,874 files, 32MB)

Warning: The following openssl@3 configuration files have not been removed!
If desired, remove them manually with `rm -rf`:
  /opt/homebrew/etc/openssl@3
  /opt/homebrew/etc/openssl@3/cert.pem
  /opt/homebrew/etc/openssl@3/certs
  /opt/homebrew/etc/openssl@3/ct_log_list.cnf
  /opt/homebrew/etc/openssl@3/ct_log_list.cnf.dist
  /opt/homebrew/etc/openssl@3/misc
  /opt/homebrew/etc/openssl@3/misc/CA.pl
  /opt/homebrew/etc/openssl@3/misc/tsget
  /opt/homebrew/etc/openssl@3/misc/tsget.pl
  /opt/homebrew/etc/openssl@3/openssl.cnf
  /opt/homebrew/etc/openssl@3/openssl.cnf.dist
  /opt/homebrew/etc/openssl@3/private

[nix-shell:~/code/work/foss/murat-dogan/node-datachannel]$ rm -rf /opt/homebrew/etc/openssl@3

[nix-shell:~/code/work/foss/murat-dogan/node-datachannel]$ npm run test

> [email protected] test
> NODE_OPTIONS=--experimental-vm-modules jest

(node:52494) ExperimentalWarning: VM Modules is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
 PASS  test/test.js (12.199 s)
  Module Definition
    ✓ Module Defined (1 ms)
  PeerConnection Classes
    ✓ Create PeerConnection
    ✓ Create Data Channel (1 ms)
  P2P
    ✓ P2P (12016 ms)
  DataChannel streams
    ✓ can build an echo pipeline (66 ms)

Test Suites: 1 passed, 1 total
Tests:       5 passed, 5 total
Snapshots:   0 total
Time:        12.216 s, estimated 13 s
Ran all test suites.

@murat-dogan
Copy link
Owner Author

v0.6.0 released.

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants