[CMake] CMake cannot find 32 bit Open SSL on 64 bit Ubuntu 14.04

Bakary Diarra diarrabakaryk at gmail.com
Tue Jun 27 11:34:05 EDT 2017


I have a 64 bit Ubuntu 14.04 VM and I am trying to compile a 32 bit
application that depends on openssl and I keep getting the following error:

    -- The C compiler identification is GNU 4.8.4
    -- The CXX compiler identification is GNU 4.8.4
    -- Check for working C compiler: /usr/bin/gcc
    -- Check for working C compiler: /usr/bin/gcc -- works
    -- Detecting C compiler ABI info
    -- Detecting C compiler ABI info - done
    -- Check for working CXX compiler: /usr/bin/g++
    -- Check for working CXX compiler: /usr/bin/g++ -- works
    -- Detecting CXX compiler ABI info
    -- Detecting CXX compiler ABI info - done
    CMake Error at
/usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:108
(message):
      Could NOT find OpenSSL, try to set the path to OpenSSL root folder in
the
      system variable OPENSSL_ROOT_DIR (missing: OPENSSL_LIBRARIES) (found
      version "1.0.1f")

I have created the following test case to reproduce the error.

**DockerFile**

    FROM ubuntu:trusty

    LABEL maintainer="Diarra_Bakary at test.com"
    LABEL version="1.0"

    RUN dpkg --add-architecture i386 && \
        apt-get update && \
        apt-get install -y \
        git\
        cmake\
        curl:i386\
        libcurl4-openssl-dev:i386\
        libssl-dev:i386\
        uuid-dev:i386
    RUN apt-get install -y \
        gcc-multilib\
        g++-multilib

**CMakeLists.txt**

    cmake_minimum_required(VERSION 2.8)

    find_package(OpenSSL REQUIRED)

**x86_32.cmake**

    SET(CMAKE_SYSTEM_NAME Linux)

    # which compilers to use for C and C++
    set(CMAKE_C_COMPILER gcc)
    set(CMAKE_C_FLAGS -m32)
    set(CMAKE_CXX_COMPILER g++)
    set(CMAKE_CXX_FLAGS -m32)

Run the following commands

    mkdir cmake
    cd cmake
    cmake -DCMAKE_TOOLCHAIN_FILE=x86_32.cmake ..

Thanks in advance

*Bakary Diarra*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20170627/bc0f6396/attachment.html>


More information about the CMake mailing list