I need to compile a c++ project with glibc 2.13 version. I found out that Ubuntu 11.10 has the verison of the glibc that i'm searching.
So i installed it in my virtual machine, and then i installed g++ compiler with:
sudo apt-get install g++
The problem is that g++ package updates also glib to the lastest version of glibc 2.19.
I tried also to compile the source of glibc2.13 but i get different errors in compiling, because for sure i need to use the same version of compiler used when it was been created.
I think that the fastest way is to use glibc 2.13, already installed on Ubuntu 11.10. So i need to find out a solution to install g++ without update glibc.
Simply, fetch a recent GCC 4.9 source tarball (and all the dependencies, perhaps using aptitude build-dep gcc or the contrib/download_prerequisites script inside GCC source tree) and compile it and install it from its source code (using your installed glibc-2.13...). You need to configure it (perhaps passing something like --program-suffix=-4.9-mine and possibly some --prefix) and build it outside of its source tree then install it. (then use g++-4.9-mine as your C++ compiler). Read and follow carefully the installation instructions
Running gcc -v will show you how your system GCC was configured.
BTW I am not sure that the version of glibc always matter that much (it really depends of a lot of factors). Did you try to compile your project (on whatever Linux system you have) and run it on a machine (perhaps a virtual one) with glibc 2.13? It might work (but I am not sure at all)!
You can obtain special version from Ubuntu toolchain ppa repo:
#cat /etc/apt/sources.list.d/ubuntu-toolchain-r-test-precise.list
deb http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu precise main
deb-src http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu precise main
Gcc 4.9
Pre build steps:
apt-get build-dep -y gcc-4.9-multilib
apt-get source -y gcc-4.9-multilib
dpkg-source -x gcc-4.9_4.9.2-0ubuntu1~12.04.dsc
cd gcc-4.9-4.9.2
customized parameters:
mkdir -p src && tar -xf gcc-*.tar.xz -C src
cd src && ./contrib/download_prerequisites && cd ..
mkdir -p /opt/dev-tools-4.9
../src/configure --prefix=//opt/dev-tools-4.9 \
-v --with-pkgversion='Ubuntu/Linaro 4.9.2-0ubuntu1~12.04' \
--program-suffix=-4.9 --enable-shared --enable-linker-build-id --with-system-zlib \
--libexecdir=//opt/dev-tools-4.9/lib --without-included-gettext \
--enable-threads=posix --with-gxx-include-dir=//opt/dev-tools-4.9/include/c++/4.9 \
--libdir=//opt/dev-tools-4.9/lib --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes \
--enable-gnu-unique-object --enable-plugin --enable-objc-gc --disable-werror \
--with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64 --with-tune=generic \
--enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-sysroot=/ --enable-nls
make -j $(grep -c ^processor /proc/cpuinfo ) && make install
Also you should rebuild the binutils:
binutils 2.22
apt-get build-dep -y binutils-dev
apt-get source -y binutils-dev
dpkg-source -x binutils_2.22-6ubuntu1.3.dsc
mkdir objdir&& cd objdir
../binutils-2.22/configure --prefix=/opt/rdwr_tools/radware-dev-tools-4.9 \
--exec-prefix=/opt/rdwr_tools/radware-dev-tools-4.9 \
--with-sysroot=/ --enable-multilib \
--with-lib-path=/opt/rdwr_tools/radware-dev-tools-4.9/lib \
--disable-werror --enable-shared \
--enable-targets=x86_64-linux-gnu,i686-linux-gnu,x86_64-pc-mingw32,i686-pc-mingw32
make -j 8 && make install
Related
I am trying to compile FFmpeg with SVT-AV1 codec, following instructions from here: https://github.com/OpenVisualCloud/SVT-AV1/tree/master/ffmpeg_plugin
Everything goes well, but when I try to run
./configure --enable-libsvtav1
I am getting
ERROR: SvtAv1Enc not found using pkg-config
If you think configure made a mistake, make sure you are using the latest
version from Git. If the latest version fails, report the problem to the
ffmpeg-user#ffmpeg.org mailing list or IRC #ffmpeg on irc.freenode.net.
Include the log file "ffbuild/config.log" produced by configure as this will help
solve the problem.
The content of the ffbuild/config.log: https://pastebin.com/euPriFAp
There is an exact issue on the github: https://github.com/OpenVisualCloud/SVT-AV1/issues/35, but is closed as solved.
I have tried both on my Mac and in the Docker container with Ubuntu 18.04, but getting the same result.
Could anyone please help, what am I doing wrong?
The problem was in the lack of requred libraries. Please find the complete installation instruction below.
Installing packages required for compiling:
sudo apt-get update
sudo apt-get install \
autoconf \
automake \
build-essential \
cmake \
git-core \
libass-dev \
libfreetype6-dev \
libsdl2-dev \
libtool \
libva-dev \
libvdpau-dev \
libvorbis-dev \
libxcb1-dev \
libxcb-shm0-dev \
libxcb-xfixes0-dev \
pkg-config \
texinfo \
wget \
zlib1g-dev
Installing assemblers used by some libraries:
sudo apt-get install nasm
sudo apt-get install yasm
Build and install SVT-AV1:
git clone --depth=1 https://github.com/OpenVisualCloud/SVT-AV1
cd SVT-AV1
cd Build
cmake .. -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=Release
make -j $(nproc)
sudo make install
Apply SVT-AV1 plugin and enable libsvtav1 to FFmpeg:
cd ~
git clone -b release/4.2 --depth=1 https://github.com/FFmpeg/FFmpeg ffmpeg
cd ffmpeg
export LD_LIBRARY_PATH+=":/usr/local/lib"
export PKG_CONFIG_PATH+=":/usr/local/lib/pkgconfig"
git apply ../SVT-AV1/ffmpeg_plugin/0001-Add-ability-for-ffmpeg-to-run-svt-av1.patch
./configure --enable-libsvtav1
(Note: if you want other codecs to be supported please add the required flags to the ./configure command)
Build FFmpeg:
make
make install
hash -r
source ~/.profile
Now you should have ffmpeg command working and have svt-av1 in encoders list:
ffmpeg -encoders
...
V..... libsvt_av1 SVT-AV1(Scalable Video Technology for AV1) encoder (codec av1)
...
I used next docs a reference:
https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu
https://github.com/OpenVisualCloud/SVT-AV1/tree/master/ffmpeg_plugin
Recently my experiment needs to implement CVE-2017-7494 (the so called sambacry), and I am trying to rebuild the vulnerable environment
I am new to this, not very sure how to set all the path and conf right
here is what I did:
# wget https://download.samba.org/pub/samba/stable/samba-4.5.9.tar.gz
# apt-get install acl attr autoconf bison build-essential \
debhelper dnsutils docbook-xml docbook-xsl flex gdb krb5-user \
libacl1-dev libaio-dev libattr1-dev libblkid-dev libbsd-dev \
libcap-dev libcups2-dev libgnutls-dev libjson-perl \
libldap2-dev libncurses5-dev libpam0g-dev libparse-yapp-perl \
libpopt-dev libreadline-dev perl perl-modules pkg-config \
python-all-dev python-dev python-dnspython python-crypto \
xsltproc zlib1g-dev
Reference about the above package.
# tar -xvf samba-4.5.9.tar.gz
# cd samba-4.5.9
# ./configure
# make
# make install
after that I found it installed under /local, and cannot start samba normally because, say, smbd not found, etc
I think it's a problem of path and config file then I tried this to fix it.
But didn't get well realizing.
Would anyone please help?
Since you did not specify a path in your configure parameters, it should be by default at /usr/local/samba/sbin/smbd.
You can try running this in your shell (and add it to your profile) to add it to your path:
export PATH=/usr/local/samba/bin/:/usr/local/samba/sbin/:$PATH
I'm trying to build the latest version of glibc (2.22). I've not modified any sources of glibc. On my x86_64 Ubuntu 14.04.1 machine I'm using the following extract of a makefile to build:
HOST ?= x86_64-linux-gnu
TARGET ?= x86_64-linux-gnu
CROSS_OUT = $(shell pwd)/$(TARGET)
CC ?= gcc
CXX ?= g++
LD ?= ld
[...]
CFLAGS ?= "-I$(CROSS_OUT)/include -L$(CROSS_OUT)/lib"
CXXFLAGS ?= "-I$(CROSS_OUT)/include -L$(CROSS_OUT)/lib"
CPPFLAGS ?= "-I$(CROSS_OUT)/include -L$(CROSS_OUT)/lib"
LDFLAGS ?= "-I$(CROSS_OUT)/include -L$(CROSS_OUT)/lib"
[...]
GLIBC_PATH=$(shell pwd)/glibc
GLIBC_BUILD_PATH=$(shell pwd)/glibc-build
glibc: glibc-clean
mkdir -p $(GLIBC_BUILD_PATH)
cd $(GLIBC_BUILD_PATH) && \
CC=$(CC) \
CXX=$(CXX) \
LD=$(LD) \
CFLAGS=$(CFLAGS) \
CXXFLAGS=$(CXXFLAGS) \
CPPFLAGS=$(CPPFLAGS) \
LDFLAGS=$(LDFLAGS) \
$(GLIBC_PATH)/configure \
--host=$(TARGET) \
--build=$(HOST) \
--prefix=$(CROSS_OUT) \
--disable-shared \
--enable-add-ons \
--enable-static-nss && \
make && \
make install
glibc-clean:
rm -r -f $(GLIBC_BUILD_PATH)
Make stops nearly immediatly with the following error:
In file included from <command-line>:0:0:
../include/stdc-predef.h:64:1: fatal error: /home/leon/reaper/glibc-build/libc-modules.h: No such file or directory
#endif
^
compilation terminated.
Unfortunately, the file definitely doesn't exist.
In met the same error when I used --disable-shared option for configure.
When I removed the option, the build passed correctly.
I also use -fno-stack-protector -U_FORTIFY_SOURCE in CFLAGS according to glibc FAQ (my OS is Debian).
Also this topic was helpful to set up environment:
https://lists.debian.org/debian-user/2015/07/msg00120.html
This is my script for build glibc:
#!/bin/bash
# sudo aptitude install linux-headers-$(uname -r)
# sudo aptitude install build-essentials
# sudo aptitude install gawk
export CFLAGS="-fPIC -O2 -fno-stack-protector -U_FORTIFY_SOURCE"
mkdir glibc-build
cd glibc-build
../glibc-2.23/configure --disable-werror --prefix=/home/alexey/projects/work/build-dir/glibc-prefix
make
Try installing these:
$ sudo apt-get install build-essential
$ sudo apt-get install libc6
And link from where you got that source code please.
If you want to build an alien libc6 / an extra libc6, the build of glibc-2.22 is described here http://www.linuxfromscratch.org/lfs/view/stable/chapter05/glibc.html
Ref. http://www.linuxfromscratch.org/lfs/view/stable/
Suggest : --prefix=/opt/glibc222
The header 'libc-modules.h' is a generated header. Appears when configuring is done the right way.
glibc222
I'm trying to build it myself since the version in debian apt-get is too old for a plugin I need, and this plugin needs lua.
I did apt-get install libtolua-dev
And am runnning the command
./configure --with-features=huge \
--enable-rubyinterp \
--enable-pythoninterp \
--with-python-config-dir=/usr/lib/python2.7/config \
--enable-perlinterp \
--enable-gui=gtk2 --enable-cscope --prefix=/usr \
--enable-luainterp \
When I run this command, at some point the program will say checking Lua version... (cached) 5.0.3 when I actually have version 5.2 installed. When I run the configure I get:
checking for lua... (cached) /usr/bin/lua
checking if lua.h can be found in /usr/include... no
checking if lua.h can be found in /usr/include/lua5.0.3... no
So I tried to copy all the files from /usr/include/lua5.2 to a new directory /usr/include/lua5.0.3
Then I'll get
checking if lua.h can be found in /usr/include... no
checking if lua.h can be found in /usr/include/lua5.0.3... yes
checking if link with -L/usr/lib -llua5.0.3 is sane... no
I don't understand how to make it use lua 5.2.
For those who are interested by a manner that worked for me to build vim with lua support and a solid basis to setup spf13 with full Neocomplete support here are the steps followed to do it:
Download the vim sources from git:
git clone https://github.com/vim/vim.git
Setup dependancies (on ArchLinux, adapt according to your distribution):
pacman -Suy ruby perl python2 python lua luajit
Link luajit headers for the compilation:
cd /usr/local/include
sudo ln -sv /usr/include/luajit-2.0/lua.h
sudo ln -sv /usr/include/luajit-2.0/luaconf.h
sudo ln -sv /usr/include/luajit-2.0/lualib.h
sudo ln -sv /usr/include/luajit-2.0/lauxlib.h
Run the following commands to build vim (include lua support as desired):
./configure --with-features=huge --enable-multibyte --enable-rubyinterp --enable-pythoninterp --with-python-config-dir=/usr/lib/python2.7/config --enable-gui=no --without-x enable-cscope --enable-multibyte --enable-fontset --enable-largefile --enable-cscope --enable-perlinterp --enable-luainterp --enable-fail-if-missing --with-lua-prefix=/usr/local/ --with-luajit --prefix=/usr
Compile:
make VIMRUNTIMEDIR=/usr/share/vim/vim80
Install Vim:
sudo make install
Use vim --version command to verify lua support (+lua):
vim --version
And that's it!
You need to include the --with-lua-prefix=<dir> flag when running configure. This flag tells the configure script where lua is installed. (You could also set the LUA_PREFIX environment variable if you do not pass the flag).
I would also recommend running configure with --enable-fail-if-missing so that the configure script will fail instead of quietly warning that it didn't find a lua config directory or executable.
This is what I did:
# Install lua
curl -R -O http://www.lua.org/ftp/lua-5.2.2.tar.gz
tar zxf lua-5.2.2.tar.gz
cd lua-5.2.2
sudo make linux install
# build vim
sudo apt-get install libncurses5-dev libgnome2-dev libgnomeui-dev \
libgtk2.0-dev libatk1.0-dev libbonoboui2-dev \
libcairo2-dev libx11-dev libxpm-dev libxt-dev python-dev ruby-dev mercurial
sudo apt-get remove vim vim-runtime gvim
sudo apt-get remove vim-tiny vim-common vim-gui-common
cd ~
hg clone https://code.google.com/p/vim/
cd vim
./configure --with-features=huge \
--enable-rubyinterp \
--enable-pythoninterp \
--with-python-config-dir=/usr/lib/python2.7-config \
--enable-perlinterp \
--enable-gui=gtk2 --enable-cscope --prefix=/usr \
--enable-luainterp \
--with-lua-prefix=/usr/local/bin/lua
make VIMRUNTIMEDIR=/usr/share/vim/vim74
sudo make install
But the ./configure step returns:
checking --enable-luainterp argument... yes
checking --with-lua-prefix argument... /usr/local/bin/lua
checking --with-luajit... no
checking for lua... (cached) /usr/local/bin/lua
checking Lua version... (cached) 5.2
checking if lua.h can be found in /usr/local/bin/lua/include... no
checking if lua.h can be found in /usr/local/bin/lua/include/lua5.2... no
I can verify that lua.h can't be found in those locations, but I don't know where it can be found.
Edit
I tried this again, ran into problems, and discovered a package vim-nox that already has vim support.
Original answer
I'm not entirely sure how I did this in the end, but thanks to #wrikken for the tip about headers.
# Install lua from binaries (these are out-of-date but at least they worked).
sudo apt-get install lua50 liblua50-dev liblualib50-dev
# Remove old vims
sudo apt-get remove vim vim-runtime gvim
sudo apt-get remove vim-tiny vim-common vim-gui-common
# Download and build a new vim
sudo apt-get install libncurses5-dev libgnome2-dev libgnomeui-dev \
libgtk2.0-dev libatk1.0-dev libbonoboui2-dev \
libcairo2-dev libx11-dev libxpm-dev libxt-dev python-dev ruby-dev mercurial
cd ~
hg clone https://code.google.com/p/vim/
cd vim
cd ~/vim
./configure --with-features=huge \
--enable-rubyinterp \
--enable-pythoninterp \
--with-python-config-dir=/usr/lib/python2.7-config \
--enable-perlinterp \
--enable-gui=gtk2 --enable-cscope --prefix=/usr \
--enable-luainterp \
--with-lua-prefix=/usr/local
At this point, check the output of ./configure to see that it found lua.h. If not, find out where it is (I'm afraid I can't remember where it was). Symlink to it in /usr/local with e.g. sudo ln -s ../lua.h and rerun ./configure.
Finally:
sudo make VIMRUNTIMEDIR=/usr/share/vim/vim74
sudo make install
If it still won't work, post on a forum somewhere and go for a walk in the outdoors. You'll find it suddenly starts to behave.
What worked for me:
sudo apt-get install liblua5.1-dev
copy all files from /usr/include/lua5.1/ to /usr/include/lua5.1/include/
sudo ln -s /usr/lib/x86_64-linux-gnu/liblua5.1.so /usr/local/lib/liblua.so
Go to the vim source folder
cd src
make distclean
clear
./configure --with-features=huge --enable-cscope --enable-pythoninterp=yes --with-python-config-dir=/usr/lib/python2.7/config-x86_64-linux-gnu --enable-multibyte --enable-fontset --enable-gui=gnome2 --disable-netbeans --enable-luainterp=yes --with-lua-prefix=/usr/include/lua5.1 --enable-largefile --enable-rubyinterp
sudo make
sudo make install
This will also install the GUI version, remove the --enable-gui=gnome2 if you will only use it in the command line.
Most of these I found it in here