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

Problem with ubuntu 18 and workaround #107

Open
gorkacortazar opened this issue Aug 9, 2019 · 2 comments
Open

Problem with ubuntu 18 and workaround #107

gorkacortazar opened this issue Aug 9, 2019 · 2 comments

Comments

@gorkacortazar
Copy link

While porting our apps to Ubuntu 18 this week, we discovered problems (again is a mismatch of SSL versions against the compiled version).

While we can do a pull request, the changes that we did make the addon not compatible with ubuntu 16 or other linux versions. This recipe may also work in RPI or other linux flavors.

@gorkacortazar
Copy link
Author

  • The problem: Ubuntu 18 has a more recent version of the SSL library, the API is different, and definitely that version of libwebsockets does not support it.
  • There are two different methods deprecated is OpenSSL that makes the compilation from the ligwebsockets git fail
  • Ubuntu 18 uses a different version of GCC (7) than 16.04 (GCC 5). This will require the library to be recompiled.

We solved it with these steps:

  1. Clone libwebsockets source: https://github.com/warmcat/libwebsockets.git
  2. Checkout the tag v1.4-chrome43-firefox-36
  3. open the file libs/ssl.c
  4. search the calls to ERR_remove_thread_state (there are two instances)
  5. Replace the full #if block with this code:
#if (OPENSSL_VERSION_NUMBER <  0x10100000)
    #if (OPENSSL_VERSION_NUMBER <= 0x1000106f) || defined(USE_WOLFSSL)
       ERR_remove_state(0);
   #else
       #if OPENSSL_VERSION_NUMBER >= 0x1010005f && !defined(LIBRESSL_VERSION_NUMBER) && defined(OPENSSL_IS_BORINGSSL)
            ERR_remove_thread_state();
        #else
            ERR_remove_thread_state(NULL);
        #endif
    #endif
#endif
  1. Create a folder build and enter the folder
  2. Create the make files with cmake -DLIB_SUFFIX=64 ..
  3. Build with make
  4. Copy the file in the build/lib/libwebsockets.a and replace the one in the addon
  5. in the add on rules add this under linux64 (addon_config.mk), to include the OpenSSL in the linking process, as openframeworks 0.10 uses the library installed int he system.
linux64:
	# binary libraries, these will be usually parsed from the file system but some 
	# libraries need to passed to the linker in a specific order 
	#nothing yet
	ADDON_LDFLAGS += -lssl
	ADDON_LDFLAGS += -lcrypto

@KondakovArtem
Copy link

KondakovArtem commented Apr 13, 2020

Thank you very much, you're great. Your post saved me a week of work. I managed to connect and build this with OF 0.11.0 on linux mint 19.3, and it works!

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