Alpine linux install gcc

Installing Gcc from Source on Alpine

It turns out that in this particular case one needs to install mpc1-dev, gmp-dev or mpfr-dev. I was missing out on mpc1-dev.

Install a specific GCC/G++ Version inside an Alpine Linux container

If you wish to use an older version of GCC, you can download the source from GCC 4.8.0
and then build gcc from source.

You can give all the commands as part of your Dockerfile and then build the alpine image with the required GCC. If you don’t want to create image, you can simply follow the steps mentioned to build gcc in alpine container.

error: command ‘gcc’ failed with exit status 1 when installing pip packages on alpine docker image

Missing the header file Python.h , this file is provide by python2-dev ( -dev mean package for doing development with ) .

With this https://pkgs.alpinelinux.org/contents you can search all packages that have Python.h

I was able to run pip install pygpgme by adding these 3 packages :

And the Dockerfile will be :

FROM alpine:latest

RUN apk update && apk upgrade
RUN apk add --no-cache bash\
python \
pkgconfig \
git \
gcc \
openldap \
libcurl \
python2-dev \
gpgme-dev \
libc-dev \
&& rm -rf /var/cache/apk/*
RUN wget https://bootstrap.pypa.io/get-pip.py && python get-pip.py
RUN pip install setuptools==30.1.0

Gdal installation in Alpine compilation failure — error: command ‘gcc’ failed with exit status 1

It seems there’s a GDAL version conflict:

  • pip install gdal pulls the sources tarball for GDAL 3.0.0 and attempts to build it from source;
  • The 2.4.0-r1 gdal-dev package is being installed, which is indeed the latest available in Alpine repositories;
  • GDAL 3.0.0 won’t build against the 2.4.0-r1 gdal-dev headers.

As a workaround, installing the GDAL module of the matching version, 2.4.0, may be successful:

installing a GCC compiler onto a Docker Container

FROM ubuntu
# .
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && \
apt-get -y install gcc mono-mcs && \
rm -rf /var/lib/apt/lists/*

Источник

Alpine linux install gcc

Запись: and-semakin/mytetra_data/master/base/1550393347wv6a8utpbq/text.html на raw.githubusercontent.com

apk add —no-cache build-base

  • Список основных команд Docker
  • Dockerize your Python Application
  • Автоматический запуск контейнеров Docker
  • Установить JetBrains YouTrack в Docker (неофициальный образ)
  • Установить JetBrains Hub в Docker
  • Установить JetBrains Upsource в Docker
  • Аутентификация в удаленный репозиторий в Docker
  • Установить JetBrains YouTrack в Docker
  • Установить GitLab CE в Docker
  • Portainer — GUI для управления Docker
  • Запустить pgAdmin4 в Docker
  • Бэкап Gitlab в Docker
  • redis в Docker
  • MTProto Proxy в Docker
  • Kong в Docker
  • Запустить Gitlab CI Runner в Docker
  • Запустить Docker Registry в Docker
  • Запустить PsiTransfer (файлообменник) в Docker
  • Скопировать файл из Docker-контейнера на хост и наоборот
  • Установить часовой пояс в контейнере Docker
  • Запустить простой OpenVPN в Docker
  • Вывести только определенные столбцы docker ps
  • Аналог sleep infinity для Alpine
  • Установить psycopg2 в Alpine
  • Удалить неиспользуемые данные — docker system prune
  • Указать кастомный префикс для контейнеров в docker-compose
  • Установить переменную окружения во время сборки в Docker
  • Ошибка создания контейнера Docker при включенном OpenVPN
  • Установить gcc в Alpine
  • Установить cffi в Alpine
  • docker stats — мониторинг потребления памяти
Читайте также:  Консоль linux как вызвать

Источник

Building with GCC¶

For building U-Boot you need a GCC compiler for your host platform. If you are not building on the target platform you further need a GCC cross compiler.

Debian based¶

On Debian based systems the cross compiler packages are named gcc—linux-gnu.

You could install GCC and the GCC cross compiler for the ARMv8 architecture with

sudo apt-get install gcc gcc-aarch64-linux-gnu

Depending on the build targets further packages maybe needed

sudo apt-get install bc bison build-essential coccinelle \ device-tree-compiler dfu-util efitools flex gdisk graphviz imagemagick \ liblz4-tool libgnutls28-dev libguestfs-tools libncurses-dev \ libpython3-dev libsdl2-dev libssl-dev lz4 lzma lzma-alone openssl \ pkg-config python3 python3-asteval python3-coverage python3-filelock \ python3-pkg-resources python3-pycryptodome python3-pyelftools \ python3-pytest python3-pytest-xdist python3-sphinxcontrib.apidoc \ python3-sphinx-rtd-theme python3-subunit python3-testtools \ python3-virtualenv swig uuid-dev

SUSE based¶

On suse based systems the cross compiler packages are named cross—gcc.

You could install GCC and the GCC 10 cross compiler for the ARMv8 architecture with

sudo zypper install gcc cross-aarch64-gcc10

Depending on the build targets further packages maybe needed.

zypper install bc bison flex gcc libopenssl-devel libSDL2-devel make \ ncurses-devel python3-devel python3-pytest swig

Alpine Linux¶

For building U-Boot on Alpine Linux at least the following packages are needed:

apk add alpine-sdk bc bison dtc flex linux-headers ncurses-dev \ openssl-dev perl python3 py3-setuptools python3-dev sdl2-dev

Prerequisites¶

For some boards you have to build prerequisite files before you can build U-Boot, e.g. for the some boards you will need to build the ARM Trusted Firmware beforehand. Please, refer to the board specific documentation Board-specific doc .

Configuration¶

Directory configs/ contains the template configuration files for the maintained boards following the naming scheme:

These files have been stripped of default settings. So you cannot use them directly. Instead their name serves as a make target to generate the actual configuration file .config. For instance the configuration template for the Odroid C2 board is called odroid-c2_defconfig. The corresponding .config file is generated by

You can adjust the configuration using

Building¶

When cross compiling you will have to specify the prefix of the cross-compiler. You can either specify the value of the CROSS_COMPILE variable on the make command line or export it beforehand.

Читайте также:  Безопасность в fedora linux

Assuming cross compiling on Debian for ARMv8 this would be

CROSS_COMPILE=aarch64-linux-gnu- make

Build parameters¶

A list of available parameters for the make command can be obtained via

You can speed up compilation by parallelization using the -j parameter, e.g.

CROSS_COMPILE=aarch64-linux-gnu- make -j$(nproc) 

Further important build parameters are

Devicetree compiler¶

Boards that use CONFIG_OF_CONTROL (i.e. almost all of them) need the devicetree compiler (dtc). Those with CONFIG_PYLIBFDT need pylibfdt, a Python library for accessing devicetree data. Suitable versions of these are included in the U-Boot tree in scripts/dtc and built automatically as needed.

To use the system versions of these, use the DTC parameter, for example

In this case, dtc and pylibfdt are not built. The build checks that the version of dtc is new enough. It also makes sure that pylibfdt is present, if needed (see scripts_dtc in the Makefile).

Note that the Host tools are always built with the included version of libfdt so it is not possible to build U-Boot tools with a system libfdt, at present.

U-Boot supports link-time optimisation which can reduce the size of the final U-Boot binaries, particularly with SPL.

At present this can be enabled by ARM boards by adding CONFIG_LTO=y into the defconfig file. Other architectures are not supported. LTO is enabled by default for sandbox.

This does incur a link-time penalty of several seconds. For faster incremental builds during development, you can disable it by setting NO_LTO to 1 .

Other build targets¶

A list of all make targets can be obtained via

  • clean — remove most generated files but keep the configuration
  • mrproper — remove all generated files + config + various backup files

Installation¶

The process for installing U-Boot on the target device is device specific. Please, refer to the board specific documentation Board-specific doc .

© Copyright The U-Boot development community. Revision aa817dfc .

Источник

Lightweight GCC for Alpine

Is there a lightweight GCC distribution that I can install in Alpine? I am trying to make a small Docker image. For that reason, I am using Alpine as the base image (5MB). The standard GCC install dwarfs this in comparison (>100MB). So is there a lightweight GCC distribution that I can install on Alpine? Note: Clang is much worse (475MB last I checked).

What do you mean by «lightweight GCC distribution»? GCC is just a package (or some collection of them). And indeeds it takes several dozens of megabyte (on my Debian/Sid alone, its /usr/lib/gcc/x86_64-linux-gnu/8/cc1plus is 25 megabytes, and you need much more to compile C++ code).

1 Answer 1

There isn’t such an image available, AFAIK, but you can make GCC slimmer by deleting unneeded GCC binaries.

It very much depends on what capabilities are required from GCC.

As a starting point, I’m assuming you need C support only, which means the gcc and musl-dev packages (for standard headers) are installed, which result with a ~100MB image with Alpine 3.8.

  • If you don’t need Objective-C support, you could remove cc1obj , which is the Objective-C backend. On Alpine 3.8, it would be located at /usr/libexec/gcc/x86_64-alpine-linux-musl/6.4.0/cc1obj , and takes up 17.6MB.
  • If you don’t need link time optimization (LTO), you could remove the LTO wrapper and main executables, lto-wrapper and lto1 , which take up 700kb and 16.8MB respectively. While LTO optimization may be powerful, on most applications it’s likely to result with only minor speed and size improvements (few percents). Plus, you have to opt-in for LTO, which is not done by most applications, so it may be a good candidate for removal.
  • You could remove the Java front end, gcj , which doesn’t seem to be working anyways. It is located at /usr/bin/x86_64-alpine-linux-musl-gcj , and weights 812kb.
Читайте также:  High resolution display linux

By removing these, and squashing the resulting image, it would shrink into 64.4MB, which is still considerably large. You may be able to shrink further by removing additional files, but then you may loose some desired functionality and with a less appealing tradeoff.

Here’s an example Dockerfile:

FROM alpine:3.8 RUN set -ex && \ apk add --no-cache gcc musl-dev RUN set -ex && \ rm -f /usr/libexec/gcc/x86_64-alpine-linux-musl/6.4.0/cc1obj && \ rm -f /usr/libexec/gcc/x86_64-alpine-linux-musl/6.4.0/lto1 && \ rm -f /usr/libexec/gcc/x86_64-alpine-linux-musl/6.4.0/lto-wrapper && \ rm -f /usr/bin/x86_64-alpine-linux-musl-gcj 

Tested using: sudo docker image build —squash -t alpine-gcc-minimal .

Источник

Gcc Installation On A Debian, Ubuntu, Alpine, Arch, Kali, CentOS, Fedora, Raspbian And MacOS

Preprocesses and compiles C and C++ source files, then assembles and links them together.

Learn Laravel, React, VueJS and Python

read programming books

Install gcc

  • Debian apt-get install gcc Click to copy
  • Ubuntu apt-get install gcc Click to copy
  • Alpine OS apk add gcc Click to copy
  • Arch Linux pacman -S gcc Click to copy
  • Kali Linux apt-get install gcc Click to copy
  • CentOS yum install gcc Click to copy
  • Fedora dnf install gcc Click to copy
  • Raspbian apt-get install gcc Click to copy
  • macOS brew install gcc Click to copy

Preprocesses and compiles C and C++ source files, then assembles and links them together.

How to use gcc?

Below are few example commands for gcc that you can use in the terminal.

Compile multiple source files into executable:
gcc source1.c source2.c -o executable Click to copy Allow warnings, debug symbols in output:
gcc source.c -Wall -Og -o executable Click to copy Include libraries from a different path:
gcc source.c -o executable -Iheader_path -Llibrary_path -llibrary_name Click to copy Compile source code into Assembler instructions:
gcc -S source.c Click to copy Compile source code without linking:
gcc -c source.c Click to copy

To install the latest version of gcc in your favorite operating system just copy the gcc installation command from above and paste it into terminal. It will download and install the latest version of gcc 2023 package in your OS.

Источник

Оцените статью
Adblock
detector