murat-dogan / node-datachannel

WebRTC For Node.js and Electron. libdatachannel node bindings.
Mozilla Public License 2.0
308 stars 60 forks source link

compilation fails on mac #1

Closed ptesavol closed 4 years ago

ptesavol commented 4 years ago

Hi, thank you for the great work! I

I tried this on Ubuntu, and it works well. On mac, however, compilation fails with error:

CMake Error at /usr/local/Cellar/cmake/3.15.5/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:137 (message): Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR (missing: OPENSSL_INCLUDE_DIR) Call Stack (most recent call first): /usr/local/Cellar/cmake/3.15.5/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE) /usr/local/Cellar/cmake/3.15.5/share/cmake/Modules/FindOpenSSL.cmake:413 (find_package_handle_standard_args) build/_deps/libdatachannel-src/CMakeLists.txt:189 (find_package)

Maybe the OpenSSL dependency does not get installed automatically?

paullouisageneau commented 4 years ago

This is from the cmake of libdatachannel. You indeed have to install OpenSSL yourself on Mac. You can achieve this with homebrew using brew install openssl.

murat-dogan commented 4 years ago

I will release pre-built binaries when we are ready to release a stable & tested version. Until this happens you have to install libdatachannel requirements.

murat-dogan commented 4 years ago

I released pre-built binaries for windows,linux & mac. Now you don't need to have cmake or libdatachannel required libraries like OpenSSL.

Could you please try it?

murat-dogan commented 4 years ago

Also I released the package to npm. So just do; npm install node-datachannel to try

ptesavol commented 4 years ago

On ubuntu 20.04 installation works without problems.

On MacOS 10.14.6 I got installation to work by first installing openssl with "brew install openssl" and then executing the command OPENSSL_ROOT_DIR=/usr/local/Cellar/openssl\@1.1/1.1.1g/ \ OPENSSL_INCLUDE_DIR=/usr/local/Cellar/openssl\@1.1/1.1.1g/include npm install node-datachannel

I also tried "npm install node-datachannel" on Ubuntu 18.04. This fails because the Ubuntu 18.04's default cmake version 3.10.2 does not have the "FetchContent" feature. After installing cmake version 3.18.0, "npm install node-datachannel" fails with error:

/home/emulator/projects/node-datachannel/build/_deps/libdatachannel-src/deps/usrsctp/usrsctplib/netinet/sctp_input.c: At top level: cc1: error: unrecognized command line option ‘-Wno-address-of-packed-member’ [-Werror]

It seems that the precompiled binaries are not used on either of these platforms, and npm install tries to recompile everything anyway.

murat-dogan commented 4 years ago

Actually you should not need OpenSSL On MacOS. Doesn't it install prebuilt package?

I am checking Ubuntu 18.04.

ptesavol commented 4 years ago

"npm install node-datachannel" seems to recompile on On MacOS 10.14.6

murat-dogan commented 4 years ago

"npm install node-datachannel" seems to recompile on On MacOS 10.14.6

Which node version are you using?

murat-dogan commented 4 years ago

I also tried "npm install node-datachannel" on Ubuntu 18.04. This fails because the Ubuntu 18.04's default cmake version 3.10.2 does not have the "FetchContent" feature. After installing cmake version 3.18.0, "npm install node-datachannel" fails with error:

There was a libstdc++ version problem. Now it is fixed. Could you please try on ubuntu 18.04 again?

"npm install node-datachannel" seems to recompile on On MacOS 10.14.6

Unfortunately I don't have a mac. CI is compiling on MacOS V10.15. Please check https://github.com/murat-dogan/node-datachannel/releases/tag/v0.0.8 You can see all prebuilt files. If it is not downloading prebuilt lib, maybe you can install & test it manually.

For this;

> git clone https://github.com/murat-dogan/node-datachannel.git
> cd node-datachannel
> mkdir -p build/Release
# Copy appropriate file from release page to `build/Release`
> npm run test

And please note Only Node V10+ is supported for now.

ptesavol commented 4 years ago

Just tested on Ubuntu 18.04, and now "npm install node-datachannel" fetches the precompiled binary and "node node_modules/node-datachannel/test/connectivity.js" works. Great work!

murat-dogan commented 4 years ago

I added some tests to the CI workflow. Linux & Windows tests are passed successfully.

MacOS tests fails with Segmentation fault.

Is it about addon or not ? I don't know that. I need someone to execute these commands & write the results.

> git clone https://github.com/murat-dogan/node-datachannel.git
> cd node-datachannel
> mkdir -p build/Release
# https://github.com/murat-dogan/node-datachannel/releases/tag/v0.0.8
# Copy appropriate file from release page to `build/Release`
> npm run test
murat-dogan commented 4 years ago

On V0.0.10 it is all solved. Mac OS compiles & tests passes successfully.