This is not a duplicate of ncurses not found when trying to build vim. ncurses not found when trying to build vim shows how to solve a problem, while I'm asking why it is a problem.
I want to build vim from source. Used a following command line to do it:
./configure --with-features=huge \
--enable-multibyte \
--enable-rubyinterp=yes \
--enable-pythoninterp=yes \
--with-python-config-dir=/usr/lib64/python2.7/config \
--enable-python3interp=yes \
--with-python3-config-dir=/usr/lib64/python3.6/config-3.6m-x86_64-linux-gnu \
--enable-perlinterp=yes \
--enable-luainterp=yes \
--enable-cscope \
--prefix=/usr/local
Got the follow error:
checking --with-tlib argument... empty: automatic terminal library selection
checking for tgetent in -ltinfo... yes
tinfo library is not usable
checking for tgetent in -lncurses... yes
ncurses library is not usable
checking for tgetent in -ltermlib... no
checking for tgetent in -ltermcap... yes
termcap library is not usable
checking for tgetent in -lcurses... yes
curses library is not usable
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.
I do have curses library installed
Here is what find /usr -type f -name "libncurses*" revealed
/usr/lib/libncursesw.so.6.1
/usr/lib/libncurses.so.6.1
/usr/lib64/libncurses++w.so.5.9
/usr/lib64/libncurses++w.so.6.1
/usr/lib64/libncursesw.so.5.9
/usr/lib64/libncurses++.so.5.9
/usr/lib64/libncursesw.so.6.1
/usr/lib64/libncurses.so
/usr/lib64/vlc/plugins/gui/libncurses_plugin.so
/usr/lib64/libncurses.so.6.1
/usr/lib64/libncurses.so.5.9
/usr/lib64/libncursesw.so
/usr/lib64/libncurses++.so.6.1
After several hours of googling I tried the following approach
CFLAGS+=-fPIC ./configure --with-features=huge \
--enable-multibyte \
--enable-rubyinterp=yes \
--enable-pythoninterp=yes \
--with-python-config-dir=/usr/lib64/python2.7/config \
--enable-python3interp=yes \
--with-python3-config-dir=/usr/lib64/python3.6/config-3.6m-x86_64-linux-gnu \
--enable-perlinterp=yes \
--enable-luainterp=yes \
--enable-cscope \
--prefix=/usr/local
i.e. I simply added a CFLAGS+=-fPIC. I know what the flag does. However I fail to see a connection between this flag and my ncurses library being unusable.
So my questions are:
What makes my ncurses library unusable?
Why using -fPIC works?
My system:
$ uname -a
Linux user-fedora-PC0PVGAT 4.18.16-200.fc28.x86_64 #1 SMP Sat Oct 20 23:53:47 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
$ cat /etc/os-release
NAME=Fedora
VERSION="28 (Workstation Edition)"
ID=fedora
VERSION_ID=28
PLATFORM_ID="platform:f28"
PRETTY_NAME="Fedora 28 (Workstation Edition)"
ANSI_COLOR="0;34"
CPE_NAME="cpe:/o:fedoraproject:fedora:28"
HOME_URL="https://fedoraproject.org/"
SUPPORT_URL="https://fedoraproject.org/wiki/Communicating_and_getting_help"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_BUGZILLA_PRODUCT="Fedora"
REDHAT_BUGZILLA_PRODUCT_VERSION=28
REDHAT_SUPPORT_PRODUCT="Fedora"
REDHAT_SUPPORT_PRODUCT_VERSION=28
PRIVACY_POLICY_URL="https://fedoraproject.org/wiki/Legal:PrivacyPolicy"
VARIANT="Workstation Edition"
VARIANT_ID=workstation
I encountered the same question, and, solve it by replace compiler to clang like that:
CC=clang CXX=clang++ LD=clang LDFLAGS=-fno-lto ./configure ....
How to deal with? I tried with the following steps:
Check src/auto/config.log
Found an abnormal hint usr/bin/ld: output.o: relocation R_X86_64_32 against '.rodata.str1.1' can not be used when maki
then remember the first time I installed vim about 1 year ago, with above clang options...
Finnally, if the method above does not work, try to use the shared object form of libpython.
hope to help you~
Related
I am trying install vim8.1 as a local user on CENTOS7, following the procedure found https://github.com/Valloric/YouCompleteMe/wiki/Building-Vim-from-source [here], but with some changes.
I get into problem with the python
fatal error: Python.h: No such file or directory
#include <Python.h>
After cloning vim I do the following, without error:
./configure --with-features=huge --enable-multibyte --enable-rubyinterp=yes --enable-python3interp=yes --with-python3-config-dir=/usr/local/lib/python3.7/config-3.7m-x86_64-linux-gnu --enable-perlinterp=yes --enable-luainterp=yes --enable-gui=gtk2 --enable-cscope --prefix=/home/myuser
I am setting python3.7 (which is the python version I am using) as "pypython3-config-dir", but it seems to find python3.4:
cc -std=gnu99 -c -I. -I/home/myuser/env/env3/include/python3.4m -pthread -fPIE -Iproto -DHAVE_CONFIG_H -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -o objects/if_python3.o if_python3.c
This is strange to me, but more problematic is that it cannot find the Python.h. This happens also when I add /usr/include/python3.4m when the file Python.h is located to the PATH:
PATH=/usr/include/python3.4m:$PATH
echo $PATH shows that it is there.
Can anyone help me with this? I imagine that keeping version 3.4 in the installation of vim is not a problem for me.
Well, I happened to need vim in same configuration as yours.
I started with an official CentOS 7 docker image, and in some days I put this vim installation script:
https://gist.github.com/niloct/af20c98e983c60cdd26eaa4745d3e99e
What happens is that I decided to compile Python 3.7.3 from sources, since no packages were available for the OS version (I searched here: https://pkgs.org/), and then managed to configure vim compilation to work with it.
From everything that's set there, the python 2.7 config dir setting (--with-python-config-dir=/usr/lib64/python2.7/config/) may be different to yours, tweak it and hopefully you can compile everything with this.
I recently upgraded from 10.9 to 10.13 and had to reinstall vim. I checked out vim from source and did the following:
$/source-pkgs/vim>./configure --with-features=huge -
-enable-multibyte --enable-rubyinterp=yes --enable-pythoninterp=yes --with-
python-config-dir=/usr/lib/python2.7/config --enable-cscope --
prefix=/usr/local
configure: loading cache auto/config.cache
checking whether make sets $(MAKE)... yes
checking for gcc... /usr/bin/gcc
checking whether the C compiler works... no
configure: error: in `/Users/arenduchintala/source-pkgs/vim/src':
configure: error: C compiler cannot create executables
See `config.log' for more details
To make matters worse I can't seem to locate config.log!! It does not appear in $:source-pkgs/vim or anywhere in /usr/local/
My gcc seems to work fine:
$/source-pkgs/vim>which gcc
/usr/bin/gcc
$/source-pkgs/vim>gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 9.0.0 (clang-900.0.39.2)
Target: x86_64-apple-darwin17.3.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
Any suggestions on how to proceed would be helpful!
Im trying to compile gcc 4.8.5 under Red Hat 6. This is my procedure:
tar -xvzf archive.tar.gz
cd gcc-4.8.5
./configure --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release \
--with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object \
--enable-languages=fortran,c --prefix=/opt/gcc4.8.5
make
Then I get the following error:
make all-am
make[4]: Entering directory `/app/gfortran_build/gcc-4.8.5/host-x86_64-unknown-linux-gnu/lto-plugin'
/bin/sh ./libtool --tag=CC --tag=disable-static --mode=link gcc -Wall -g -module -bindir /opt/gcc4.8.5/libexec/gcc/x86_64-unknown-linux-gnu/4.8.5 -o
liblto_plugin.la -rpath /opt/gcc4.8.5/libexec/gcc/x86_64-unknown-linux-gnu/4.8.5 lto-plugin.lo -Wc,../libiberty/pic/libiberty.a
libtool: link: gcc -shared .libs/lto-plugin.o ../libiberty/pic/libiberty.a -Wl,-soname -Wl,liblto_plugin.so.0 -o .libs/liblto_plugin.so.0.0.0
/usr/bin/ld: ../libiberty/pic/libiberty.a(simple-object-coff.o): relocation R_X86_64_PC32 against undefined symbol `simple_object_set_big_16' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
collect2: ld returned 1 exit status
I already read about CFLAGS, but I wont get it to work.
kind regards
GCC is documented to need to be built outside of its source tree; see the configuring chapter of its installation documentation:
First, we highly recommend that GCC be built into a separate directory from the sources which does not reside within the source tree. This is how we generally build GCC; building where srcdir == objdir should still work, but doesn’t get extensive testing; building where objdir is a subdirectory of srcdir is unsupported.
So you need to build it according to that rule. Hence your GCC build:
cd gcc-4.8.5
#wrong code from the original question! Don't use that
./configure --enable-bootstrap --enable-shared \
--enable-threads=posix --enable-checking=release \
--with-system-zlib --enable-__cxa_atexit \
--disable-libunwind-exceptions --enable-gnu-unique-object \
--enable-languages=fortran,c --prefix=/opt/gcc4.8.5
is wrong; I would recommend at least:
cd gcc-4.8.5
mkdir ../_BuildGCC
cd ../_BuildGCC
../gcc-4.8.5/configure --enable-bootstrap --enable-shared \
--enable-threads=posix --enable-checking=release \
--with-system-zlib --enable-__cxa_atexit \
--disable-libunwind-exceptions --enable-gnu-unique-object \
--enable-languages=fortran,c --prefix=/opt/gnu \
--program-suffix=-mine
then, after the entire build, probably with
make -j4
followed by some mkdir /opt/gnu with appropriate user and permission, then (in the same _BuildGCC)
make install DESTDIR=/tmp/gccinst
and finally cp -vr /tmp/gccinst/opt/gnu /opt/gnu to be run appropriately (perhaps as root...., and perhaps cp -va)
Then you would add /opt/gnu/bin/ to your PATH variable, and you would use gcc-mine to compile your code.
BTW, GCC is compatible for C programs since the ABI don't change. And GCC 4.8 is obsolete and unsupported. You'll better compile from source the supported versions (listed on gcc.gnu.org; in January 2018, GCC 7.2 & GCC 6.4)
Perhaps your particular Redhat system requires additional/specific CFLAGS to be appended into your configure command. You could ask your Redhat support, or try to append CFLAGS=-fPIE or CFLAGS=-fPIC at the end of your ../gcc-4.8.5/configure command.
At last, you might perhaps get such help on gcc-help#gcc.gnu.org, but you'll better try with a recent GCC. Few GCC folks remember 4.8 ....
If you really need precisely GCC 4.8 (but I doubt that), you could buy costly support (e.g. from RedHat or AdaCore folks) if needed.
With Google I found Installing gcc 4.8 and Linuxbrew on CentOS 6
it worked with the following:
../gcc-4.8.5/configure CC="/opt/gcc4.5/bin/gcc" --prefix=/opt/gcc4.8.5 --enable-languages=c,c++,fortran --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object
The interesting part is CC=...
The installed gcc-version is 4.4. With this version, the compiling fails.
kind regards
I am working though the Linux from scratch book when I encountered an error configuring Glibc (step 5.7):
checking for sysdeps preconfigure fragments... aarch64 alpha arm configure: error: Old ABI no longer supported
I am using:
../glibc-2.20/configure \
--prefix=/tools \
--host=$LFS_TGT \
--build=$(../glibc-2.20/scripts/config.guess) \
--disable-profile \
--enable-kernel=2.6.32 \
--with-headers=/tools/include \
libc_cv_forced_unwind=yes \
libc_cv_ctors_header=yes \
libc_cv_c_cleanup=yes
I have had no trouble until now. My $LFS_TGT=armv6l-lfs-linux-gnueabihf
you should upgrade to the latest glibc release. most likely you don't have a compiler yet, so when glibc attempts to run a compile test, it fails and assumes you're trying to use an OABI toolchain.
this was fixed here:
https://sourceware.org/git/?p=glibc.git;a=commit;h=34d97d87bb1c08e34d08a9d4be24a3b1d53a4ddb
I am looking to create a native build of GCC for an ARM system and I am running into some trouble. The build machine is i686-linux. Every tutorial I see tells me how to set up the actual cross compiling suite (which I have already done using crosstools-ng). However, I don't see anything related to compiling native ARM GCC. The configure string I used is below, I have set up the sysroot only with headers. I have also cross-compiled and installed GMP and MPFR.
../../gcc-4.3.5/configure \
--host=arm-unknown-linux-gnueabi \
--build=i686-build_pc-linux-gnu \
--target=arm-unknown-linux-gnueabi \
--prefix=/home/vm/gcc-native/sysroot \
--with-sysroot=/home/vm/gcc-native/sysroot \
--enable-shared --enable-threads --disable-libmudflap --disable-libssp \
--disable-libgomp --disable-libstdcxx-pch --with-gnu-as --with-gnu-ld \
--enable-languages=c,c++ --enable-symvers=gnu --enable-__cxa_atexit \
--disable-nls --disable-multilib \
--with-gmp=/home/vm/gcc-native/sysroot/ \
--with-mpfr=/home/vm/gcc-native/sysroot/
GCC will build for a while but then dies with this:
checking for suffix of object files... configure: error: cannot compute suffix of object files: cannot compile.
I am not sure how this would even run on my system as I am building on i686-linux and the target/host are both arm-linux. My thought right now is to find a ltib distro and looking at a spec file for GCC and trying to follow all of the steps. The GCC that ltib shipped with for my board fails to compile on my system due to conflicts with the std namespace.
Any info/links would be appreciated!
Look in the config.log file (maybe not the top-level one) and see what it was trying to do when the test failed. Just grep for the cannot compute suffix message and you should find the right bit (it won't be at the end of the file).
Note that you'll need a working arm-unknown-linux-gnueabi-gcc on your path somewhere if you want to build a cross-native toolchain. I.e. you need a cross compiler to build cross-native compiler.