Compiling vim with xterm_clipboard on CentOS 6.6 - vim

I have a minimal-install CentOS 6.6, with Desktop added afterwards. I'd like to compile the latest vim with xterm_clipboard.
I did the following
Installed *-devel packages
yum install ruby perl-devel python-devel ruby-devel \
perl-ExtUtils-Embed ncurses-devel libX11 libX11-devel \
libXtst-devel libXtst libXt-devel libXt libSM-devel libSM \
libXpm libXpm-devel
That didn't work.
Next I tried using groupinstall
yum groupinstall "Desktop" "Desktop Platform" "X Window System" \
"Fonts" "General Purpose Desktop"
No luck either.
After each of the above steps, I did
make clean
./configure --with-features=huge --enable-perlinterp \
--enable-rubyinterp --enable-pythoninterp --with-x=yes \
--enable-gui=auto
and then
grep X11 src/auto/config.h
But everytime I see
/* #undef HAVE_X11 */
Forcing a sudo make install, and then vim --version confirms that I don't have xterm_clipboard (the output shows -xterm_clipboard).
Could you all please help me?
Thank you!

The solution of my issue is
make distclean
./configure ...
I only did make clean after installing the groups, and various packages. It is not "clean" enough, the config-files are not completely restored to the initial state.
I hope this helps others with the same issue.

Related

ERROR: SvtAv1Enc not found using pkg-config

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

implement CVE-2017-7494 (samba cry) on ubuntu server 16.04

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

Ubuntu 16.04 LTS - Can't enable xterm_clipboard in VIM

I use VIM a lot, and have previously been able to get +xterm_clipboard support working by using a script provided in a separate post on StackOverflow. I've re-installed Ubuntu on my machine, and have since migrated from Ubuntu 14.04.4 LTS (Wily) to Ubuntu 16.04 LTS (Xenial).
# Get the compile-dependencies of vim
sudo apt-get build-dep vim
# If you haven't got mercurial, get it
sudo apt-get install mercurial
# Get the source
hg clone https://vim.googlecode.com/hg/ vim_source
# Compile it
cd vim_source
./configure \
--enable-perlinterp=dynamic \
--enable-pythoninterp=dynamic \
--enable-rubyinterp=dynamic \
--enable-cscope \
--enable-gui=auto \
--enable-gtk2-check \
--enable-gnome-check \
--with-features=huge \
--with-x \
--with-compiledby="Your Name <youremail#domain.com>" \
--with-python-config-dir=/usr/lib/python2.7/config
make && sudo make install
However, this no longer works, and I can't make use of ",+,y to yank buffers to the system clipboard. I don't see anything obvious in the .configure output, but vim --version always shows -xterm_clipboard when I build it. How do I fix this?
You should have noticed that the source is no longer hosted on Google code via mercurial (hg) anymore, and has migrated to GitHub in the error messages generated by the provided script.
You'll need to use the new source tree, git, and some developer libraries will need to be installed in advance.
Code Listing (Updated for Ubuntu 18.04 and onward)
# Get the compile-dependencies of vim
sudo apt-get -y build-dep vim
# Install the "checkinstall" tool so the "make install" step is
# wrapped and the result is a .deb file that can be removed later by
# your package manager rather than having to hunt down every file deployed
# by "make install", which might not be possible if it overwrites existing
# system files.
sudo apt-get -y install checkinstall
# Install python dev
sudo apt-get -y install python3-dev
# Install xorg dev
sudo apt-get -y install xorg-dev
# Install git
sudo apt-get -y install git
# Get the source
git clone https://github.com/vim/vim.git vim_source
# Remove ./configure cache in case we have to run this twice due to permissions
# related issues.
rm vim_source/src/auto/config.cache
# Compile it
cd vim_source
make clean distclean
./configure \
--enable-perlinterp=yes \
--enable-python3interp=yes \
--enable-rubyinterp=yes \
--with-python3-command=python3.6 \
--with-python3-config-dir=$(python3.6-config --configdir) \
--enable-cscope \
--enable-gui=auto \
--enable-gtk2-check \
--enable-gnome-check \
--with-features=huge \
--with-x \
--with-compiledby="DevNull <darkstar#/dev/null>"
# Build quickly (parallel jobs).
make -j$(nproc)
# Need root to install
sudo checkinstall

How can I fix this error when making vim on Fedora 23

I am trying to build vim with the following options on my Fedora 23
I want +python +python3 +perl +lua +ruby +gui +conceal +gui for some plugins.
I could not find a version with all those built in (so I do it myself)
The journey started by following Valloric
sudo yum install -y ruby ruby-devel lua lua-devel luajit \
luajit-devel ctags git python python-devel \
python3 python3-devel tcl-devel \
perl perl-devel perl-ExtUtils-ParseXS \
perl-ExtUtils-XSpp perl-ExtUtils-CBuilder \
perl-ExtUtils-Embed
I also have ncurses (raw,devel,static,...)
Then
$ cd $HOME/Sources
$ git clone https://github.com/vim/vim.git
$ cd vim
$ ./configure --with-tlib=ncurses \
--with-features=huge \
--enable-fail-if-missing \
--enable-luainterp=yes \
--enable-mzschemeinterp \
--enable-perlinterp \
--enable-pythoninterp=yes \
--with-python-config-dir=/usr/lib64/python2.7/config \
--enable-python3interp=yes \
--enable-tclinterp=yes \
--enable-rubyinterp=yes \
--enable-cscope \
--enable-multibyte \
--enable-gui=auto \
--prefix=$HOME/Build/vim \
--with-compiledby=statquant | tee configure.log
The following is printed on screen:
/home/statquant/Sources/vim/src/config-PyMake3137:1478: warning: overriding recipe for target 'Modules/_math.o'
/home/statquant/Sources/vim/src/config-PyMake3137:1475: warning: ignoring old recipe for target 'Modules/_math.o'
/home/statquant/Sources/vim/src/config-PyMake3137:1517: warning: overriding recipe for target 'Modules/timemodule.o'
/home/statquant/Sources/vim/src/config-PyMake3137:1482: warning: ignoring old recipe for target 'Modules/timemodule.o'
configure: error: NOT FOUND!
You need to install a terminal library; for example ncurses.
Or specify the name of the library with --with-tlib.
Then I
make | tee make.log
I realized that it actually built vim in $HOME/Sources/vim/src instead of $HOME/Build/vim (maybe I was wrong to expect that)
When I run :version on ./vim -g (vim has been build with GUI support) there is
NO python NO python3 ....
configure.log is there, make.log is there
EDIT1: the following works, I now only miss +perl +ruby
./configure --with-features=huge \
--enable-tclinterp=yes \
--enable-luainterp=yes \
--enable-pythoninterp=yes \
--enable-python3interp=yes \
--with-compiledby=statquant \
--prefix=$HOME/Build/vim \
make install # and yes it installs in $HOME/Build/vim
EDIT2
Here is what happen when I try to add
+perl
I can run
./configure --with-features=huge \
--enable-tclinterp=yes \
--enable-luainterp=yes \
--enable-pythoninterp=yes \
--enable-python3interp=yes \
--enable-perlinterp=yes \
--prefix=$HOME/Build/vim \
--with-compiledby=statquant | tee configure.log
It appears to work (no error) : configure.log
make | tee make.log
[...]
cc1: error: -Wformat-security ignored without -Wformat [-Werror=format-security]
<command-line>:0:0: warning: "_FORTIFY_SOURCE" redefined
<command-line>:0:0: note: this is the location of the previous definition
cc1: some warnings being treated as errors
make[1]: *** [objects/option.o] Error 1
Makefile:2907: recipe for target 'objects/option.o' failed
make[1]: Leaving directory '/home/statquant/Sources/vim/src'
make: *** [first] Error 2
Makefile:26: recipe for target 'first' failed
I get no vim built in /home/statquant/Sources/vim/src : make.log
+ruby
./configure --with-features=huge \
--enable-tclinterp=yes \
--enable-luainterp=yes \
--enable-pythoninterp=yes \
--enable-python3interp=yes \
--enable-rubyinterp=yes \
--prefix=$HOME/Build/vim \
--with-compiledby=statquant | tee configure.log
It does not even run configure
checking --with-tlib argument... empty: automatic terminal library selection
checking for tgetent in -ltinfo... no
checking for tgetent in -lncurses... no
checking for tgetent in -ltermlib... no
checking for tgetent in -ltermcap... no
checking for tgetent in -lcurses... no
no terminal library found
checking for tgetent()... configure: error: NOT FOUND!
You need to install a terminal library; for example ncurses.
Or specify the name of the library with --with-tlib.
Here is the log: configure.log
Ok... so here's the thing. VIM is one of those programs that has a huge amount of patches, Fedora enforces some security checks at GCC level that won't allow you to build it (easily) from source code, my advice: rebuild the source rpm, is not that hard:
Install required dependencies to rebuild VIM
These packages are required for you to build VIM within F23
sudo dnf install gtk2-devel ncurses-devel lua-devel perl-devel perl-ExtUtils-Embed perl-ExtUtils-ParseXS perl-ExtUtils-XSpp perl-ExtUtils-CBuilder python-devel python3-devel tcl-devel ruby-devel
Install racket repository
I see you are passing the --enable-mzschemeinterp flag which requires racket, which is not included on the official repos.
cat >/etc/yum.repos.d/rpm-sphere.repo <<EOF
[rpm-sphere]
name=RPM Sphere
baseurl=http://download.opensuse.org/repositories/home:/zhonghuaren/Fedora_23/
gpgkey=http://download.opensuse.org/repositories/home:/zhonghuaren/Fedora_23/repodata/repomd.xml.key
enabled=1
gpgcheck=1
EOF
Install RPM developer tools:
These are required to install the tools to build/rebuild rpms
sudo dnf install #development-tools
sudo dnf install fedora-packager
sudo dnf install rpmdevtools
Setup your RPM build root
Create a file on your home folder called rpmmacros like so:
vim ~/.rpmmacros
Add the following contents to it:
%_topdir /home/statquant/Src/rpm
Then create the folder /home/statquant/Src/rpm
Create RPM build necessary folders
You need to have these folders so the source code and spec files are stored when you install the source rpm:
mkdir -p ~/Src/rpm
cd ~/Src/rpm
mkdir BUILD RPMS SOURCES SPECS SRPMS
mkdir RPMS/{noarch,x86,x86_64}
Download VIM source RPM:
dnf dnl --source vim
This will download the source rpm to the current folder, say vim-7.4.1718-1.fc23.src.rpm
Once it has been downloaded, install it:
rpm -ivh vim-7.4.1718-1.fc23.src.rpm
Once installed the RPM should have created the file /home/statquant/Src/rpm/SPECS/vim.spec open this file.
Modify configure options
You'll see that the SPEC file has the configure options and the make commands to build the actual thing. This file is huge and it has a lot of patches. You can go ahead and modify the areas where the configure command is, there are 3:
One for vim minimal
One for vim enhanced
One for the GUI version of vim
Make sure you modify accordingly. I did a test build with your options. You can download my SPEC file here, and vim, vim-enhanced and gvim worked just fine.
Rebuild the RPM
Once you modified (or copied from my template) the spec file you want to build the RPM based of that spec, go to /home/statquant/Src/rpm and then:
rpmbuild -ba SPECS/vim.spec
It will take a while, after that, you should see some ouput saying that the packages were built successfully, in my case:
Checking for unpackaged file(s): /usr/lib/rpm/check-files /home/gustavo/Src/rpm/BUILDROOT/vim-7.4.1718-1.fc23.x86_64
Wrote: /home/gustavo/Src/rpm/SRPMS/vim-7.4.1718-1.fc23.src.rpm
Wrote: /home/gustavo/Src/rpm/RPMS/x86_64/vim-common-7.4.1718-1.fc23.x86_64.rpm
Wrote: /home/gustavo/Src/rpm/RPMS/x86_64/vim-minimal-7.4.1718-1.fc23.x86_64.rpm
Wrote: /home/gustavo/Src/rpm/RPMS/x86_64/vim-enhanced-7.4.1718-1.fc23.x86_64.rpm
Wrote: /home/gustavo/Src/rpm/RPMS/x86_64/vim-filesystem-7.4.1718-1.fc23.x86_64.rpm
Wrote: /home/gustavo/Src/rpm/RPMS/x86_64/vim-X11-7.4.1718-1.fc23.x86_64.rpm
Wrote: /home/gustavo/Src/rpm/RPMS/x86_64/vim-debuginfo-7.4.1718-1.fc23.x86_64.rpm
Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.tNsBuH
+ umask 022
+ cd /home/gustavo/Src/rpm/BUILD
+ cd vim74
+ rm -rf /home/gustavo/Src/rpm/BUILDROOT/vim-7.4.1718-1.fc23.x86_64
+ exit 0
Install the new version
So now you have the packages built following fedora recommendations and patches, you can just go ahead and reinstall them (in case you already have the default fedora vim version which is probably true) like so:
cd /home/statquant/Src/rpm/RPMS/x86_64/
sudo dnf reinstall ./vim-common-7.4.1718-1.fc23.x86_64.rpm
sudo dnf reinstall ./vim-enhanced-7.4.1718-1.fc23.x86_64.rpm
etc...
Please note the dot and slash meaning that dnf is trying to install a local package instead of searching through its database which would download the versions you already have.
Notes
Out of security concern I did not uploaded my custom-built packages but if you don't mind or want to try them out ping me and I can upload them so you save yourself all this hassle... I already had all RPM build tools because I build some for me here.
You may also want to create a COPR repository so that you automate this process and if you need to format your disk, reinstall fedora, install it on a new machine etc. you can just add the repository and use dnf to install your custom package.
If you have any other questions let me know, good luck!
Update there are comments in the spec file beginning with # options for so you can jump to the actual configure options
You have enabled -Werror=format-security. This treats any susceptible usage of format of printf or scanf currently treated as `error.
You can either fix the usage in if_perl.c, I believe this is generated file. or remove the flag -Werror=format-security
The python problem was this...
--with-python-config-dir=/usr/lib64/python2.7/config \
--enable-python3interp=yes \
Version 2 config with a version 3 interpreter.
Your missing the ncurses-devel library, I can see that you dropped it from configure.
sudo yum install ncurses-devel
configure actually worked for me even when I didn't have the perl dev packages installed ie it didn't fail asking me to install them which I found odd. Do you have all the dev packages you need installed.
sudo yum install perl-devel
sudo yum install ruby-devel
If you are missing some dev package for ruby or perl the configure script say something like : "disabling this option". Just did this with ruby. After installing the ruby-dev package the ruby option is enabled in vim. Same with libperl-dev.
There is now a Vim issue filed about this:
https://github.com/vim/vim/issues/1081
I'm using a work-around that I mentioned in a comment to that issue:
https://github.com/vim/vim/issues/1081#issuecomment-269920486
I've copied most of that comment below in case it may be helpful.
I ran into this problem on Fedora 25 (x86_64). Vim's configure script asks ruby about LDFLAGS without a corresponding query regarding CFLAGS:
https://github.com/vim/vim/blob/v8.0.0134/src/auto/configure#L7174
rubyldflags=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig::CONFIG['LDFLAGS']"`
Since Fedora 23, all RPMs have been "hardened" by default:
https://fedoraproject.org/wiki/Changes/Harden_All_Packages
When an RPM is built, the %configure macro used in the RPM SPEC file is automatically adjusted to provide CFLAGS, LDFLAGS, and several other environment variables using hardened settings. When using Fedora's ruby package, the above query using rbconfig returns hardened linker flags. Because Vim's configure script doesn't use a corresponding rbconfig to query ruby's CFLAGS, the compiling and linking flags are mismatched, leading to the error:
configure: error: NOT FOUND!
You need to install a terminal library; for example ncurses.
Or specify the name of the library with --with-tlib.
In src/auto/config.log, this mismatch of flags causes this error:
configure:11318: checking for tgetent in -lncurses
configure:11343: gcc -o conftest -g -O2 -L. -Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,--enable-new-dtags -Wl,-z,relro -L/usr/local/lib conftest.c -lncurses -lselinux >&5
/usr/bin/ld: /tmp/cckpDslF.o: relocation R_X86_64_PC32 against undefined symbol `tgetent' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
I can successfully build with a work-around, but I don't know enough about autoconf to suggest a proper fix to the configure script. The work-around involves first installing some RPM-related packages:
sudo dnf install -y rpm-build redhat-rpm-config
Next, set these variables at the shell prompt via:
eval $(rpmbuild --eval '%{configure}' | egrep '^\s*[A-Z]+=')
The above uses rpmbuild --eval '%{configure}' to query the definition of the %configure macro which begins with a number of environment variable assignments. This provides the same default compilation environment that is provided in the %configure macro. Now running the below invocation succeeds:
./configure --quiet --with-features=huge --enable-rubyinterp

"pkg-config script could not be found" on OSX

I am trying to install some software on my mac; however I keep receiving the same error:
configure: error: The pkg-config script could not be found or is too old. Make sure it
is in your PATH or set the PKG_CONFIG environment variable to the full
path to pkg-config.
Alternatively, you may set the environment variables XMEDCON_GLIB_CFLAGS
and XMEDCON_GLIB_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
To get pkg-config, see <http://pkg-config.freedesktop.org/>.
See `config.log' for more details
I am not quite sure how to go about adding the pkg-config to the PATH. I have seen online (see link) that I should add the following:
Link showing how to direct PATH variable
export PATH=$PATH:/opt/local/bin # Fixed typo as mentioned in comment
which is where I have placed pkg-config. I still keep getting the error though every time I try to configure the files using ./configure. Any help would be super appreciated!
For Ubuntu/Debian OS,
apt-get install -y pkg-config
For Redhat/Yum OS,
yum install -y pkgconfig
For Archlinux OS,
pacman -S pkgconf
for me, (OSX) the problem was solved doing this:
brew install pkg-config
Answer to my question (after several Google searches) revealed the following:
$ curl https://pkgconfig.freedesktop.org/releases/pkg-config-0.29.tar.gz -o pkgconfig.tgz
$ tar -zxf pkgconfig.tgz && cd pkg-config-0.29
$ ./configure && make install
from the following link: Link showing above
Thanks to everyone for their comments, and sorry for my linux/OSX ignorance!
Doing this fixed my issues as mentioned above.
if you have this error :
configure: error: Either a previously installed pkg-config or "glib-2.0 >= 2.16" could not be found. Please set GLIB_CFLAGS and GLIB_LIBS to the correct values or pass --with-internal-glib to configure to use the bundled copy.
Instead of do this command :
$ ./configure && make install
Do that :
./configure --with-internal-glib && make install
Try
which pkg-config
if it is empty then fire
brew install pkg-config
OR : ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null 2> /dev/null
MacOS users
Unfortunately, pkg-config does not come with OS X by default. Here are some notes on how to compile from source. It assumes that you have Xcode installed.
Download and extract
curl -O http://pkgconfig.freedesktop.org/releases/pkg-config-0.28.tar.gz
tar xfz pkg-config-0.28.tar.gz
Configure and Install
cd pkg-config-0.28
setenv CC /usr/bin/cc (for tcsh)
export CC=/usr/bin/cc (for bash)
2a) If you have super-user powers
./configure --prefix=/usr/local CC=$CC --with-internal-glib
make
sudo make install
2b) if not
./configure --prefix=$HOME/someplace/in/my/path CC=$CC --with-internal-glib
make
make install
Source: https://opensource.ncsa.illinois.edu/confluence/display/DESDM/Installing+pkg-config+from+source+for+OSX

Resources