litespeedtech / lsquic

LiteSpeed QUIC and HTTP/3 Library
MIT License
1.54k stars 334 forks source link

Support iOS #3

Open shockcao opened 7 years ago

shockcao commented 7 years ago

Hi all,

Is there any plan to support on Android, iOS and Windows?

dtikhonov commented 7 years ago

Yes: we plan to support all of those -- however, not in the nearest future. Android is likely the easiest of the three, as it is based on Linux.

Pull requests are welcome -- and you get fame and glory! :)

shockcao commented 6 years ago

thanks, I've stripped a pure QUIC sdk from proto-quic for Android & iOS but based on Google base with a big bulk, glad to see the smaller sdk using C program. I will try to make lsquic-client support Android/iOS whenever I have time.

amoldeshpande commented 6 years ago

hi @dtikhonov , I have a windows version at https://github.com/amoldeshpande/lsquic-client

I am able to compile in debug and release as well as pass tests in debug mode. Ran http_client and was able to get a web page back.

I'm about 1 commit behind so I'll need to update before I make a pull request. Before I do that, I wanted to point out that I had to make a lot of changes due to Microsoft's pigheadedness about never properly supporting C99 (To be fair, there were also GCC extensions that I had to deal with)

Those diffs are relatively minor individually, so it's honestly not too bad.

Before I go through the torture to update and make a pull request I want to be sure that you guys are OK accepting those types of changes :-) They will force you to code slightly differently going forward if you want to keep the Windows version alive.

Thanks. Edit: missed a not.

dtikhonov commented 6 years ago

Sounds both ominous and exciting. I think we’d have to see what you propose. Looking at your branch, the changes don’t look very scary, even though there are many of them.

Submit a patch and let’s take it from there - it would be really nice to have lsquic work on Windows!

amoldeshpande commented 6 years ago

cool, will do. It's mostly a bunch of variable-sized arrays (or 0-length arrays) that are not supported properly in VC.
I don't have a Linux/Mac handy to regress my changes though.

dtikhonov commented 6 years ago

Thank you very much, @amoldeshpande, for pull #7 -- we are reviewing it.

amoldeshpande commented 6 years ago

@dtikhonov any news on the pull request ?

dtikhonov commented 6 years ago

Sorry we have been swamped a bit. My plan is to examine the patch more closely next week. I will need to set up my own Windows environment.

One thing I don’t like — and will try to change — is the moving around of functions.

amoldeshpande commented 6 years ago

ok, no worries. I had to move the functions because visual C++ doesn't like forward declaration of static consts. But if you have a better way to do it, that's great.

BTW Microsoft has various free VM images if you're not looking for a permanent Windows environment.

https://developer.microsoft.com/en-us/windows/downloads/virtual-machines

somanybut commented 6 years ago

@amoldeshpande, how to build lsquic-client in win7, pls descripe the building steps. thks.

amoldeshpande commented 6 years ago

@somanybut, It's pretty much the same steps as the Linux version. You have to compile boringssl for yourself and get zlib and openssl from vcpkg (or wherever else you get your 3rd party libraries). Make sure you exactly match the C-runtime library (static,dynamic, debug,release) for each component or you'll get linker errors.

Until my pull request goes through, please file issues at my fork.

rperper commented 6 years ago

@somanybut @amoldeshpande When we've merged the Windows changes into the master branch there will be released a how-to-compile-for-Windows doc.

somanybut commented 6 years ago

I am a java programmer, and I know little about C and C++.

@amoldeshpande @rperper thanks for your help, I'll try to compile the project. thanks again.

stormcenter commented 6 years ago

So , is there any Android/iOS sample project available on release or debug branch ?

dtikhonov commented 6 years ago

No, Android and iOS are still not supported.

stormcenter commented 6 years ago

I have build a arm64 arch liblsquic.a using -DCMAKE_OSX_SYSROOT=iphoneos -DCMAKE_OSX_ARCHITECTURES=arm64 and add pods depends on BoringSSL and I found some build errors blew when I add liblsquic.a into my test project.

Undefined symbols for architecture arm64: "_asan_memmove", referenced from: _lsquic_buf_append in liblsquic.a(lsquic_buf.c.o) "_inflateSetDictionary", referenced from: _decompress_certs in liblsquic.a(lsquic_crt_compress.c.o) "_inflateEnd", referenced from: _decompress_certs in liblsquic.a(lsquic_crt_compress.c.o) "___asan_report_store1", referenced from: _lsquic_get_enc_hist in liblsquic.a(lsquic_handshake.c.o) _lsquic_enc_session_encrypt in liblsquic.a(lsquic_handshake.c.o) _lsquic_enc_session_decrypt in liblsquic.a(lsquic_handshake.c.o) _lsquic_enc_session_gen_chlo in liblsquic.a(lsquic_handshake.c.o) _lsquic_enc_session_handle_chlo_reply in liblsquic.a(lsquic_handshake.c.o) _decrypt_packet in liblsquic.a(lsquic_handshake.c.o) _eshist_append in liblsquic.a(lsquichandshake.c.o) ... "asan_stack_malloc_1", referenced from: _lsquic_enc_session_handle_chlo_reply in liblsquic.a(lsquic_handshake.c.o) _determine_diversification_key in liblsquic.a(lsquic_handshake.c.o) _decrypt_packet in liblsquic.a(lsquic_handshake.c.o) _parse_hs in liblsquic.a(lsquic_handshake.c.o) _fnv1a_128_2 in liblsquic.a(lsquic_crypto.c.o) _fnv1a_128_3 in liblsquic.a(lsquic_crypto.c.o) _verify_hs_pkt in liblsquic.a(lsquic_crypto.c.o) ... "_asan_register_image_globals", referenced from: _asan.module_ctor in liblsquic.a(lsquic_handshake.c.o) _asan.module_ctor in liblsquic.a(lsquic_util.c.o) _asan.module_ctor in liblsquic.a(lsquic_crypto.c.o) _asan.module_ctor in liblsquic.a(lsquic_crt_compress.c.o) _asan.module_ctor in liblsquic.a(lsquic_logger.c.o) _asan.module_ctor in liblsquic.a(lsquic_version.c.o) _asan.module_ctor in liblsquic.a(lsquic_xxhash.c.o) ... "_asan_set_shadow_f5", referenced from: _lsquic_enc_session_gen_chlo in liblsquic.a(lsquic_handshake.c.o) "inflateInit", referenced from: _decompress_certs in liblsquic.a(lsquic_crtcompress.c.o) "asan_report_load16", referenced from: _lsquic_enc_session_encrypt in liblsquic.a(lsquic_handshake.c.o) _verify_packet_hash in liblsquic.a(lsquic_handshake.c.o) _fnv1a_128_2 in liblsquic.a(lsquic_crypto.c.o) _fnv1a_128_3 in liblsquic.a(lsquic_crypto.c.o) _fnv1a_128 in liblsquic.a(lsquic_crypto.c.o) _verify_hs_pkt in liblsquic.a(lsquic_crypto.c.o) _update_hs_pkt_hash in liblsquic.a(lsquic_crypto.c.o) ... "_asan_stack_malloc_0", referenced from: _lsquic_generate_cid in liblsquic.a(lsquic_handshake.c.o) _make_cert_hash_item in liblsquic.a(lsquic_handshake.c.o) _parse_hs_data in liblsquic.a(lsquic_handshake.c.o) _get_tag_value_i32 in liblsquic.a(lsquic_handshake.c.o) _get_tag_value_i64 in liblsquic.a(lsquic_handshake.c.o) _fnv1a_64_s in liblsquic.a(lsquic_crypto.c.o) _fnv1a_128_2_s in liblsquic.a(lsquiccrypto.c.o) ... "asan_report_load2", referenced from: _parse_hs in liblsquic.a(lsquic_handshake.c.o) "_asan_stack_malloc_2", referenced from: _lsquic_enc_session_encrypt in liblsquic.a(lsquic_handshake.c.o) _verify_packet_hash in liblsquic.a(lsquic_handshake.c.o) _determine_keys in liblsquic.a(lsquic_handshake.c.o) _sha256 in liblsquic.a(lsquic_crypto.c.o) _gen_prof in liblsquic.a(lsquic_crypto.c.o) _verify_prof0 in liblsquic.a(lsquic_crypto.c.o) _decompress_certs in liblsquic.a(lsquic_crtcompress.c.o) ... "asan_report_store2", referenced from: _lsquic_enc_session_gen_chlo in liblsquic.a(lsquichandshake.c.o) "asan_option_detect_stack_use_after_return", referenced from: _lsquic_enc_session_encrypt in liblsquic.a(lsquic_handshake.c.o) _lsquic_generate_cid in liblsquic.a(lsquic_handshake.c.o) _lsquic_enc_session_gen_chlo in liblsquic.a(lsquic_handshake.c.o) _lsquic_enc_session_handle_chlo_reply in liblsquic.a(lsquic_handshake.c.o) _determine_diversification_key in liblsquic.a(lsquic_handshake.c.o) _decrypt_packet in liblsquic.a(lsquic_handshake.c.o) _verify_packet_hash in liblsquic.a(lsquic_handshake.c.o) ... "_asan_memset", referenced from: _lsquic_enc_session_gen_chlo in liblsquic.a(lsquic_handshake.c.o) _hexdump in liblsquic.a(lsquic_util.c.o) _gen_prof in liblsquic.a(lsquic_crypto.c.o) _verify_prof0 in liblsquic.a(lsquic_crypto.c.o) _decompress_certs in liblsquic.a(lsquic_crt_compress.c.o) "_asan_handle_no_return", referenced from: _lsquic_enc_session_get_peer_option in liblsquic.a(lsquic_handshake.c.o) _lsquic_enc_session_gen_chlo in liblsquic.a(lsquic_handshake.c.o) _he2str in liblsquic.a(lsquic_handshake.c.o) _lshkdf_extract in liblsquic.a(lsquic_crypto.c.o) _aes_aead_enc in liblsquic.a(lsquic_crypto.c.o) _aes_aead_dec in liblsquic.a(lsquic_crypto.c.o) _decompress_certs in liblsquic.a(lsquic_crtcompress.c.o) ... "asan_report_store16", referenced from: _lsquic_enc_session_encrypt in liblsquic.a(lsquic_handshake.c.o) _verify_packet_hash in liblsquic.a(lsquic_handshake.c.o) _fnv1a_128_2_s in liblsquic.a(lsquic_crypto.c.o) _serialize_fnv128_short in liblsquic.a(lsquic_crypto.c.o) _fnv1a_128 in liblsquic.a(lsquic_crypto.c.o) _verify_hs_pkt in liblsquic.a(lsquic_crypto.c.o) _update_hs_pkt_hash in liblsquic.a(lsquiccrypto.c.o) ... "asan_unregister_image_globals", referenced from: _asan.module_dtor in liblsquic.a(lsquic_handshake.c.o) _asan.module_dtor in liblsquic.a(lsquic_util.c.o) _asan.module_dtor in liblsquic.a(lsquic_crypto.c.o) _asan.module_dtor in liblsquic.a(lsquic_crt_compress.c.o) _asan.module_dtor in liblsquic.a(lsquic_logger.c.o) _asan.module_dtor in liblsquic.a(lsquic_version.c.o) _asan.module_dtor in liblsquic.a(lsquic_xxhash.c.o) ... "_asan_report_store4", referenced from: _lsquic_enc_session_get_peer_setting in liblsquic.a(lsquic_handshake.c.o) _lsquic_enc_session_create_client in liblsquic.a(lsquic_handshake.c.o) _lsquic_enc_session_gen_chlo in liblsquic.a(lsquic_handshake.c.o) _lsquic_enc_session_handle_chlo_reply in liblsquic.a(lsquic_handshake.c.o) _parse_hs in liblsquic.a(lsquic_handshake.c.o) _make_cert_hash_item in liblsquic.a(lsquic_handshake.c.o) _parse_hs_data in liblsquic.a(lsquic_handshake.c.o) ... "_inflate", referenced from: _decompress_certs in liblsquic.a(lsquic_crt_compress.c.o) "_asan_init", referenced from: _asan.module_ctor in liblsquic.a(lsquic_global.c.o) _asan.module_ctor in liblsquic.a(lsquic_handshake.c.o) _asan.module_ctor in liblsquic.a(lsquic_util.c.o) _asan.module_ctor in liblsquic.a(lsquic_crypto.c.o) _asan.module_ctor in liblsquic.a(lsquic_crt_compress.c.o) _asan.module_ctor in liblsquic.a(lsquic_logger.c.o) _asan.module_ctor in liblsquic.a(lsquicbuf.c.o) ... "asan_report_load4", referenced from: _lsquic_enc_session_encrypt in liblsquic.a(lsquic_handshake.c.o) _lsquic_enc_session_get_peer_setting in liblsquic.a(lsquic_handshake.c.o) _lsquic_enc_session_get_peer_option in liblsquic.a(lsquic_handshake.c.o) _lsquic_enc_session_gen_chlo in liblsquic.a(lsquic_handshake.c.o) _lsquic_enc_session_handle_chlo_reply in liblsquic.a(lsquic_handshake.c.o) _c_free_cert_hash_item in liblsquic.a(lsquic_handshake.c.o) _get_hs_state in liblsquic.a(lsquichandshake.c.o) ... "asan_report_load1", referenced from: _lsquic_get_enc_hist in liblsquic.a(lsquic_handshake.c.o) _lsquic_enc_session_encrypt in liblsquic.a(lsquic_handshake.c.o) _lsquic_enc_session_decrypt in liblsquic.a(lsquic_handshake.c.o) _lsquic_enc_session_have_key_gt_one in liblsquic.a(lsquic_handshake.c.o) _decrypt_packet in liblsquic.a(lsquic_handshake.c.o) _determine_keys in liblsquic.a(lsquic_handshake.c.o) _eshist_append in liblsquic.a(lsquic_handshake.c.o) ... "_asan_version_mismatch_check_apple_902", referenced from: _asan.module_ctor in liblsquic.a(lsquic_global.c.o) _asan.module_ctor in liblsquic.a(lsquic_handshake.c.o) _asan.module_ctor in liblsquic.a(lsquic_util.c.o) _asan.module_ctor in liblsquic.a(lsquic_crypto.c.o) _asan.module_ctor in liblsquic.a(lsquic_crt_compress.c.o) _asan.module_ctor in liblsquic.a(lsquic_logger.c.o) _asan.module_ctor in liblsquic.a(lsquic_buf.c.o) ... "_asan_stack_malloc_3", referenced from: _lsquic_enc_session_gen_chlo in liblsquic.a(lsquichandshake.c.o) "asan_report_load8", referenced from: _lsquic_global_init in liblsquic.a(lsquic_global.c.o) _lsquic_global_cleanup in liblsquic.a(lsquic_global.c.o) _c_find_certs in liblsquic.a(lsquic_handshake.c.o) _setup_aead_ctx in liblsquic.a(lsquic_handshake.c.o) _lsquic_enc_session_destroy in liblsquic.a(lsquic_handshake.c.o) _lsquic_enc_session_encrypt in liblsquic.a(lsquic_handshake.c.o) _lsquic_generate_cid in liblsquic.a(lsquichandshake.c.o) ... "asan_report_store8", referenced from: _setup_aead_ctx in liblsquic.a(lsquic_handshake.c.o) _lsquic_enc_session_encrypt in liblsquic.a(lsquic_handshake.c.o) _lsquic_enc_session_create_client in liblsquic.a(lsquic_handshake.c.o) _lsquic_enc_session_gen_chlo in liblsquic.a(lsquic_handshake.c.o) _lsquic_enc_session_handle_chlo_reply in liblsquic.a(lsquic_handshake.c.o) _decrypt_packet in liblsquic.a(lsquic_handshake.c.o) _verify_packet_hash in liblsquic.a(lsquic_handshake.c.o) ... "_asan_memcpy", referenced from: _setup_aead_ctx in liblsquic.a(lsquic_handshake.c.o) _lsquic_get_enc_hist in liblsquic.a(lsquic_handshake.c.o) _lsquic_enc_session_encrypt in liblsquic.a(lsquic_handshake.c.o) _lsquic_enc_session_create_client in liblsquic.a(lsquic_handshake.c.o) _lsquic_enc_session_gen_chlo in liblsquic.a(lsquic_handshake.c.o) _determine_diversification_key in liblsquic.a(lsquic_handshake.c.o) _decrypt_packet in liblsquic.a(lsquichandshake.c.o) ... "asan_shadow_memory_dynamic_address", referenced from: _lsquic_global_init in liblsquic.a(lsquic_global.c.o) _lsquic_global_cleanup in liblsquic.a(lsquic_global.c.o) _c_find_certs in liblsquic.a(lsquic_handshake.c.o) _setup_aead_ctx in liblsquic.a(lsquic_handshake.c.o) _lsquic_get_enc_hist in liblsquic.a(lsquic_handshake.c.o) _lsquic_enc_session_destroy in liblsquic.a(lsquic_handshake.c.o) _lsquic_enc_session_encrypt in liblsquic.a(lsquic_handshake.c.o) ... ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

amoldeshpande commented 6 years ago

I don't have iOS tool, so litespeed guys can give a better answer, but it looks like you may either need to turn off address sanitizer (-fsanitze=address) or add some other library related to asan to your project.

dtikhonov commented 6 years ago

@stormcenter, please try @amoldeshpande's suggestion, as we don't have a better one, at least for now.

stormcenter commented 6 years ago

Yes, I turn off address sanitizer , the error down to 5, and I'll find a zlib on iOS to complete the iOS build. Thanks

JVHE commented 5 years ago

@dtikhonov I ported the lsquic client on Android using the wrapping function method. I have uploaded it in my repository, but it currently only works on the ARM architecture. Many bugs are scattered so I'm not sure I can apply pull request because this is the first experience.

dtikhonov commented 5 years ago

This is great, @JVHE! You're right -- I also don't know how how a PR request would look. The wrapped library is in a different language with a different API.

How do you compile the library? I looked around your repo and could not find build instructions.

Android4MediaPlayer commented 5 years ago

@JVHE How do you compile the library on android platform?

lzw201 commented 4 years ago

CMake Error: The following variables are used in this project, but they are set to NOTFOUND. Please set them or make sure they are set and tested correctly in the CMake files: BORINGSSL_LIB_crypto linked by target "http_client" in directory /home/lsquic linked by target "echo_client" in directory /home/lsquic linked by target "http_server" in directory /home/lsquic ......

nyrahul commented 4 years ago

CMake Error: The following variables are used in this project, but they are set to NOTFOUND. Please set them or make sure they are set and tested correctly in the CMake files: BORINGSSL_LIB_crypto linked by target "http_client" in directory /home/lsquic linked by target "echo_client" in directory /home/lsquic linked by target "http_server" in directory /home/lsquic ......

This problem is because of the new NDK. cmake find_path with android toolchain does not work without setting some cmake vars for latest NDK (>= r19b). Anyways, I have raised a PR #132 to handle Android and it solves this problem too.

wangweiwei1188 commented 3 years ago

Now, lsquic can build&run on linux, windows, android, ios and mac platform.I test it.

fastcome1985 commented 2 years ago

Is IOS has been supported? How to build ios?

liuxiaoli007 commented 2 years ago

Now, lsquic can build&run on linux, windows, android, ios and mac platform.I test it.

Can you show me how to build it on Android and ios ? @wangweiwei1188

wangweiwei1188 commented 2 years ago

build zlib &

Now, lsquic can build&run on linux, windows, android, ios and mac platform.I test it.

Can you show me how to build it on Android and ios ? @wangweiwei1188

build libevent & boringssl & zlib, then build lsquic.

liuxiaoli007 commented 2 years ago

then build lsquic

Thanks for you suggetstion, I build succes. And I got exexcutable binary :http_client. But when I push it to may android device and run http_clinet, it always report an error as follows:

lithium:/data/local/tmp $ ./http_client CANNOT LINK EXECUTABLE "./http_client": library "liblsquic.so" not found

can you show me why or can you show me the right way to use it?

liuxiaoli007 commented 2 years ago

build zlib &

Now, lsquic can build&run on linux, windows, android, ios and mac platform.I test it.

Can you show me how to build it on Android and ios ? @wangweiwei1188

build libevent & boringssl & zlib, then build lsquic.

I compiled success。 And the size of the liblsquic.so in release mode is 2M, Is it in line with expectations? Thanks @wangweiwei1188 wang