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

Trouble building with NO_WEBSOCKET and NO_MEDIA options #341

Open
aranlunzer opened this issue Mar 14, 2025 · 5 comments · May be fixed by #342
Open

Trouble building with NO_WEBSOCKET and NO_MEDIA options #341

aranlunzer opened this issue Mar 14, 2025 · 5 comments · May be fixed by #342

Comments

@aranlunzer
Copy link

We have a use case in which we only need the data-channel features (no media, no websockets). We are therefore trying to build with both these CMakeLists options set to ON:

option(NO_MEDIA "Disable media transport support in libdatachannel" OFF)
option(NO_WEBSOCKET "Disable WebSocket support in libdatachannel" OFF)

libdatachannel's build process responds as one might expect, by suppressing the unwanted components. But the lack of those components causes the node-datachannel build to fail. For example, with just NO_WEBSOCKET set to ON, the first error is

[119/135] Building CXX object CMakeFiles/node_datachannel.dir/src/cpp/rtc-wrapper.cpp.o
FAILED: CMakeFiles/node_datachannel.dir/src/cpp/rtc-wrapper.cpp.o 
/Library/Developer/CommandLineTools/usr/bin/c++ -DNAPI_VERSION=8 -DRTC_ENABLE_MEDIA=1 -DRTC_ENABLE_WEBSOCKET=0 -DRTC_STATIC -Dnode_datachannel_EXPORTS -I/[...]/node-datachannel/node_modules/node-api-headers/include -I/[...]/node-datachannel/node_modules/node-addon-api -I/[...]/node-datachannel/build/_deps/libdatachannel-src/include -I/[...]/node-datachannel/build/_deps/libdatachannel-src/deps/plog -I/[...]/node-datachannel/build/_deps/libdatachannel-src/deps/plog/include -D_DARWIN_USE_64_BIT_INODE=1 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DBUILDING_NODE_EXTENSION -O3 -DNDEBUG -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX14.4.sdk -mmacosx-version-min=14.3 -fPIC -std=gnu++17 -MD -MT CMakeFiles/node_datachannel.dir/src/cpp/rtc-wrapper.cpp.o -MF CMakeFiles/node_datachannel.dir/src/cpp/rtc-wrapper.cpp.o.d -o CMakeFiles/node_datachannel.dir/src/cpp/rtc-wrapper.cpp.o -c /[...]/node-datachannel/src/cpp/rtc-wrapper.cpp
In file included from /[...]/node-datachannel/src/cpp/rtc-wrapper.cpp:5:
/[...]/node-datachannel/src/cpp/web-socket-wrapper.h:56:24: error: no member named 'WebSocket' in namespace 'rtc'
  std::shared_ptr<rtc::WebSocket> mWebSocketPtr = nullptr;

Is there something else we need to tweak?

@murat-dogan murat-dogan linked a pull request Mar 14, 2025 that will close this issue
@murat-dogan
Copy link
Owner

Thanks for reporting.

I have pushed a PR for this.
Could you please try it?

@aranlunzer
Copy link
Author

Thank you for the PR.

Over here, builds were still failing if we set either NO_MEDIA or NO_WEBSOCKET - with member-not-found errors that went away once we patched the following files

media-track-wrapper.cpp
metia-rtcpreceivingsession-wrapper.cpp
web-socket-wrapper.cpp
web-socket-server-wrapper.cpp

with conditionals that excluded all content in the absence of the appropriate flags.

For example, for web-socket-wrapper.cpp:

[first line] #if RTC_ENABLE_WEBSOCKET == 1
...
[last line] #endif

That said, our builds aren't quite happy yet: at the end we're seeing found architecture 'x86_64', required architecture 'arm64' warnings for hundreds of library files. More learning required on our part...

@aranlunzer
Copy link
Author

Fixing that last part

our builds aren't quite happy yet: at the end we're seeing found architecture 'x86_64', required architecture 'arm64' warnings for hundreds of library files.

...was apparently just a matter of running brew install openssl

@murat-dogan
Copy link
Owner

Hello,
Sorry but I could not understand.
I could use options to disable media and websocket and could successfully compiled.

Is there any problem for you?

@aranlunzer
Copy link
Author

Yes - simply pulling your options branch, then setting one of the flags to ON in the CMakeLists.txt and running

npm run clean
npm run build

leads to errors.

For example, on MacOS setting NO_WEBSOCKET to ON gives the output seen here

build.log

Adding the #if statements as mentioned above makes the problem go away.

We checked on Windows, in case it was something specific to our MacOS build configuration, but ran into the same issue.

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

Successfully merging a pull request may close this issue.

2 participants