Giter Site home page Giter Site logo

Comments (14)

EhsanVahab avatar EhsanVahab commented on May 14, 2024

I find that deflateEnd function is defined as part of the zlib library. so I added #include "<zlib.h>" to the IXWebSocketPerMessageDeflateCodec.cpp then I rebuilt it.
but it's just same to same.

from ixwebsocket.

bsergean avatar bsergean commented on May 14, 2024

You need to add 'z' to the linker options, or 'link with zlib'. Do you have an option with Eclipse to specify 'link options' ? (option A)

If you cannot find it, you can manually add the files in third_party/zlib (option B)

    adler32.c
    compress.c
    crc32.c
    deflate.c
    gzclose.c
    gzlib.c
    gzread.c
    gzwrite.c
    inflate.c
    infback.c
    inftrees.c
    inffast.c
    trees.c
    uncompr.c
    zutil.c

You'll need to add those files to your project (from the zlib CMakeLists.txt).

It is definitely cleaner to go with option A if you are on mac or Linux. On Windows zlib doesn't come with the OS so you need to go with option B.

from ixwebsocket.

EhsanVahab avatar EhsanVahab commented on May 14, 2024

It came to my mind too and I did.
But the problem wasn't resolved

from ixwebsocket.

bsergean avatar bsergean commented on May 14, 2024

from ixwebsocket.

EhsanVahab avatar EhsanVahab commented on May 14, 2024

yes I have.
I have referenced them and built by: -I/usr/local/include/ -L/usr/local/lib -lz
is there any difference between the ubuntu default zlib and which you put in the third_part ?
I'm using the zlib installed by ubuntu package :sudo apt-get -y install libz-dev

from ixwebsocket.

bsergean avatar bsergean commented on May 14, 2024

That's quite strange. The headers should go to /usr/include/zlib.h

#include "<zlib.h>"

That looks like a typo. Try:

#include <zlib.h>

from ixwebsocket.

EhsanVahab avatar EhsanVahab commented on May 14, 2024

Yes this seemingly simple problem is driving me crazy.
I have all the zlib function when I use Eclipse auto correction
look at the following sample, it's built successfully :

#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <condition_variable>
#include <mutex>
#include <chrono>
#include <zlib.h>
#include <ixwebsocket/IXWebSocket.h>

using namespace std;


int main(int argc, char** argv)
{

z_streamp a;
deflate(a,0);


}

from ixwebsocket.

EhsanVahab avatar EhsanVahab commented on May 14, 2024

maybe there's something wrong with my installation commands. I've executed following commands to make:

git clone https://github.com/machinezone/IXWebSocket.git
cd IXWebSocket
mkdir build
cd build
cmake ..
sudo make
sudo make install
sudo ldconfig

from ixwebsocket.

bsergean avatar bsergean commented on May 14, 2024

from ixwebsocket.

EhsanVahab avatar EhsanVahab commented on May 14, 2024

everything went well but sadly the problem remains.
cmake's result:
cmake: /usr/local/lib/libcurl.so.4: no version information available (required by cmake) -- The C compiler identification is GNU 7.2.0 -- The CXX compiler identification is GNU 7.2.0 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Looking for pthread.h -- Looking for pthread.h - found -- Looking for pthread_create -- Looking for pthread_create - not found -- Looking for pthread_create in pthreads -- Looking for pthread_create in pthreads - not found -- Looking for pthread_create in pthread -- Looking for pthread_create in pthread - found -- Found Threads: TRUE -- Configuring done -- Generating done -- Build files have been written to: /home/userver/Project/IXWebSocket/build

sudo make install result :
/usr/bin/cmake: /usr/local/lib/libcurl.so.4: no version information available (required by /usr/bin/cmake) /usr/bin/cmake: /usr/local/lib/libcurl.so.4: no version information available (required by /usr/bin/cmake) /usr/bin/cmake: /usr/local/lib/libcurl.so.4: no version information available (required by /usr/bin/cmake) Scanning dependencies of target ixwebsocket /usr/bin/cmake: /usr/local/lib/libcurl.so.4: no version information available (required by /usr/bin/cmake) [ 3%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXSocket.cpp.o /usr/bin/cmake: /usr/local/lib/libcurl.so.4: no version information available (required by /usr/bin/cmake) [ 7%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXSocketServer.cpp.o /usr/bin/cmake: /usr/local/lib/libcurl.so.4: no version information available (required by /usr/bin/cmake) [ 11%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXSocketConnect.cpp.o /usr/bin/cmake: /usr/local/lib/libcurl.so.4: no version information available (required by /usr/bin/cmake) [ 14%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXSocketFactory.cpp.o /usr/bin/cmake: /usr/local/lib/libcurl.so.4: no version information available (required by /usr/bin/cmake) [ 18%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXDNSLookup.cpp.o /usr/bin/cmake: /usr/local/lib/libcurl.so.4: no version information available (required by /usr/bin/cmake) [ 22%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXCancellationRequest.cpp.o /usr/bin/cmake: /usr/local/lib/libcurl.so.4: no version information available (required by /usr/bin/cmake) [ 25%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXNetSystem.cpp.o /usr/bin/cmake: /usr/local/lib/libcurl.so.4: no version information available (required by /usr/bin/cmake) [ 29%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXWebSocket.cpp.o /usr/bin/cmake: /usr/local/lib/libcurl.so.4: no version information available (required by /usr/bin/cmake) [ 33%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXWebSocketServer.cpp.o /usr/bin/cmake: /usr/local/lib/libcurl.so.4: no version information available (required by /usr/bin/cmake) [ 37%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXWebSocketTransport.cpp.o /usr/bin/cmake: /usr/local/lib/libcurl.so.4: no version information available (required by /usr/bin/cmake) [ 40%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXWebSocketHandshake.cpp.o /usr/bin/cmake: /usr/local/lib/libcurl.so.4: no version information available (required by /usr/bin/cmake) [ 44%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXWebSocketPerMessageDeflate.cpp.o /usr/bin/cmake: /usr/local/lib/libcurl.so.4: no version information available (required by /usr/bin/cmake) [ 48%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXWebSocketPerMessageDeflateCodec.cpp.o /usr/bin/cmake: /usr/local/lib/libcurl.so.4: no version information available (required by /usr/bin/cmake) [ 51%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXWebSocketPerMessageDeflateOptions.cpp.o /usr/bin/cmake: /usr/local/lib/libcurl.so.4: no version information available (required by /usr/bin/cmake) [ 55%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXWebSocketHttpHeaders.cpp.o /usr/bin/cmake: /usr/local/lib/libcurl.so.4: no version information available (required by /usr/bin/cmake) [ 59%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXHttpClient.cpp.o /usr/bin/cmake: /usr/local/lib/libcurl.so.4: no version information available (required by /usr/bin/cmake) [ 62%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXUrlParser.cpp.o /usr/bin/cmake: /usr/local/lib/libcurl.so.4: no version information available (required by /usr/bin/cmake) [ 66%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/LUrlParser.cpp.o /usr/bin/cmake: /usr/local/lib/libcurl.so.4: no version information available (required by /usr/bin/cmake) [ 70%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXSelectInterrupt.cpp.o /usr/bin/cmake: /usr/local/lib/libcurl.so.4: no version information available (required by /usr/bin/cmake) [ 74%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXSelectInterruptFactory.cpp.o /usr/bin/cmake: /usr/local/lib/libcurl.so.4: no version information available (required by /usr/bin/cmake) [ 77%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXConnectionState.cpp.o /usr/bin/cmake: /usr/local/lib/libcurl.so.4: no version information available (required by /usr/bin/cmake) [ 81%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXWebSocketCloseConstants.cpp.o /usr/bin/cmake: /usr/local/lib/libcurl.so.4: no version information available (required by /usr/bin/cmake) [ 85%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXWebSocketMessageQueue.cpp.o /usr/bin/cmake: /usr/local/lib/libcurl.so.4: no version information available (required by /usr/bin/cmake) [ 88%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXSelectInterruptPipe.cpp.o /usr/bin/cmake: /usr/local/lib/libcurl.so.4: no version information available (required by /usr/bin/cmake) [ 92%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/linux/IXSetThreadName_linux.cpp.o /usr/bin/cmake: /usr/local/lib/libcurl.so.4: no version information available (required by /usr/bin/cmake) [ 96%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXSelectInterruptEventFd.cpp.o /usr/bin/cmake: /usr/local/lib/libcurl.so.4: no version information available (required by /usr/bin/cmake) [100%] Linking CXX static library libixwebsocket.a /usr/bin/cmake: /usr/local/lib/libcurl.so.4: no version information available (required by /usr/bin/cmake) /usr/bin/cmake: /usr/local/lib/libcurl.so.4: no version information available (required by /usr/bin/cmake) /usr/bin/cmake: /usr/local/lib/libcurl.so.4: no version information available (required by /usr/bin/cmake) [100%] Built target ixwebsocket /usr/bin/cmake: /usr/local/lib/libcurl.so.4: no version information available (required by /usr/bin/cmake) /usr/bin/cmake: /usr/local/lib/libcurl.so.4: no version information available (required by /usr/bin/cmake) Install the project... /usr/bin/cmake: /usr/local/lib/libcurl.so.4: no version information available (required by /usr/bin/cmake) -- Install configuration: "" -- Installing: /usr/local/lib/libixwebsocket.a -- Installing: /usr/local/include/ixwebsocket/IXSocket.h -- Installing: /usr/local/include/ixwebsocket/IXSocketServer.h -- Installing: /usr/local/include/ixwebsocket/IXSocketConnect.h -- Installing: /usr/local/include/ixwebsocket/IXSocketFactory.h -- Installing: /usr/local/include/ixwebsocket/IXSetThreadName.h -- Installing: /usr/local/include/ixwebsocket/IXDNSLookup.h -- Installing: /usr/local/include/ixwebsocket/IXCancellationRequest.h -- Installing: /usr/local/include/ixwebsocket/IXNetSystem.h -- Installing: /usr/local/include/ixwebsocket/IXProgressCallback.h -- Installing: /usr/local/include/ixwebsocket/IXWebSocket.h -- Installing: /usr/local/include/ixwebsocket/IXWebSocketServer.h -- Installing: /usr/local/include/ixwebsocket/IXWebSocketTransport.h -- Installing: /usr/local/include/ixwebsocket/IXWebSocketHandshake.h -- Installing: /usr/local/include/ixwebsocket/IXWebSocketSendInfo.h -- Installing: /usr/local/include/ixwebsocket/IXWebSocketErrorInfo.h -- Installing: /usr/local/include/ixwebsocket/IXWebSocketPerMessageDeflate.h -- Installing: /usr/local/include/ixwebsocket/IXWebSocketPerMessageDeflateCodec.h -- Installing: /usr/local/include/ixwebsocket/IXWebSocketPerMessageDeflateOptions.h -- Installing: /usr/local/include/ixwebsocket/IXWebSocketHttpHeaders.h -- Installing: /usr/local/include/ixwebsocket/libwshandshake.hpp -- Installing: /usr/local/include/ixwebsocket/IXHttpClient.h -- Installing: /usr/local/include/ixwebsocket/IXUrlParser.h -- Installing: /usr/local/include/ixwebsocket/LUrlParser.h -- Installing: /usr/local/include/ixwebsocket/IXSelectInterrupt.h -- Installing: /usr/local/include/ixwebsocket/IXSelectInterruptFactory.h -- Installing: /usr/local/include/ixwebsocket/IXConnectionState.h -- Installing: /usr/local/include/ixwebsocket/IXWebSocketCloseConstants.h -- Installing: /usr/local/include/ixwebsocket/IXWebSocketMessageQueue.h -- Installing: /usr/local/include/ixwebsocket/IXSelectInterruptEventFd.h

from ixwebsocket.

EhsanVahab avatar EhsanVahab commented on May 14, 2024

and it's my compiler commands and outputs

Building file: ../HelloObject.cpp
Invoking: GCC C++ Compiler
g++ -I/usr/local/include/opencv -I/usr/local/include/curl -I/usr/local/include/ixwebsocket -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"HelloObject.d" -MT"HelloObject.o" -o "HelloObject.o" "../HelloObject.cpp"
Finished building: ../HelloObject.cpp
 
Building target: Hello-Upload
Invoking: GCC C++ Linker
g++ -L/usr/local/lib -o "Hello-Upload"  ./HelloObject.o   -lpthread -lz -lixwebsocket -lcurl -ljsoncpp
/usr/local/lib/libixwebsocket.a(IXWebSocket.cpp.o): In function `std::thread::thread<void (ix::WebSocket::*)(), ix::WebSocket*>(void (ix::WebSocket::*&&)(), ix::WebSocket*&&)':
IXWebSocket.cpp:(.text._ZNSt6threadC2IMN2ix9WebSocketEFvvEJPS2_EEEOT_DpOT0_[_ZNSt6threadC5IMN2ix9WebSocketEFvvEJPS2_EEEOT_DpOT0_]+0x33): undefined reference to `pthread_create'
/usr/local/lib/libixwebsocket.a(IXWebSocketPerMessageDeflateCodec.cpp.o): In function `ix::WebSocketPerMessageDeflateCompressor::~WebSocketPerMessageDeflateCompressor()':
IXWebSocketPerMessageDeflateCodec.cpp:(.text+0x82): undefined reference to `deflateEnd'
/usr/local/lib/libixwebsocket.a(IXWebSocketPerMessageDeflateCodec.cpp.o): In function `ix::WebSocketPerMessageDeflateCompressor::init(unsigned char, bool)':
IXWebSocketPerMessageDeflateCodec.cpp:(.text+0xf4): undefined reference to `deflateInit2_'
/usr/local/lib/libixwebsocket.a(IXWebSocketPerMessageDeflateCodec.cpp.o): In function `ix::WebSocketPerMessageDeflateCompressor::compress(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)':
IXWebSocketPerMessageDeflateCodec.cpp:(.text+0x30d): undefined reference to `deflate'
/usr/local/lib/libixwebsocket.a(IXWebSocketPerMessageDeflateCodec.cpp.o): In function `ix::WebSocketPerMessageDeflateDecompressor::~WebSocketPerMessageDeflateDecompressor()':
IXWebSocketPerMessageDeflateCodec.cpp:(.text+0x44c): undefined reference to `inflateEnd'
/usr/local/lib/libixwebsocket.a(IXWebSocketPerMessageDeflateCodec.cpp.o): In function `ix::WebSocketPerMessageDeflateDecompressor::init(unsigned char, bool)':
IXWebSocketPerMessageDeflateCodec.cpp:(.text+0x4ab): undefined reference to `inflateInit2_'
/usr/local/lib/libixwebsocket.a(IXWebSocketPerMessageDeflateCodec.cpp.o): In function `ix::WebSocketPerMessageDeflateDecompressor::decompress(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)':
IXWebSocketPerMessageDeflateCodec.cpp:(.text+0x5e1): undefined reference to `inflate'
/usr/local/lib/libixwebsocket.a(IXSetThreadName_linux.cpp.o): In function `ix::setThreadName(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
IXSetThreadName_linux.cpp:(.text+0x51): undefined reference to `pthread_setname_np'
/usr/local/lib/libixwebsocket.a(IXDNSLookup.cpp.o): In function `std::thread::thread<void (ix::DNSLookup::*)(unsigned long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int), ix::DNSLookup*, unsigned long&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int&>(void (ix::DNSLookup::*&&)(unsigned long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int), ix::DNSLookup*&&, unsigned long&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int&)':
IXDNSLookup.cpp:(.text._ZNSt6threadC2IMN2ix9DNSLookupEFvmRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiEJPS2_RmSA_RiEEEOT_DpOT0_[_ZNSt6threadC5IMN2ix9DNSLookupEFvmRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiEJPS2_RmSA_RiEEEOT_DpOT0_]+0x5d): undefined reference to `pthread_create'
collect2: error: ld returned 1 exit status
makefile:44: recipe for target 'Hello-Upload' failed
make: *** [Hello-Upload] Error 1

from ixwebsocket.

bsergean avatar bsergean commented on May 14, 2024

from ixwebsocket.

EhsanVahab avatar EhsanVahab commented on May 14, 2024

unbelievable 👍
it's solved.
I'm very very thankful for your guide and time you've spent.
I wish I will help you one day

from ixwebsocket.

bsergean avatar bsergean commented on May 14, 2024

from ixwebsocket.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.