{"schema":"libjg2-1",
"vpath":"/git/",
"avatar":"/git/avatar/",
"alang":"",
"gen_ut":1760904005,
"reponame":"libwebsockets",
"desc":"libwebsockets lightweight C networking library",
"owner": { "name": "Andy Green", "email": "andy@warmcat.com", "md5": "c50933ca2aa61e0fe2c43d46bb6b59cb" },"url":"https://libwebsockets.org/repo/libwebsockets",
"f":3,
"items": [
{"schema":"libjg2-1",
"cid":"82ea4d5169c98fea533c9d8d25811b17",
"oid":{ "oid": "bebc1bb85295c27477c984c32b14bebbea572ada", "alias": []},"blobname": "README.build", "blob": "Introduction\n------------\nLibwebsockets can be built using two different build systems\nautoconf or CMake. autoconf only works on Unix systems, or mingw/cygwin\non Windows. CMake works differently and can generate platform specific\nproject files for most popular IDEs and build systems.\n\n################################### Autoconf ###################################\n\nBuilding the library and test apps\n----------------------------------\n\nYou need to regenerate the autotools and libtoolize stuff for your system\n\n$ ./autogen.sh\n\nThen,\n\n------Fedora x86_64\n\n ./configure --prefix\u003d/usr --libdir\u003d/usr/lib64 --enable-openssl\n\n------Apple\n\nChristopher Baker reported that this is needed\n\n./configure CC\u003d\u0022gcc -arch i386 -arch x86_64\u0022 CXX\u003d\u0022g++ -arch i386 -arch\nx86_64\u0022 CPP\u003d\u0022gcc -E\u0022 CXXCPP\u003d\u0022g++ -E\u0022 --enable-nofork\n\n------mingw\n\nI did the following to get working build, ping test is disabled when\nbuilding this way\n\n1) install mingw64_w32 compiler packages from Fedora\n2) additionally install mingw64-zlib package\n3) ./configure --prefix\u003d/usr --enable-mingw --host\u003dx86_64-w64-mingw32\n4) make\n\n------MIPS cross-build using OpenWRT\n\n ./configure --prefix\u003d/usr --without-extensions --host mips-openwrt-linux\n\nI did not try building the extensions since they need cross-zlib, but it\nshould also be workable.\n\n------Other uClibc\n\nyou may need --enable-builtin-getifaddrs if your toolchain\ndoesn't have it - openWRT uclibc has it so you don't need this option.\n\n------ARM cross-build\n\n./configure --prefix\u003d/usr --host\u003darm-linux-gnueabi --without-client --without-extensions\n\nyou can build cross with client and extensions perfectly well, but\napart from the size shrink this has the nice characteristic that no\nnon-toolchain libraries are needed to build it.\n\n\notherwise if /usr/local/... and /usr/local/lib are OK then...\n\n$ ./configure\n$ make clean\n$ make \u0026\u0026 sudo make install\n$ libwebsockets-test-server\n\nshould be enough to get a test server listening on port 7861.\n\n\nConfigure script options\n------------------------\n\nThere are several other possible configure options\n\n--enable-openssl\tBuilds in the SSL support\n\n--with-cyassl\t\tUse cyassl instead of OpenSSL... you will need CyaSSL\n\t\t\tto have been configured with --enable-opensslExtra\n\u005c\t\t\twhen it was built.\n\n--enable-libcrypto\tby default libwebsockets uses its own\n\t\t\tbuilt-in md5 and sha-1 implementation for\n\t\t\tsimplicity. However the libcrypto ones\n\t\t\tmay be faster, and in a distro context it\n\t\t\tmay be highly desirable to use a common\n\t\t\tlibrary implementation for ease of security\n\t\t\tupgrades. Give this configure option\n\t\t\tto disable the built-in ones and force use\n\t\t\tof the libcrypto (part of openssl) ones.\n\n--with-client-cert-dir\u003ddir tells the client ssl support where to\n\t\t\t look for trust certificates to validate\n\t\t\t the remote certificate against.\n\n--enable-noping\t\tDon't try to build the ping test app\n\t\t\tIt needs some unixy environment that\n\t\t\tmay choke in other build contexts, this\n\t\t\tlets you cleanly stop it being built\n\t\t\t\n--enable-builtin-getifaddrs if your libc lacks getifaddrs, you can build an\n\t\t\timplementation into the library. By default your libc\n\t\t\tone is used.\n\n--without-testapps\tJust build the library not the test apps\n\n--without-client\tDon't build the client part of the library nor the\n\t\t\ttest apps that need the client part. Useful to\n\t\t\tminimize library footprint for embedded server-only\n\t\t\tcase\n\n--without-server\tDon't build the server part of the library nor the\n\t\t\ttest apps that need the server part. Useful to\n\t\t\tminimize library footprint for embedded client-only\n\t\t\tcase\n\n--without-daemonize\tDon't build daemonize.c / lws_daemonize\n\n--disable-debug\t\tRemove all debug logging below lwsl_notice in severity\n\t\t\tfrom the code -- it's not just defeated from logging\n\t\t\tbut removed from compilation\n\n--without-extensions\tRemove all code and data around protocol extensions.\n\t\t\tThis reduces the code footprint considerably but\n\t\t\tyou will lose extension features like compression.\n\t\t\tHowever that may be irrelevant for embedded use and\n\t\t\tthe code / data size / speed improvements may be\n\t\t\tcritical.\n\n--with-latency\t\tBuilds the latency-tracking code into the library...\n\t\t\tthis slows your library down a bit but is very useful\n\t\t\tto find the cause of unexpected latencies occurring\n\t\t\tinside the library. See README.test-apps for more\n\t\t\tinfo\n\n\nExternally configurable important constants\n-------------------------------------------\n\nYou can control these from configure by just setting them as commandline\nargs throgh CFLAGS, eg\n\n./configure CFLAGS\u003d\u0022-DLWS_MAX_ZLIB_CONN_BUFFER\u003d8192\u0022\n\n\nThey all have reasonable defaults usable for all use-cases except resource-\nconstrained, so you only need to take care about them if you want to tune them\nto the amount of memory available.\n\n - LWS_MAX_HEADER_NAME_LENGTH default 64: max characters in an HTTP header\nname that libwebsockets can cope with, if a header arrives bigger than this\nit's ignored until the next header is seen\n\n - LWS_MAX_HEADER_LEN default 1024: allocated area to copy http headers that\nlibwebsockets knows about into. You only need to think about increasing this\nif your application might have monster length URLs for example, or some other\nheader that lws cares about will be abnormally large (headers it does not\nknow about are skipped).\n\n - LWS_MAX_PROTOCOLS default 5: largest amount of different protocols the\nserver can serve\n\n - LWS_MAX_EXTENSIONS_ACTIVE default 3: largest amount of extensions we can\nchoose to have active on one connection\n\n - SPEC_LATEST_SUPPORTED default 13: only change if you want to remove support\nfor later protocol versions... unlikely\n\n - AWAITING_TIMEOUT default 5: after this many seconds without a response, the\nserver will hang up on the client\n\n - CIPHERS_LIST_STRING default \u0022DEFAULT\u0022: SSL Cipher selection. It's advisable\nto tweak the ciphers allowed to be negotiated on secure connections for\nperformance reasons, otherwise a slow algorithm may be selected by the two\nendpoints and the server could expend most of its time just encrypting and\ndecrypting data, severely limiting the amount of messages it will be able to\nhandle per second. For example::\n\n \u0022RC4-MD5:RC4-SHA:AES128-SHA:AES256-SHA:HIGH:!DSS:!aNULL\u0022\n\n - SYSTEM_RANDOM_FILEPATH default \u0022/dev/urandom\u0022: if your random device differs\nyou can set it here\n\n - LWS_MAX_ZLIB_CONN_BUFFER maximum size a compression buffer is allowed to\ngrow to before closing the connection. Some limit is needed or any connecton\ncan exhaust all server memory by sending it 4G buffers full of zeros which the\nserver is expect to expand atomically. Default is 64KBytes.\n\n - LWS_SOMAXCONN maximum number of pending connect requests the listening\nsocket can cope with. Default is SOMAXCONN. If you need to use synthetic\ntests that just spam hundreds of connect requests at once without dropping\nany, you can try messing with these as well as ulimit (see later)\n(courtesy Edwin van der Oetelaar)\n\necho \u00222048 64512\u0022 \u003e /proc/sys/net/ipv4/ip_local_port_range\necho \u00221\u0022 \u003e /proc/sys/net/ipv4/tcp_tw_recycle\necho \u00221\u0022 \u003e /proc/sys/net/ipv4/tcp_tw_reuse\necho \u002210\u0022 \u003e /proc/sys/net/ipv4/tcp_fin_timeout\necho \u002265536\u0022 \u003e /proc/sys/net/core/somaxconn\necho \u002265536\u0022 \u003e /proc/sys/net/ipv4/tcp_max_syn_backlog\necho \u0022262144\u0022 \u003e /proc/sys/net/netfilter/nf_conntrack_max\n\n\nMemory efficiency\n-----------------\n\nUpdate at 35f332bb46464feb87eb\n\nEmbedded server-only configuration without extensions (ie, no compression\non websocket connections), but with full v13 websocket features and http\nserver, built on ARM Cortex-A9:\n\n./configure --without-client --without-extensions --disable-debug --enable-nofork --without-daemonize\n\n.text\t.rodata\t.data\t.bss\n11476\t2664\t288\t4\n\nContext Creation, 1024 fd limit[2]: 12288 (12 bytes per fd)\nPer-connection [3]: 4400 bytes\n\n\nThis shows the impact of the major configuration with/without options at\n13ba5bbc633ea962d46d using Ubuntu ARM on a PandaBoard ES.\n\nThese are accounting for static allocations from the library elf, there are\nadditional dynamic allocations via malloc\n\nStatic allocations, ARM9\n\t\t\t\t.text\t.rodata\t.data\t.bss\n All (no without)\t\t35024\t9940\t336\t4104\n without client\t\t\t25684\t7144\t336\t4104\n without client, exts\t\t21652\t6288\t288\t4104\n without client, exts, debug[1]\t19756\t3768\t288\t4104\n without server\t\t\t30304\t8160\t336\t4104\n without server, exts\t\t25382\t7204\t288\t4104\n without server, exts, debug[1]\t23712\t4256\t288\t4104\n\nDynamic allocations: ARM9 (32 bit)\n\n Context Creation, 1024 fd limit[2] in ulimit:\t12288 (12 bytes per fd)\n Per-connection (excluding headers[3]):\t\t 8740\n\nDynamic allocations: x86_64 (64 bit)\n\n Context Creation, 1024 fd limit[2] in ulimit:\t16384 (16 bytes per fd)\n Per-connection (excluding headers[3]):\t\t 9224\n\n[1] --disable-debug only removes messages below lwsl_notice. Since that is\nthe default logging level the impact is not noticable, error, warn and notice\nlogs are all still there.\n\n[2] 1024 fd per process is the default limit (set by ulimit) in at least Fedora\nand Ubuntu.\n\n[3] known headers are retained via additional mallocs for the lifetime of the\nconnection\n\n\n#################################### CMake ####################################\n\nCMake is a multi-platform build tool that can generate build files for many\ndifferent target platforms. See more info at http://www.cmake.org\n\nCMake also allows/recommends you to do \u0022out of source\u0022-builds, that is, \nthe build files are separated from your sources, so there is no need to \ncreate elaborate clean scripts to get a clean source tree, instead you \nsimply remove your build directory.\n\nLibwebsockets has been tested to build successfully on the following platforms\nwith SSL support (both OpenSSL/CyaSSL):\n\n- Windows\n- Linux (x86 and ARM)\n- OSX\n- NetBSD\n\nBuilding the library and test apps\n----------------------------------\n\nThe project settings used by CMake to generate the platform specific build\nfiles is called CMakeLists.txt. CMake then uses one of its \u0022Generators\u0022 to\noutput a Visual Studio project or Make file for instance. To see a list of\nthe available generators for your platform, simply run the \u0022cmake\u0022 command.\n\nNote that by default OpenSSL will be linked, if you don't want SSL support\nsee below on how to toggle compile options.\n\nBuilding on Unix:\n-----------------\n\n1. Install CMake 2.6 or greater: http://cmake.org/cmake/resources/software.html\n (Most Unix distributions comes with a packaged version also)\n\n2. Install OpenSSL.\n\n3. Generate the build files (default is Make files):\n\n\tcd /path/to/src\n\tmkdir build\n\tcd build\n\tcmake ..\n\n\t(NOTE: The build/ directory can have any name and be located anywhere\n\t on your filesystem, and that the argument \u0022..\u0022 given to cmake is simply\n\t the source directory of libwebsockets containing the CMakeLists.txt project\n\t file. All examples in this file assumes you use \u0022..\u0022)\n\n4. Finally you can build using the generated Makefile:\n\n\tmake\n\nBuilding on Windows (Visual Studio)\n-----------------------------------\n1. Install CMake 2.6 or greater: http://cmake.org/cmake/resources/software.html\n\n2. Install OpenSSL binaries. http://www.openssl.org/related/binaries.html\n (Preferably in the default location to make it easier for CMake to find them)\n\n3. Generate the Visual studio project by opening the Visual Studio cmd prompt:\n\n cd \u003cpath to src\u003e\n md build\n cd build\n cmake -G \u0022Visual Studio 10\u0022 ..\n\n (NOTE: There is also a cmake-gui available on Windows if you prefer that)\n\n4. Now you should have a generated Visual Studio Solution in your\n \u003cpath to src\u003e/build directory, which can be used to build.\n\nSetting compile options\n-----------------------\n\nTo set compile time flags you can either use one of the CMake gui applications\nor do it via command line.\n\nCommand line\n------------\nTo list avaialable options (ommit the H if you don't want the help text):\n\n\tcmake -LH ..\n\nThen to set an option and build (for example turn off SSL support):\n\n\tcmake -DWITH_SSL\u003d0 ..\nor\n\tcmake -DWITH_SSL:BOOL\u003dOFF ..\n\nUnix GUI\n--------\nIf you have a curses enabled build you simply type:\n(not all packages include this, my debian install does not for example).\n\t\n\tccmake\n\nWindows GUI\n-----------\nOn windows CMake comes with a gui application:\n\tStart -\u003e Programs -\u003e CMake -\u003e CMake (cmake-gui)\n\nCyaSSL replacement for OpenSSL\n------------------------------\nCyaSSL is a lightweight SSL library targeted at embedded system:\nhttp://www.yassl.com/yaSSL/Products-cyassl.html\n\nIt contains a OpenSSL compatability layer which makes it possible to pretty\nmuch link to it instead of OpenSSL, giving a much smaller footprint.\n\nNOTE: At the time of writing this the current release of CyaSSL contains a \ncrash bug due to some APIs libwebsocket uses. To be able to use this you will\nneed to use the current HEAD in their official repository:\n\thttps://github.com/cyassl/cyassl\n\nNOTE: cyassl needs to be compiled using the --enable-opensslExtra flag for\nthis to work.\n\nCompiling libwebsockets with CyaSSL\n-----------------------------------\n\ncmake -DUSE_CYASSL\u003d1 \n\t -DCYASSL_INCLUDE_DIRS\u003d/path/to/cyassl \n\t -DCYASSL_LIB\u003d/path/to/cyassl/cyassl.a ..\n\nNOTE: On windows use the .lib file extension for CYASSL_LIB instead.\n\nCross compiling\n---------------\nTo enable cross compiling libwebsockets using CMake you need to create\na \u0022Toolchain file\u0022 that you supply to CMake when generating your build files.\nCMake will then use the cross compilers and build paths specified in this file\nto look for dependencies and such.\n\nBelow is an example of how one of these files might look like:\n\n\t#\n\t# CMake Toolchain file for crosscompiling on ARM.\n\t#\n\t# This can be used when running cmake in the following way:\n\t# cd build/\n\t# cmake .. -DCMAKE_TOOLCHAIN_FILE\u003d/path/to/this/file/TC_arm-linux-gcc.cmake\n\t#\n\n\tset(CROSS_PATH /path/to/cross_environment/uClibc)\n\n\t# Target operating system name.\n\tset(CMAKE_SYSTEM_NAME Linux)\n\n\t# Name of C compiler.\n\tset(CMAKE_C_COMPILER \u0022${CROSS_PATH}/bin/arm-linux-uclibc-gcc\u0022)\n\tset(CMAKE_CXX_COMPILER \u0022${CROSS_PATH}/bin/arm-linux-uclibc-g++\u0022)\n\n\t# Where to look for the target environment. (More paths can be added here)\n\tset(CMAKE_FIND_ROOT_PATH \u0022${CROSS_PATH}\u0022)\n\n\t# Adjust the default behavior of the FIND_XXX() commands:\n\t# search programs in the host environment only.\n\tset(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)\n\n\t# Search headers and libraries in the target environment only.\n\tset(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)\n\tset(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)\n\nAdditional information on cross compilation with CMake:\n\thttp://www.vtk.org/Wiki/CMake_Cross_Compiling\n","s":{"c":1760904005,"u": 1204}}
],"g": 6037,"chitpc": 0,"ehitpc": 0,"indexed":0
,
"ab": 1, "si": 0, "db":0, "di":0, "sat":0, "lfc": "0000"}