glibc not properly compiling - c

While compiling glibc 2.11, I get the following error. Any idea how to solve this.
In file included from ../sysdeps/unix/sysv/linux/syslog.c:10:
../misc/syslog.c: In function ‘__vsyslog_chk’:
../misc/syslog.c:123: sorry, unimplemented: inlining failed in call to ‘syslog’: function body not available
../misc/syslog.c:155: sorry, unimplemented: called from here
make[2]: *** [/home/alice/Desktop/glib-build/misc/syslog.o] Error 1
make[2]: Leaving directory `/home/alice/Desktop/glibc-2.11/misc'
make[1]: *** [misc/subdir_lib] Error 2
make[1]: Leaving directory `/home/alice/Desktop/glibc-2.11'
make: *** [all] Error 2

Apparently, this is a known problem with building glibc on Ubuntu. In essence:
glibc does not build with _FORTIFY_SOURCE enabled, and Ubuntu compiles stuff with -D_FORTIFY_SOURCE=2.
You need to disable this by undefining _FORTIFY_SOURCE. i.e. append -U_FORTIFY_SOURCE to your CFLAGS.

Related

Linux compilation throwing error header file error

I am compiling this code (minimul linux kernel) from https://github.com/liva/minimal-linux
I am getting > make[1]: *** [Kbuild:42: include/generated/timeconst.h] Error 127
basically its make error. may be error in timeconst.h or may be its missing file.
So my question is how to find the file in the minimul-linux-master (download from above link) folder and how to debug for more info when compiling the code.
as u can see what make displays is completely useless. And I have no clue why the error is caused. there are not any other errors so I assumed all the errors or single error is in timeconst.h.
this is terminal output.
....
HOSTCC scripts/mod/sumversion.o
HOSTLD arch/x86/tools/relocs
HOSTCC scripts/mod/file2alias.o
UPD include/config/kernel.release
CHK include/generated/utsrelease.h
UPD include/generated/utsrelease.h
CC kernel/bounds.s
CHK include/generated/timeconst.h
/bin/sh: 1: bc: not found
make[1]: *** [Kbuild:42: include/generated/timeconst.h] Error 127
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:1054: prepare0] Error 2
make: *** Waiting for unfinished jobs....
HOSTLD scripts/mod/modpost
I am on host: 5.10.0-kali3-amd64
machine is x86-64
I fixed the same by comparing mine KBuild with the one defined in in the given link.
https://android.googlesource.com/kernel/msm/+/db248780101f2ca2bc3c02598917e88dfdce3207/Kbuild

How to fix 'ld: library not found for -lglib-2.0'

I have to do a compiler with flex and bison for a school project.
They give to me example of new language but I can't compile them..
The code is working fine for other people so the problem come from my Mac. The problem appears when I try to compile with make command, he say "ld: library not found for -lglib-2.0".
I installed "Glib" already but this don't solve the problem.
make
[ 20%] Linking C executable facile
ld: library not found for -lglib-2.0
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [facile] Error 1
make[1]: *** [CMakeFiles/facile.dir/all] Error 2
make: *** [all] Error 2
I need to compile the code to work after on the project.
Thanks you

Error while cross compiling poppler package

I am getting the following error while cross compiling Poppler package on Ubuntu
After configuring I gave command make
then while making the following error has come
GlobalParams.cc:81:35: fatal error: fontconfig/fontconfig.h: No such file or directory
compilation terminated.
make[3]: * [libpoppler_la-GlobalParams.lo] Error 1
make[3]: Leaving directory /media/COMMON/WorkSpace/Packages/poppler-0.41.0/poppler'
make[2]: *** [all] Error 2
make[2]: Leaving directory/media/COMMON/WorkSpace/Packages/poppler-0.41.0/poppler'
make[1]: * [all-recursive] Error 1
make[1]: Leaving directory `/media/COMMON/WorkSpace/Packages/poppler-0.41.0'
make: *** [all] Error 2
I even check the includes which I had given while configuring it has the fontconfig/fontconfig.h but den still the error is coming.
It looks like you should cross-compile the fontconfig library,then include the headers and libs into Popper.
Download the latest fontconfig and excute the conmmand below:
PKG_CONFIG_PATH=/opt/poppLib/lib/pkgconfig ./configureCC=arm-linux-gcc --host=arm-linux --build=i386-linux --prefix=/opt/poppLib--with-arch=arm --enable-libxml2 --disable-docs
make && make install
then add the include and lib in your Popper ,try compile it again.

Make error for stellarisware

I got a stellaris board to explore the power of arm. I'm using arch linux. I want to setup a toolchain based on eclipse, but if I donwload the SW-LM3S-9453.exe, unzip it, and try to make it I got the following errors:
[root#vaio stellaris]# make
make[1]: Entering directory '/home/erbal/src/stellaris/driverlib'
make[2]: Entering directory '/home/erbal/src/stellaris/driverlib'
CC adc.c
as: unrecognized option '-mcpu=cortex-m3'
../makedefs:186: recipe for target 'gcc-cm3/adc.o' failed
make[2]: *** [gcc-cm3/adc.o] Error 1
make[2]: Leaving directory '/home/erbal/src/stellaris/driverlib'
Makefile:41: recipe for target 'all' failed
make[1]: *** [all] Error 2
make[1]: Leaving directory '/home/erbal/src/stellaris/driverlib'
Makefile:46: recipe for target 'all' failed
make: *** [all] Error 2
What am I missing?
Have you verified which toolchain is being used? That error would be appropriate if you are trying to use the host toolchain rather than a toolchain built for ARM.

'undefined reference' errors when compiling against library

I added a third party library to my code and is getting errors like this when running make. Please help me understand this error.
(.text+0x9b4): undefined reference to `snd_strerror'
/home/bet/Tent/tun/app/Common/hl/lib/libGHAL.a(gfxhal.o): In function `GFX_create_region':
/home/bet/Tent/tun/app/Common/hl/src/GHAL/gfxhal.c:1141: undefined reference to `my_key_handler'
/home/bet/Tent/tun/app/Common/hal/src/GHAL/gfxhal.c:1141: undefined reference to `create_window'
collect2: ld returned 1 exit status
make[2]: *** [all] Error 1
make[2]: Leaving directory `/home/bet/Tent/tun/app/Common/c_app'
make[1]: *** [ctv_all] Error 2
make[1]: Leaving directory `/home/bet/Tent/tun/app/Common'
Those are Linking errors, which tell you the linker cannot find definitions for the library you are using.
You will have to link the library to your project.
gcc <your files for compilation> -lLibName
Read this for better understanding.
I still get the error even if
readline library is installed and
-lreadline is added to gcc compiling command.
The root cause of my issue is the order of the libraries/code: -lreadline (and other libraries) should be put right before -o options.

Resources