Unable to build glibc - gcc

I'm trying to build glibc 2.27 as a static library from sources on Ubuntu 18.04. This is the command I am using(after making a separate build directory for glibc):
$ git clone git://sourceware.org/git/glibc.git && cd glibc
$ git checkout release/2.27/master
$ cd ..
$ mkdir glibc-build && cd glibc-build
$ ../glibc/configure --enable-kernel=4.4 --disable-shared --enable-static --enable-static-nss --prefix=/usr
$ make
make results in this error:
cc1: fatal error: /home/parallels/glibc-build/libc-modules.h: No such file or directory
compilation terminated.
../Makerules:281: recipe for target '/home/parallels/glibc-build/ucontext_i.h' failed
make[2]: *** [/home/parallels/glibc-build/ucontext_i.h] Error 1
make[2]: Leaving directory '/home/parallels/glibc/csu'
Makefile:215: recipe for target 'csu/subdir_lib' failed
make[1]: *** [csu/subdir_lib] Error 2
make[1]: Leaving directory '/home/parallels/glibc'
Makefile:9: recipe for target 'all' failed
make: *** [all] Error 2
Full log for make
I am running Ubuntu 18.04 and am using the preinstalled versions of gcc and make.

This is a known issue:
Unable to build GLIBC with --disable-shared
In general, this is not a problem because a default build (without --disable-shared) builds both the static and dynamically linked version of the library, and make install DESTDIR=… installs both.

Related

How to compile tool and samples from within the kernel source tree? (e.g. bpftool, bpf samples)

GOAL: compile samples/bpf, compile bpf/bpftool and use them.
PROBLEM: on a VM with Ubuntu 18.04 bionic with a kernel 4.18.0-25-generic I've installed kernel src code executing apt install linux-source-4.18.0.
Now I cd into /usr/src/linux-source-4.18.0/linux-source-4.18.0/samples/bpf and I run make and the result is
make -C ../../ /usr/src/linux-source-4.18.0/linux-source-4.18.0/samples/bpf/ BPF_SAMPLES_PATH=/usr/src/linux-source-4.18.0/linux-source-4.18.0/samples/bpf
make[1]: Entering directory '/usr/src/linux-source-4.18.0/linux-source-4.18.0'
scripts/kconfig/conf --syncconfig Kconfig
***
*** Configuration file ".config" not found!
***
*** Please run some configurator (e.g. "make oldconfig" or
*** "make menuconfig" or "make xconfig").
***
scripts/kconfig/Makefile:40: recipe for target 'syncconfig' failed
make[3]: *** [syncconfig] Error 1
Makefile:562: recipe for target 'syncconfig' failed
make[2]: *** [syncconfig] Error 2
make[1]: *** No rule to make target 'include/config/auto.conf', needed by 'include/config/kernel.release'. Stop.
make[1]: Leaving directory '/usr/src/linux-source-4.18.0/linux-source-4.18.0'
Makefile:203: recipe for target 'all' failed
make: *** [all] Error 2
If I cd into ../samples/bpf and I run sudo make the result is
Auto-detecting system features:
... libbfd: [ OFF ]
... disassembler-four-args: [ OFF ]
CC map_perf_ring.o
CC xlated_dumper.o
CC perf.o
CC cfg.o
CC common.o
CC cgroup.o
CC main.o
main.c:36:10: fatal error: bfd.h: No such file or directory
#include <bfd.h>
^~~~~~~
compilation terminated.
Makefile:92: recipe for target 'main.o' failed
make: *** [main.o] Error 1
QUESTIONS: what am I missing? After I compile them if I want to write a program which, for example, needs to use bpftool I have to write the program inside the source kernel directory or I can write it everywhere?
Build errors
The first case (Makefile:562: recipe for target 'syncconfig' failed) fails because you run make from the top of the linux kernel repository, and before trying to compile the samples, the build system tries to load a config file to use for your system (but does not find one).
Before trying to build the samples (make -C samples/bpf), you can create a .config file from your current kernel configuration like this:
$ cp /usr/src/linux-headers-$(uname -r)/.config <path to repo>/.config
$ make olddefconfig
Or even simply generate a default config file from scratch:
$ make defconfig
See make help from top directory to see the available make options.
Your second error, regarding bfd.h not found, is that you miss a library. Libbfd on Ubuntu comes with binutils-dev, so apt install binutils-dev should do the trick.
Compiling the programs
Finally, regarding your question on compiling the programs:
You can write and build program from the kernel repository, just by creating a new sample and reusing the existing Makefiles.
You can also write and compile programs outside of the kernel tree. The basic clang (v4.0 or above, if possible v6.0 or above) command to compile them usually looks something like this:
$ clang -O2 -emit-llvm -c my_bpf_prog.c -o - | \
llc -march=bpf -filetype=obj -o my_bpf_prog.o
You can find examples of programs compiled out of the kernel tree in that repository (disclaimer: by my company) or in the XDP tutorial repo.

Compile Ruby from source on AIX 7.1

I am trying to compile Ruby 2.4.5 from source using gcc compiler on AIX 7.1. The configure works fine, but the make fails giving an error C is not a recognized flag. Anybody faced the same issue and managed to compile ruby on AIX 7.1?
Steps followed:
1) ./configure --disable-install-doc CC="gcc" CFLAGS="-maix64 -mminimal-toc" CXX="g++" CXXFLAGS="-maix64 -mminimal-toc" NM="nm -X64" AR="ar -X64" LDFLAGS="-maix64" EXTLDFLAGS=" -- works perfectly fine
2) make - fails with the below error
make: Not a recognized flag: C
usage: make [-einqrst] [-k|-S] [-d[A|adg[1|2]mstv]] [-D variable] [-f makefile] [-j [jobs]] [variable=value ...] [target ...]
make: 1254-004 The error code from the last command is 2.
Stop.
make: 1254-004 The error code from the last command is 2.
Stop.
make: 1254-004 The error code from the last command is 2.
Update :
Switching to GNU make gives the below error:
Making all in man
make[5]: Entering directory '/test/ruby-2.4.5/tst/ext/fiddle/libffi-3.2.1/man'
make[5]: Nothing to be done for 'all'.
make[5]: Leaving directory '/test/ruby-2.4.5/tst/ext/fiddle/libffi-3.2.1/man'
make[5]: Entering directory '/test/ruby-2.4.5/tst/ext/fiddle/libffi-3.2.1'
CC src/prep_cif.lo
CC src/types.lo
CC src/raw_api.lo
CC src/java_raw_api.lo
CC src/closures.lo
CC src/powerpc/ffi_darwin.lo
../../../../ext/fiddle/libffi-3.2.1/src/powerpc/ffi_darwin.c: In function 'ffi_p rep_args':
../../../../ext/fiddle/libffi-3.2.1/src/powerpc/ffi_darwin.c:112:17: warning: un used variable 'abi' [-Wunused-variable]
const ffi_abi abi = ecif->cif->abi;
^
CPPAS src/powerpc/aix.lo
libtool: compile: unable to infer tagged configuration
libtool: compile: specify a tag with `--tag'
Makefile:1335: recipe for target 'src/powerpc/aix.lo' failed
make[5]: *** [src/powerpc/aix.lo] Error 1
make[5]: Leaving directory '/test/ruby-2.4.5/tst/ext/fiddle/libffi-3.2.1'
Makefile:1596: recipe for target 'all-recursive' failed
make[4]: *** [all-recursive] Error 1
make[4]: Leaving directory '/test/ruby-2.4.5/tst/ext/fiddle/libffi-3.2.1'
Makefile:730: recipe for target 'all' failed
make[3]: *** [all] Error 2
make[3]: Leaving directory '/test/ruby-2.4.5/tst/ext/fiddle/libffi-3.2.1'
Makefile:370: recipe for target 'libffi-3.2.1/.libs/libffi_convenience.a' failed
make[2]: *** [libffi-3.2.1/.libs/libffi_convenience.a] Error 2
make[2]: Leaving directory '/test/ruby-2.4.5/tst/ext/fiddle'
exts.mk:212: recipe for target 'ext/fiddle/all' failed
make[1]: *** [ext/fiddle/all] Error 2
make[1]: Leaving directory '/test/ruby-2.4.5/tst'
uncommon.mk:220: recipe for target 'build-ext' failed
make: *** [build-ext] Error 2
The issue is that you are using AIX's built-in copy of make and it does not support the command-line option -C. That option is available in GNU make.
If you run make -v and do not see output like the following then you are not using GNU make:
GNU Make 3.81
Copyright (C) 2006 Free Software Foundation, Inc.
Run the command which make and it will return either /usr/bin/make or /opt/freeware/bin/make (or a similar path outside of /usr/bin):
If it returns /usr/bin/make then you do not have GNU make installed on your system and will need to follow one of several tutorials to get it installed on AIX.
If it returns /opt/freeware/bin/make then you do have GNU make installed, but it's not reflected in $PATH. You can add it to your path temporarily while you compile Ruby by running export PATH=/opt/freeware/bin:$PATH before you run the make command.
Update:
I would encourage you to open a separate question for your current build trouble, since the original question was about the -C flag for make not working on AIX, and now you have a separate question about running GNU make with an entirely different set of issues and possible solutions.
That said, it's possible you may be able to resolve your issue by starting over and running ./configure LIBTOOL='/usr/bin/libtool --tag=CC' (or whatever your path is to libtool). This is based off the following messages:
libtool: compile: unable to infer tagged configuration
libtool: compile: specify a tag with `--tag'
If this doesn't work then you'll probably have to edit the Makefile by looking for those specific invocations of libtool and append --tag=CC to them one by one until you're able to progress beyond these errors.
Both solutions are assuming that the only code being compiled is C. To my knowledge, everything in MRI that needs to be compiled is written in C, but if anything is written in C++ then the libtool invocations would require --tag=CXX. You can read more about tags here.

Installation SystemC 2.3.2 failed

I want to install SystemC 2.3.2 on ubuntu 16.04 So i followd the install file directives:
2. Create a temporary directory, e.g.,
> mkdir objdir
3. Change to the temporary directory, e.g.,
> cd objdir
4. Choose your compiler by setting the CXX environment variable
> export CXX=g++
5. Configure the package for your system, e.g.,
(The configure script is explained below.)
> ../configure
In case you want to install the package in another place than the
top level directory (systemc-2.3.2), configure the package e.g. as
follows:
> ../configure --prefix=/usr/local/systemc-2.3.2
6. Compile the package.
> make
7. At this point you may wish to verify the compiled package by
testing the example suite.
> make check
8. Install the package.
> make install
9. You can now remove the temporary directory, .e.g,
> cd ..
> rm -rf objdir
every step went good until i reached step 8 to install the package ... i get the following error:
user#user-Lenovo-IdeaPad-Y510P:~/systemc-2.3.2/objdir$ make install
Making install in docs
make[1]: Entering directory '/home/anoir/systemc-2.3.2/objdir/docs'
make[2]: Entering directory '/home/anoir/systemc-2.3.2/objdir/docs'
make[2]: Nothing to be done for 'install-exec-am'.
/bin/mkdir -p '/usr/local/systemc-2.3.2/docs'
/bin/mkdir: cannot create directory ‘/usr/local/systemc-2.3.2’: Permission denied
Makefile:380: recipe for target 'install-nobase_docDATA' failed
make[2]: *** [install-nobase_docDATA] Error 1
make[2]: Leaving directory '/home/anoir/systemc-2.3.2/objdir/docs'
Makefile:453: recipe for target 'install-am' failed
make[1]: *** [install-am] Error 2
make[1]: Leaving directory '/home/anoir/systemc-2.3.2/objdir/docs'
Makefile:505: recipe for target 'install-recursive' failed
make: *** [install-recursive] Error 1
I don't understand the problem. What could be my mistake
Default install location need root access. If you don't have it. Try to install it to other location which you have right to access.
For example:
../configure --prefix ${HOME}/SystemC

Mulval: installation setup

I am trying to install mulval on my machine following this doc:
http://people.cis.ksu.edu/~xou/argus/software/mulval/readme.html
However, I am not exactly sure how to make changes to the path of XSB, dot and Mulval.
I get the following error when I try to run "make":
~/mulval$ make
(cd src/adapter; make; make install)
make[1]: Entering directory '/home/aditya/mulval/src/adapter'
javac GetCVEID.java -cp :/lib/dom4j-1.6.1.jar:/lib/jaxen-1.1.1.jar:/lib/mysql-connector-java-5.1.8-bin.jar
make[1]: javac: Command not found
Makefile:9: recipe for target 'GetCVEID.class' failed
make[1]: *** [GetCVEID.class] Error 127
make[1]: Leaving directory '/home/aditya/mulval/src/adapter'
make[1]: Entering directory '/home/aditya/mulval/src/adapter'
javac GetCVEID.java -cp :/lib/dom4j-1.6.1.jar:/lib/jaxen-1.1.1.jar:/lib/mysql-connector-java-5.1.8-bin.jar
make[1]: javac: Command not found
Makefile:9: recipe for target 'GetCVEID.class' failed
make[1]: *** [GetCVEID.class] Error 127
make[1]: Leaving directory '/home/aditya/mulval/src/adapter'
Makefile:6: recipe for target 'adapter' failed
make: *** [adapter] Error 2
Any help on getting this installation completed?
Thanks in advance!
Set your MULVALROOT env variable before make:
for instance: export MULVALROOT=/home/aditya/mulval
this error is related to javac, not installed properly:
"make[1]: javac: Command not found"
you can check the version with: javac -version
if not installed, install again with sudo apt install default-jdk
if you have other issues related to lex and/or bison later, install them too:
lex: sudo apt install flex
bison: sudo apt install bison

Error building LAPACK on Redhat 4.1

I am trying to build LAPACK (the full version) with ATLAS on Redhat 4.1. I have been successful in building ATLAS depending upon the tarfile of lapack:
atlas/configure --prefix=HOME/atlas --with-netlib-lapack-tarfile=HOME/lapack-3.4.1.tgz
make build
make check
make install
But I need the whole installation of LAPACK. I found
http://math-atlas.sourceforge.net/atlas_install/atlas_install.html
and
http://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&ved=0CGcQFjAA&url=http%3A%2F%2Fciteseerx.ist.psu.edu%2Fviewdoc%2Fdownload%3Fdoi%3D10.1.1.136.5309%26rep%3Drep1%26type%3Dpdf&ei=3C8YUKaqOIqm8AT6kYC4Cg&usg=AFQjCNHKbHg1H0qupmzQbj9tGq3tsmXRDQ&sig2=etIB36nxjasjUg4sEwQ0DQ
which suggest changing a few lines of the default make.inc.example to build the rest of LAPACK. However, I am unsuccessful in getting even the default build of LAPACK to work:
cp make.inc.example make.inc
compute-1-29.local make
( cd INSTALL; make; ./testlsame; ./testslamch; ./testdlamch; \
./testsecond; ./testdsecnd; ./testieee; ./testversion )
make[1]: Entering directory `/home/jmorgens/lap/lapack/INSTALL'
gfortran -O0 -c slamch.f -o slamch.o
/share/apps/gcc-trunk/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.2.0/f951: error while loading shared libraries: libmpfr.so.1: cannot open shared object file: No such file or directory
make[1]: *** [slamch.o] Error 1
make[1]: Leaving directory `/home/jmorgens/lap/lapack/INSTALL'
ASCII character set
Tests completed
/bin/sh: ./testslamch: No such file or directory
/bin/sh: ./testdlamch: No such file or directory
/bin/sh: ./testsecond: No such file or directory
/bin/sh: ./testdsecnd: No such file or directory
/bin/sh: ./testieee: No such file or directory
/bin/sh: ./testversion: No such file or directory
make: *** [lapack_install] Error 127
Suggestions?

Resources