Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [paho-dev] Issue compiling Paho C library with SSL and CMake

Hello Adrián,

You found a bug in the CMake build scripts. The regular Makefile adds
-DOPENSSL when compiling the "as" and "cs" libraries. However, the
CMakeLists.txt does not pass this flag to those libraries. Thus the
SSL code is not compiled.

I'll provide a fix in the next hours. But for now you may fix your
CMakeLists.txt. On line src/CMakeLists.txt:86 add the COMPILE_FLAGS to
the SET_TARGET_PROPERTIES():

    SET_TARGET_PROPERTIES(
        paho-mqtt3cs paho-mqtt3as PROPERTIES
        COMPILE_FLAGS -DOPENSSL
        VERSION ${CLIENT_VERSION}
        SOVERSION ${PAHO_VERSION_MAJOR})

Let me know if this solves your problem.

Best regards,

2016-11-30 2:58 GMT-06:00 Moran Adrian <amoran@xxxxxxxxxx>:
> Hi folks,
>
> I cannot completely understand compilation process of Paho C library. I’ve
> cloned Git repository and doing a simple ‘make’ I am able to generate the
> four libraries (c, cs, a, as). That is ok.
>
>
>
> The problem comes when I try to do the same process using CMakeLists.txt
> instead of the default Makefile. I need to do this since I am looking for
> Paho libraries for ARM architectures. So, I do:
>
>
>
> mkdir –p build
>
> cmake -DPAHO_WITH_SSL=TRUE
> -DOPENSSL_LIB_SEARCH_PATH=/usr/lib/x86_64-linux-gnu
> -DOPENSSL_INC_SEARCH_PATH=/usr/include/x86_64-linux-gnu/openssl ..
>
> make
>
>
>
>
>
> Apparently all works fine, it creates the four libraries but they are not
> the correct ones. If I focus only in Asynchronous library for example, I can
> see that:
>
> Default Makefile generates:
>
> -   libpaho-mqtt3a.so.1.0 (390K)
>
> -   libpaho-mqtt3as.so.1.0 (617K)
>
> Using CMake generates;
>
> -   libpaho-mqtt3a.so.1.0.3 (186K)
>
> -   libpaho-mqtt3as.so.1.0.3 (186K)
>
>
>
> As you could see, using CMake the size of both libraries (with and without
> SSL) is the same, and both of them have half of the size of the smaller
> library created by default Makefile.
>
> On the other hand, the version seems to be also different (1.0 vs 1.0.3).
>
> And the most estrange thing is that library generated with CMake work fine
> without SSL, but of course fails if you try to emply SSL on your connection.
>
>
>
> What is the correct way to compile the library using CMake? I am able to
> compile it (even for different architectures using CMAKE_TOOLCHAIN_FILE
> variable) but no with SSL support.
>
> A precompiled version of the libraries for ARM architectures will do the
> trick, but I would like to know how to compile them by my own.
>
>
>
> Thanks in advance!
>
>
>
> Adrián
>
>
>
>
>
>
>
>
>
>
>
>
> _______________________________________________
> paho-dev mailing list
> paho-dev@xxxxxxxxxxx
> To change your delivery options, retrieve your password, or unsubscribe from
> this list, visit
> https://dev.eclipse.org/mailman/listinfo/paho-dev



-- 
Guilherme Maciel Ferreira
Mobile Brazil: +55 48 9917 3969
Mobile México: +52 33 1968 6766
Site: http://guilhermemacielferreira.com/
Skype: guilherme.maciel.ferreira


Back to the top