Ncurses 6.0 Compilation Error - error: expected ')' before 'int' - ncurses

Problem description
Trying to install ncurses 6.0 on Ubuntu 16.04 LTS is failing with a compilation error:
In file included from ./curses.priv.h:325:0,
from ../ncurses/lib_gen.c:19:
_24273.c:843:15: error: expected ‘)’ before ‘int’
../include/curses.h:1631:56: note: in definition of macro ‘mouse_trafo’
#define mouse_trafo(y,x,to_screen) wmouse_trafo(stdscr,y,x,to_screen)
^
Makefile:962: recipe for target '../objects/lib_gen.o' failed
make[1]: *** [../objects/lib_gen.o] Error 1
make[1]: Leaving directory '/home/netsamir/Sofware/Tmux/ncurses-6.0/ncurses'
Makefile:113: recipe for target 'all' failed
make: *** [all] Error 2
Configuration
netsamir#octopus:~/Sofware/Tmux/ncurses-6.0$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04 LTS
Release: 16.04
Codename: xenial
netsamir#octopus:~/Sofware/Tmux/ncurses-6.0$ gcc --version
gcc (Ubuntu 5.3.1-14ubuntu2) 5.3.1 20160413
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
netsamir#octopus:~/Sofware/Tmux/ncurses-6.0$ cpp --version
cpp (Ubuntu 5.3.1-14ubuntu2) 5.3.1 20160413
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Solution
Export the variable CPPFLAGS in the shell with -P as follow
netsamir#octopus:~/$ export CPPFLAGS="-P"
Reference
http://trac.sagemath.org/ticket/19762

$ export CPPFLAGS="-P"
This works for my local install of ncurses 6.0 on Ubuntu 16.04 LTS as well.

Related

Downgrading MSYS2 to a specific Mingw / gcc version

I have MSYS2 64 bit installed in my system.
When I try to check the gcc version, I am getting the following output.
$ gcc --version
gcc.exe (Rev9, Built by MSYS2 project) 10.2.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
But I want to use a specific mingw version for my project which uses qt library.
When I check my build log and installation folder of my qt project I found this.
|Project name: DataManager
|Project version: undefined
|C++ compiler for the host machine: ccache c++ (gcc 4.9.2 "c++ (i686-posix-dwarf-rev1, Built by MinGW-W64 project) 4.9.2")
|C++ linker for the host machine: c++ ld.bfd 2.24
|Program python3 found: YES
|Found qmake: C:\Qt\5.6.3\mingw49_32\bin\qmake.EXE (5.6.3)
I am assuming that it uses mingw49_32 version and gcc version 4.9.2.
I would like to use the same gcc version (4.9.2) in MSYS2.
How can I achieve it ?
You can't do that with MSYS2. Old packages are eventually removed from MSYS2 repos, so even if it had GCC 4.9 at some point in the past, it no longer does. The earliest available version is GCC 9.3.
Even if it was in the repo, you'd have to manually download and install it and all its dependencies, since there's no way to download outdated packages directly from pacman.
But, I suspect that:
You already have GCC 4.9 installed in C:\Qt\5.6.3\mingw49_32\bin.
Even if you don't, you might be able to get away with using an up-to-date GCC.

GLIBC_2.17 have been installed but still got "`GLIBC_2.14' not found " error

I am a green hand about linux and I am using a server to run my R code through qsub xx.pbs. When I library "Rcpp" package, I got this error:
Error: package or namespace load failed for ‘Rcpp’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/data/user77/Rlib/Rcpp/libs/Rcpp.so':
/lib64/libc.so.6: version `GLIBC_2.14' not found (required by /data/user77/Rlib/Rcpp/libs/Rcpp.so)
However, when I used ldd --version to find out what is the current version of glibc, I got this:
ldd (GNU libc) 2.17
When I ran /lib64/libc.so.6, I got this:
GNU C Library (GNU libc) stable release version 2.17, by Roland McGrath et al.
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Compiled by GNU CC version 4.4.7 20120313 (Red Hat 4.4.7-23).
Compiled on a Linux 2.6.32 system on 2021-01-02.
How can I fix this problem? Thanks a lot for your providing solutions!
(PS: I am not allowed to use sudo.)

Adacore GNATCOLL library not installing on CentOS 8

I have recently been using the gnatcoll library on CentOS 7 and Debian 9, the installation process for both operating systems has been the same.
When I attempt this install on CentOS 8, I recieve the following error msg:
[lloyd#localhost sql]$ PATH=/home/lloyd/opt/GNAT/2020/bin:$PATH
[lloyd#localhost sql]$ make setup
[lloyd#localhost sql]$ make
gprbuild -p -m --target=x86_64-linux -j0 -XGNATCOLL_VERSION=0.0 -XBUILD=PROD -XLIBRARY_TYPE=static -XXMLADA_BUILD=static -XGPR_BUILD=static \
gnatcoll_sql.gpr
Compile
[Ada] gnatcoll-sql_impl.adb
[Ada] gnatcoll-sql_fields.adb
[Ada] gnatcoll-sql.adb
[Ada] gnatcoll-sql-orm.adb
gnatcoll-sql_impl.adb:1679:44: "UTC_Time_Offset" is not visible (more references follow)
gnatcoll-sql_impl.adb:1679:44: non-visible declaration at a-catizo.ads:28
gnatcoll-sql_impl.adb:1679:44: non-visible declaration at a-calend.ads:403
gnatcoll-sql_impl.adb:1679:44: "UTC_Time_Offset" is not visible (more references follow)
gnatcoll-sql_impl.adb:1679:44: non-visible declaration at a-catizo.ads:28
gnatcoll-sql_impl.adb:1679:44: non-visible declaration at a-calend.ads:403
gnatcoll-sql_impl.adb:1679:44: "UTC_Time_Offset" is not visible (more references follow)
gnatcoll-sql_impl.adb:1679:44: non-visible declaration at a-catizo.ads:28
gnatcoll-sql_impl.adb:1679:44: non-visible declaration at a-calend.ads:403
compilation of gnatcoll-sql.adb failed
compilation of gnatcoll-sql_fields.adb failed
compilation of gnatcoll-sql_impl.adb failed
gprbuild: *** compilation phase failed
make: *** [Makefile:116: build-static] Error 4
[lloyd#localhost sql]$ gcc --version
gcc (GCC) 9.3.1 20200430 (for GNAT Community 2020 20200818)
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
See your AdaCore support agreement for details of warranty and support.
If you do not have a current support agreement, then there is absolutely
no warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.
Any advice on how to resolve this issue and install the library would be much appreciated.
Thanks,
Lloyd
My former answer was slightly off: so you can't build it with GNAT CE 2020 out-of-the-box as the version of GNATCOLL-core that ships with GNAT CE 2020 is behind. GNATCOLL-db depends on GNATCOLL-core, and the latter has been updated.
So, you first have to build and install the updated GNATCOLL-core and then build GNATCOLL-db. However still, if you're in a hurry, you can also checkout and build a slightly older branch (e.g. 20.2).

Specify the expected Linux version of the output binary of GCC

I'm helping others doing a lab experiment of the "operating systems concepts" course. The experiment task is to compile Linux 2.6.26 and run it in QEMU.
After compiling the Linux kernel, we're told to write a smallest program to serve as the init program. The example we're presented (and we followed) is:
#include <stdio.h>
int main() {
while (1) {
puts("Hello!");
sleep(2);
}
}
The compilation command is:
root#ubuntu:/home/vmware/oslab# gcc --version
gcc (Ubuntu 4.8.4-2ubuntu1~14.04.4) 4.8.4
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
root#ubuntu:/home/vmware/oslab# gcc -static -o init hello.c
The host environment should be a freshly-installed Ubuntu 14.04.6 (i386).
The problem is, one of my fellow students followed the instruction carefully, and the init program failed to execute. I asked him for his whole initrd.img, and noticed how his init program looks different:
vmware#ubuntu:~/oslab$ file mnt/init
mnt/init: ELF 32-bit LSB executable, Intel 80386, version 1 (GNU/Linux), statically linked, for GNU/Linux 2.6.32, BuildID[sha1]=7365ac494ef1d924c171899c169dbd3195d2d209, not stripped
To me, that's clearly not something that can run on Linux 2.6.26. With GCC 4.8 provided in the Ubuntu APT repository (trusty), how can I get GCC to output something that runs on Linux 2.6.26?
FYI: On my own testing VM (also Ubuntu 14.04.6, Linux 4.4, same latest GCC version from Ubuntu APT repo as of April 2, 2019), the compiled program shows Linux 2.6.24 in file output. Also, his binary runs perfectly well in QEMU with my freshly compiled 2.6.32.37 kernel.
Specify the expected Linux version of the output binary of GCC
in your question you speak about the version of libc C but that can also concerns a lot of other libs, and may be you want also produce 32b and/or 64b executable(s).
For me the most secure way is to use pbuilder, I use it to produce BoUML debs for Ubuntu Cosmic (18.10) Bionic (18.04), Artful (17.10) Zesty (17.04) Yakkety (16.10) Xenial (16.04) Trusty (14.04) and Precise (12.04) and that in both 32b and 64b, and I do all of that from my Ubuntu Xenial 64b just doing the appropriate sequence of pbuilder commands (without any reboot to go in each Linux release)
That needs time to generate a version but because this is made in the corresponding Linux version you are sure of the result.
The provided lab environment was Ubuntu 14.04, where the package libc6 has version 2.19-0ubuntu6.14.
The lab instruction provided by the teaching assistants contained an instruction to change the APT source by editing /etc/apt/sources.list manually, which had a SERIOUS disaster in it: The "version" string in the edited example was xenial instead of trusty, which, if followed, would factually update your system to Xenial (Ubuntu 16.04). The new version of libc6 was 2.23-0ubuntu11, which would cause as and ld (from binutils, not related to GCC) to output ELF with a minimum Linux version of 2.6.32.
With glibc version 2.19, the output ELF is compatible with Linux 2.6.24, but with glibc 2.23, the output is only compatible with Linux 2.6.32.
I tested and verified this by compiling a test program under Ubuntu 14.04 and checking the ELF information, then replaced all trusty with xenial, did apt-get update and only updated binutils and its dependencies (which includes libc6), and compiled the program and checked it again.

How do I install gcc 6.x on Oracle Solaris 11.2 x86 and CentOS 6.6 Final?

I tried to install... but failed
$ wget https://ftp.gnu.org/gnu/gcc/gcc-6.2.0/gcc-6.2.0.tar.bz2
$ tar -jxvf gcc-6.2.0.tar.bz2
$ cd /home/logvadmin/gcc-6.2.0/
$ ./contrib/download_prerequisites
$ ./configure --prefix=/usr/gcc-6.2.0 --enable-languages=c,c++ --disable-multilib
$ make
In phase 6 Error
[Solaris]
make: Fatal error in reader: Makefile, line 27: Unexpected end of line seen
$ vi Makefile
26: ifeq (,$(.VARIABLES)) # The variable .VARIABLES, new with 3.80, is never empty.
27: $(error GNU make version 3.80 or newer is required.)
28: endif
user#solaris:~/gcc-6.2.0$ gcc --version
gcc (GCC) 4.5.2
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[CentOS]
It takes too long to build.
6 hour ??
I dont know what the problem is..
As the comments point out, use gmake.
For full details, see https://gcc.gnu.org/install/index.html
I fairly regularly build GCC from SVN head on Solaris 11.3 amd64, Fedora 24 x64 and FreeBSD 11 x64.
Firstly, I built and installed libgmp, lbmpc and libmpfr to ~/tools/lib. You may not need to do this if you are using a recent Linux or FreeBSB. On Solaris, third party freeware is often many years out of data.
My configure script for Solaris is:
#!/bin/ksh93
export LD_RUN_PATH=/export/home/paulf/tools/lib/lib
../configure --prefix=/export/home/paulf/tools/gcc --with-gmp=/export/home/paulf/tools/lib --with-gnu-as --with-as=/usr/ccs/bin/gas --without-gnu-ld --with-ld=/usr/ccs/bin/ld
My update & build script is:
#!/bin/ksh
export LD_RUN_PATH=~/tools/lib/lib
cd ~/scratch/gcc
svn up
cd build
gmake -j 4
if (( $? == 0 )) ; then
print gmake succeeded
gmake install
fi
Note that if you don't set the run path then the default GCC build won't set it and you will have an essentially broken compiler that needs LD_LIBRARY_PATH

Resources