{"action":"created","issue":{"url":"https://api.github.com/repos/warmcat/libwebsockets/issues/321","labels_url":"https://api.github.com/repos/warmcat/libwebsockets/issues/321/labels{/name}","comments_url":"https://api.github.com/repos/warmcat/libwebsockets/issues/321/comments","events_url":"https://api.github.com/repos/warmcat/libwebsockets/issues/321/events","html_url":"https://github.com/warmcat/libwebsockets/issues/321","id":109650184,"number":321,"title":"compilation problem libwebsockets 1.4 with libev-4.20 ( last but same with tried with 4.15 or 4.19)","user":{"login":"piaff33z","id":14958628,"avatar_url":"https://avatars.githubusercontent.com/u/14958628?v=3","gravatar_id":"","url":"https://api.github.com/users/piaff33z","html_url":"https://github.com/piaff33z","followers_url":"https://api.github.com/users/piaff33z/followers","following_url":"https://api.github.com/users/piaff33z/following{/other_user}","gists_url":"https://api.github.com/users/piaff33z/gists{/gist_id}","starred_url":"https://api.github.com/users/piaff33z/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/piaff33z/subscriptions","organizations_url":"https://api.github.com/users/piaff33z/orgs","repos_url":"https://api.github.com/users/piaff33z/repos","events_url":"https://api.github.com/users/piaff33z/events{/privacy}","received_events_url":"https://api.github.com/users/piaff33z/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-10-03T23:03:09Z","updated_at":"2015-10-03T23:28:21Z","closed_at":null,"body":"Hello I tried to compile libwebsockets 1.4 from source and linking it with libev-4.20. Below steps that I followed\r\n\r\n**cd /tmp/libwebsockets-1.4-chrome43-firefox-36**\r\n**mkdir build**\r\n**cd build**\r\n\r\n//# sets for path about libev//\r\nexport CFLAGS=-I/opt/system/libev/include\r\nexport LDFLAGS=-L/opt/system/libev/lib\r\nexport CPPFLAGS=$CFLAGS\r\n\r\n**cmake -DCMAKE_INSTALL_PREFIX:PATH=/opt/network/libwebsockets-1.4 -DLWS_USE_LIBEV:BOOL=ON -DLWS_IPV6:BOOL=ON ..**\r\n....\r\n....\r\n LWS_WITH_SSL = ON  (SSL Support)\r\n LWS_SSL_CLIENT_USE_OS_CA_CERTS = 1\r\n LWS_USE_CYASSL = OFF (CyaSSL replacement for OpenSSL)\r\n LWS_WITHOUT_BUILTIN_GETIFADDRS = OFF\r\n LWS_WITHOUT_CLIENT = OFF\r\n LWS_WITHOUT_SERVER = OFF\r\n LWS_LINK_TESTAPPS_DYNAMIC = OFF\r\n LWS_WITHOUT_TESTAPPS = OFF\r\n LWS_WITHOUT_TEST_SERVER = OFF\r\n LWS_WITHOUT_TEST_SERVER_EXTPOLL = OFF\r\n LWS_WITHOUT_TEST_PING = OFF\r\n LWS_WITHOUT_TEST_CLIENT = OFF\r\n LWS_WITHOUT_TEST_FRAGGLE = OFF\r\n LWS_WITHOUT_DEBUG = OFF\r\n LWS_WITHOUT_EXTENSIONS = OFF\r\n LWS_WITH_LATENCY = OFF\r\n LWS_WITHOUT_DAEMONIZE = OFF\r\n LWS_USE_LIBEV = ON\r\n LWS_IPV6 = ON\r\n LWS_WITH_HTTP2 = OFF\r\n-- Configuring done\r\n-- Generating done\r\n-- Build files have been written to: /images/programmation/libwebsockets-1.4-chrome43-firefox-36/build\r\n\r\n**make**\r\n\r\nScanning dependencies of target websockets\r\n[  2%] Building C object CMakeFiles/websockets.dir/lib/base64-decode.c.o\r\n[  4%] Building C object CMakeFiles/websockets.dir/lib/handshake.c.o\r\n[  6%] Building C object CMakeFiles/websockets.dir/lib/libwebsockets.c.o\r\n[  8%] Building C object CMakeFiles/websockets.dir/lib/service.c.o\r\n[ 10%] Building C object CMakeFiles/websockets.dir/lib/pollfd.c.o\r\n[ 12%] Building C object CMakeFiles/websockets.dir/lib/output.c.o\r\n[ 14%] Building C object CMakeFiles/websockets.dir/lib/parsers.c.o\r\n[ 16%] Building C object CMakeFiles/websockets.dir/lib/context.c.o\r\n[ 18%] Building C object CMakeFiles/websockets.dir/lib/sha-1.c.o\r\n[ 20%] Building C object CMakeFiles/websockets.dir/lib/alloc.c.o\r\n[ 22%] Building C object CMakeFiles/websockets.dir/lib/client.c.o\r\n[ 25%] Building C object CMakeFiles/websockets.dir/lib/client-handshake.c.o\r\n[ 27%] Building C object CMakeFiles/websockets.dir/lib/client-parser.c.o\r\n[ 29%] Building C object CMakeFiles/websockets.dir/lib/ssl.c.o\r\n[ 31%] Building C object CMakeFiles/websockets.dir/lib/lws-plat-unix.c.o\r\n[ 33%] Building C object CMakeFiles/websockets.dir/lib/server.c.o\r\n[ 35%] Building C object CMakeFiles/websockets.dir/lib/server-handshake.c.o\r\n[ 37%] Building C object CMakeFiles/websockets.dir/lib/extension.c.o\r\n[ 39%] Building C object CMakeFiles/websockets.dir/lib/extension-deflate-frame.c.o\r\n[ 41%] Building C object CMakeFiles/websockets.dir/lib/extension-deflate-stream.c.o\r\n[ 43%] Building C object CMakeFiles/websockets.dir/lib/daemonize.c.o\r\nLinking C static library lib/libwebsockets.a\r\nCopying OS X content lib/Headers/libwebsockets.h\r\nCopying OS X content lib/Headers/lws_config.h\r\n[ 43%] Built target websockets\r\nScanning dependencies of target test-client\r\n[ 45%] Building C object CMakeFiles/test-client.dir/test-server/test-client.c.o\r\nLinking C executable bin/libwebsockets-test-client\r\nlib/libwebsockets.a(service.c.o): In function `lws_handle_POLLOUT_event':\r\nservice.c:(.text+0x264): undefined reference to `lws_libev_io'\r\nlib/libwebsockets.a(pollfd.c.o): In function `remove_wsi_socket_from_fds':\r\npollfd.c:(.text+0x1ed): undefined reference to `lws_libev_io'\r\nlib/libwebsockets.a(pollfd.c.o): In function `libwebsocket_callback_on_writable':\r\npollfd.c:(.text+0x6e9): undefined reference to `lws_libev_io'\r\nlib/libwebsockets.a(pollfd.c.o): In function `libwebsocket_callback_on_writable_all_protocol\r\npollfd.c:(.text+0x7d7): undefined reference to `lws_libev_io'\r\nlib/libwebsockets.a(context.c.o): In function `libwebsocket_create_context':\r\ncontext.c:(.text+0x181): undefined reference to `lws_feature_status_libev'\r\nlib/libwebsockets.a(ssl.c.o): In function `lws_server_socket_service_ssl':\r\nssl.c:(.text+0x72c): undefined reference to `lws_libev_io'\r\nssl.c:(.text+0x893): undefined reference to `lws_libev_io'\r\nssl.c:(.text+0x94b): undefined reference to `lws_libev_io'\r\nlib/libwebsockets.a(lws-plat-unix.c.o): In function `lws_plat_insert_socket_into_fds':\r\nlws-plat-unix.c:(.text+0x14a): undefined reference to `lws_libev_io'\r\nlib/libwebsockets.a(lws-plat-unix.c.o): In function `lws_plat_init_fd_tables':\r\nlws-plat-unix.c:(.text+0x325): undefined reference to `lws_libev_init_fd_table'\r\nlib/libwebsockets.a(lws-plat-unix.c.o): In function `lws_plat_service':\r\nlws-plat-unix.c:(.text+0x66c): undefined reference to `lws_libev_run'\r\nlib/libwebsockets.a(server.c.o): In function `lws_server_socket_service':\r\nserver.c:(.text+0x405): undefined reference to `lws_libev_io'\r\nserver.c:(.text+0x544): undefined reference to `lws_libev_accept'\r\ncollect2: ld returned 1 exit status\r\nmake[2]: * [bin/libwebsockets-test-client] Error 1\\\\\r\nmake[1]: * [CMakeFiles/test-client.dir/all] Error 2\\\\\r\nmake: * [all] Error 2\\\\\r\n\r\nIf i try to compile without libev support by removing option  -DLWS_USE_LIBEV:BOOL=ON, I have no issue...\r\n\r\nI think it is a linking problem. After some investigations I found in file CMakeFiles/test-client.dir/link.txt\r\n\r\ncontent is :\r\n\r\n/usr/bin/cc  -Wall -Werror -O3 -fvisibility=hidden -I/opt/system/libev/include    -L/opt/system/libev/lib CMakeFiles/test-client.dir/test-server/test-client.c.o  -o bin/libwebsockets-test-client -rdynamic lib/libwebsockets.a -lz -lssl -lcrypto -ldl -lm\r\n\r\nIf I try to run this command from build directory I have exactly same error..."},"comment":{"url":"https://api.github.com/repos/warmcat/libwebsockets/issues/comments/145299003","html_url":"https://github.com/warmcat/libwebsockets/issues/321#issuecomment-145299003","issue_url":"https://api.github.com/repos/warmcat/libwebsockets/issues/321","id":145299003,"user":{"login":"JoakimSoderberg","id":1446626,"avatar_url":"https://avatars.githubusercontent.com/u/1446626?v=3","gravatar_id":"","url":"https://api.github.com/users/JoakimSoderberg","html_url":"https://github.com/JoakimSoderberg","followers_url":"https://api.github.com/users/JoakimSoderberg/followers","following_url":"https://api.github.com/users/JoakimSoderberg/following{/other_user}","gists_url":"https://api.github.com/users/JoakimSoderberg/gists{/gist_id}","starred_url":"https://api.github.com/users/JoakimSoderberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JoakimSoderberg/subscriptions","organizations_url":"https://api.github.com/users/JoakimSoderberg/orgs","repos_url":"https://api.github.com/users/JoakimSoderberg/repos","events_url":"https://api.github.com/users/JoakimSoderberg/events{/privacy}","received_events_url":"https://api.github.com/users/JoakimSoderberg/received_events","type":"User","site_admin":false},"created_at":"2015-10-03T23:28:21Z","updated_at":"2015-10-03T23:28:21Z","body":"Hello, yes. That is not the way you tell CMake where libev is located. CMake might compile multiple executables or whatever with different CFLAGS, so that's not a good idea in any case.\r\n\r\nNormally CMake will find the lib automatically. Here's a link on how libraries are found in CMake: https://cmake.org/Wiki/CMake:How_To_Find_Libraries\r\n\r\nBut your lib seems to be in a non-standard location, so libwebsockets lets you set the paths manually also using these variables:\r\nhttps://github.com/warmcat/libwebsockets/blob/master/CMakeLists.txt#L95"}}