Code Monkey home page Code Monkey logo

Comments (4)

chertov avatar chertov commented on July 21, 2024

I found a solution, but i fixed libsrtp-CMakeLists.txt

FROM debian

RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get -y install \
    build-essential cmake gawk libncurses-dev libc6-dev intltool python \
    git subversion time unzip zlib1g-dev libssl-dev wget curl cpio bc \
    gettext gettext-base liblocale-gettext-perl upx \
    flex texinfo help2man libtool-bin byacc bison pkg-config libyaml-dev

WORKDIR /root/
RUN git clone https://github.com/crosstool-ng/crosstool-ng
WORKDIR /root/crosstool-ng
RUN ./bootstrap
RUN ./configure && make && make install 
RUN ct-ng arm-unknown-linux-uclibcgnueabi
# here i change .config for root compilation
# CT_EXPERIMENTAL=y
# CT_ALLOW_BUILD_AS_ROOT=y
# CT_ALLOW_BUILD_AS_ROOT_SURE=y
RUN ct-ng build

# Now we have toolchain in /root/x-tools/arm-unknown-linux-uclibcgnueabi/
ENV PATH ${PATH}:/root/x-tools/arm-unknown-linux-uclibcgnueabi/bin
ENV SYS_ROOT /root/x-tools/arm-unknown-linux-uclibcgnueabi/arm-unknown-linux-uclibcgnueabi/sysroot/

RUN printf '\
set(CMAKE_SYSTEM_NAME Linux)\n\
set(CMAKE_SYSTEM_PROCESSOR arm)\n\
\n\
set(CMAKE_C_COMPILER "arm-unknown-linux-uclibcgnueabi-gcc")\n\
set(CMAKE_CXX_COMPILER "arm-unknown-linux-uclibcgnueabi-g++")\n\
set(CMAKE_AR_COMPILER "arm-unknown-linux-uclibcgnueabi-ar")\n\
\n\
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)\n\
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)\n\
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)\n\
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) \n\
' >> /root/x-tools/arm-unknown-linux-uclibcgnueabi/toolchain.cmake

# Build OpenSSL from sources
ENV OPENSSL_ROOT_DIR ${SYS_ROOT}usr/local/ssl/
WORKDIR /src
RUN git clone https://github.com/openssl/openssl.git
WORKDIR /src/openssl
RUN git checkout OpenSSL_1_1_0l && \
    CC=arm-unknown-linux-uclibcgnueabi-gcc \
    AR=arm-unknown-linux-uclibcgnueabi-ar \
    ./Configure linux-armv4 --prefix=${OPENSSL_ROOT_DIR} && make -j6 && make install
RUN rm -rf /src/openssl

# git clone or copy aws_webrtc repo
# copy repo because we need to fix configure process for libsrtp
# i specify --build and --host  libsrtp-CMakeLists.txt
#     CONFIGURE_COMMAND ${CMAKE_CURRENT_BINARY_DIR}/build/src/project_libsrtp/configure --build=x86_64-unknown-linux-gnu --host=arm-unknown-linux-uclibcgnueabi "CFLAGS=${CMAKE_C_FLAGS}" --prefix=${OPEN_SRC_INSTALL_PREFIX} --enable-openssl --with-openssl-dir=${OPENSSL_DIR}

COPY ./aws_webrtc /src/aws_webrtc
WORKDIR /src/aws_webrtc

RUN cmake ./ -DCMAKE_TOOLCHAIN_FILE=/root/x-tools/arm-unknown-linux-uclibcgnueabi/toolchain.cmake
RUN make

from amazon-kinesis-video-streams-webrtc-sdk-c.

Sean-Der avatar Sean-Der commented on July 21, 2024

This is amazing! Nice work @chertov, sorry this week has been slow.

I am going to roll your changes in, and make it so you don't need to do the libsrtp changes.

Maybe we can setup a builder that ensures cross-compiling always works.

from amazon-kinesis-video-streams-webrtc-sdk-c.

Sean-Der avatar Sean-Der commented on July 21, 2024

Hey @chertov

I opened a PR that makes cross-compilation a lot easier! I also added it to Travis, so it shouldn't regress in the future.

Thank you so much for the example. It helped me a lot when getting things working. If there is anyway I can make it better I would love to hear suggestions :)

from amazon-kinesis-video-streams-webrtc-sdk-c.

chertov avatar chertov commented on July 21, 2024

@Sean-Der thank you! Cross-compilation is very comfortable now.
libusrsctp has "Debug" build type by default, libusrsctp size is 1.9Mb
https://github.com/sctplab/usrsctp/blob/ef8a35a6e7eb30e7026bf20bde89e8a2d50eb8f1/CMakeLists.txt#L35
If i add to CMAKE_ARGS in libusrsctp-CMakeLists.txt -DCMAKE_BUILD_TYPE=Release libusrsctp is 658kb

from amazon-kinesis-video-streams-webrtc-sdk-c.

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.