breakpad 32-bit build fails on a 64-bit Linux system - linux

I am trying to build 32-bit breakpad on a 64-bit Linux system but I am getting the build error. I did the following as explained here.
./configure CXXFLAGS=-m32 CFLAGS=-m32 CPPFLAGS=-m32
make
In make, I am getting the following error:
src/common/stabs_reader.cc: In member function ‘bool google_breakpad::StabsReader::Process()’:
src/common/stabs_reader.cc:98:35: error: ‘N_UNDF’ was not declared in this scope
} else if (iterator_->type == N_UNDF && unitized_) {
^
Makefile:4678: recipe for target 'src/common/stabs_reader.o' failed
make: *** [src/common/stabs_reader.o] Error 1
Then I looked into the ./configure output and saw that it could be the problem with a.out.h because of the following output:
checking a.out.h usability... no
checking a.out.h presence... no
checking for a.out.h... no
Anyone else face this problem? Am I missing something?

Looks like a bug in the 32bit breakpad build.
I've submitted a patch to the project; in the interim, you can simply edit src/common/stabs_reader.h and replace:
#include <a.out.h>
with
#include <linux/a.out.h>
and configuring with:
env ac_cv_header_a_out_h=yes CXXFLAGS=-m32 CFLAGS=-m32 CPPFLAGS=-m32 ./configure

Related

Building a toolchain with cmake to cross-compile for android

gcc (GCC) 4.8.1
android-ndk-r9
Hello,
My host machine is Fedora 19 and I want to create a tool-chain for compiling programs to run on android, later I want to extend this for iOS.
I get the following error:
Check for working C compiler: /opt/ndk/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc -- broken
I am not sure why I am getting this error, as everything has been installed. I have also installed binutils-arm-linux-gnu. However, this is my first time do this type of thing, so many I have got something mixed up.
I am trying to create a toolchain file using cmake to croos-compile to run libraries on an android device.
I have installed the android-ndk-r9 in the following location with the path to the compiler:
/opt/ndk/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin
arm-linux-androideabi-addr2line
arm-linux-androideabi-ar
arm-linux-androideabi-as
arm-linux-androideabi-c++
arm-linux-androideabi-c++filt
arm-linux-androideabi-cpp
arm-linux-androideabi-elfedit
arm-linux-androideabi-g++
arm-linux-androideabi-gcc
arm-linux-androideabi-gcc-4.8
arm-linux-androideabi-gcc-ar
arm-linux-androideabi-gcc-nm
arm-linux-androideabi-gcc-ranlib
arm-linux-androideabi-gcov
arm-linux-androideabi-gdb
arm-linux-androideabi-gprof
arm-linux-androideabi-ld
arm-linux-androideabi-ld.bfd
arm-linux-androideabi-ld.gold
arm-linux-androideabi-ld.mcld
arm-linux-androideabi-nm
arm-linux-androideabi-objcopy
arm-linux-androideabi-objdump
arm-linux-androideabi-ranlib
arm-linux-androideabi-readelf
arm-linux-androideabi-run
arm-linux-androideabi-size
arm-linux-androideabi-strings
arm-linux-androideabi-strip
My cross-compile file is:
include(CMakeForceCompiler)
set(toolchain_path /opt/ndk/toolchains)
# Target system
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR arm)
set(CMAKE_SYSTEM_VERSION 1)
# Compiler to build for the target
set(CMAKE_C_COMPILER /opt/ndk/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc)
set(CMAKE_FIND_ROOT_PATH /opt/ndk/toolchains)
I run this from my build/debug directory with my toolchain being in the root directory.
[ant#localhost debug]$ cmake -DCMAKE_TOOLCHAIN_FILE=arm-eabi-gcc.cmake ../..
Output
-- The C compiler identification is GNU 4.8.0
-- Check for working C compiler: /opt/ndk/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc
-- Check for working C compiler: /opt/ndk/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc -- broken
CMake Error at /usr/share/cmake/Modules/CMakeTestCCompiler.cmake:61 (message):
The C compiler
"/opt/ndk/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: /home/steve/mobile_progs/linux_pjsip/build/debug/CMakeFiles/CMakeTmp
Run Build Command:/usr/bin/gmake "cmTryCompileExec379796592/fast"
/usr/bin/gmake -f CMakeFiles/cmTryCompileExec379796592.dir/build.make
CMakeFiles/cmTryCompileExec379796592.dir/build
gmake[1]: Entering directory
`/home/steve/mobile_progs/linux_pjsip/build/debug/CMakeFiles/CMakeTmp'
/usr/bin/cmake -E cmake_progress_report
/home/steve/mobile_progs/linux_pjsip/build/debug/CMakeFiles/CMakeTmp/CMakeFiles
1
Building C object
CMakeFiles/cmTryCompileExec379796592.dir/testCCompiler.c.o
/opt/ndk/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc
-o CMakeFiles/cmTryCompileExec379796592.dir/testCCompiler.c.o -c
/home/steve/mobile_progs/linux_pjsip/build/debug/CMakeFiles/CMakeTmp/testCCompiler.c
Linking C executable cmTryCompileExec379796592
/usr/bin/cmake -E cmake_link_script
CMakeFiles/cmTryCompileExec379796592.dir/link.txt --verbose=1
/opt/ndk/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc
CMakeFiles/cmTryCompileExec379796592.dir/testCCompiler.c.o -o
cmTryCompileExec379796592 -rdynamic
/opt/android-ndk-r9/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld:
error: cannot open crtbegin_dynamic.o: No such file or directory
/opt/android-ndk-r9/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld:
error: cannot open crtend_android.o: No such file or directory
/opt/android-ndk-r9/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld:
error: cannot find -lc
/opt/android-ndk-r9/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld:
error: cannot find -ldl
collect2: error: ld returned 1 exit status
gmake[1]: *** [cmTryCompileExec379796592] Error 1
gmake[1]: Leaving directory
`/home/steve/mobile_progs/linux_pjsip/build/debug/CMakeFiles/CMakeTmp'
gmake: *** [cmTryCompileExec379796592/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:4 (project)
Many thanks in advance,
I managed to solve the problem by first going to this website:
http://developer.android.com/tools/sdk/ndk/index.html
There is an example of using the standalone toolchain that comes with NDK.
make-standalone-toolchain.sh --toolchain=arm-linux-androideabi-4.8
Extracted the into my /opt directory.
And using this sample toolchain cmake file
# Target system
set(CMAKE_SYSTEM_NAME Android)
set(CMAKE_SYSTEM_VERSION 1)
# Compiler to build for the target
set(CMAKE_C_COMPILER /opt/arm-linux-androideabi-4.8/bin/arm-linux-androideabi-gcc)
set(CMAKE_CXX_COMPILER /opt/arm-linux-androideabi-4.8/bin/arm-linux-androideabi-g++)
Everything just worked after that. However, I couldn't get my previous problem working. Maybe I have set some environmental variables incorrectly to the wrong paths.
Hope this helps someone else.
Why you don't try this android-cmake. I still use this script and it works fairly well. If that approach does not fit your needs, you could use it as an inspiration anyway :-) .
For original problem from ant2009, please have a try to add following lines in .cmake:
SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --sysroot=/opt/ndk/platforms/android-23/arch-arm" CACHE STRING "" FORCE)
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --sysroot=/opt/ndk/platforms/android-23/arch-arm" CACHE STRING "" FORCE)
In 2020 the make-standalone-toolchain.sh approach is deprecated.
This is an updated CMakeList.txt:
set(CMAKE_SYSTEM_NAME Android)
set(CMAKE_SYSTEM_VERSION 24)
set(CMAKE_ANDROID_ARCH_ABI arm64-v8a)
PROJECT(mylib C)
CMAKE_MINIMUM_REQUIRED(VERSION 3.18.0)
SET( ${PROJECT_NAME}_CURRENT 1 )
SET( ${PROJECT_NAME}_REVISION 0 )
SET( ${PROJECT_NAME}_AGE 0 )
SET(VERSION "${${PROJECT_NAME}_CURRENT}.${${PROJECT_NAME}_REVISION}.${${PROJECT_NAME}_AGE}")
SET(SOURCES foobar.c)
ADD_LIBRARY(mylib SHARED ${SOURCES})
NOTE: For the ABI arm64-v8a CMake 3.18 is needed to detect the NDK toolchain correctly, 3.10 which is the version in Ubuntu 18.04, does not find the toolchain.

Error in compiling the kernel

I am trying to compile linux 3.5.2 kernel. I followed this tutorial
"http://blog.techveda.org/index.php/adding-system-calls-linux-kernel-3-5-x/"
and everything was going perfect.but when I tried to do build the kernel I get this error
here are the commands I used to build my kernel
sudo cp /boot/config-3.5.0-17-generic ./config
make oldconfig
sudo make -j8
the error when I do the make -j8 is:
ERROR: "__modver_version_show" [drivers/staging/rts5139/rts5139.ko] undefined!
WARNING: modpost: Found 2 section mismatch(es).
To see full details build your kernel with:
'make CONFIG_DEBUG_SECTION_MISMATCH=y'
make[1]: *** [__modpost] Error 1
make: *** [modules] Error 2
I really can't find what is the problem it looks like I have a problem with a driver but how could this happen and I am using my old configuration file that is already working. ??
I have met the same problem while compiling kernel 3.2, and solve it by "su -" to root and then recompile.
If you do not need this driver simply mod the config fiel like follows:
CONFIG_RTS5139=n

lfs 7.2 compilation of glibc 2.16.0

I am making an linux system following the procedure in lfs. But while i was following the fifth step(i.e. the one before make) on this page, i get an error at the last.
configure: error: linker with -z relro support required
Now after this if i call make i get an error
make: *** No targets specified and no makefile found. Stop.
I am running this on a ubuntu 12.04 machine.
How to fix this error?
Do the following:-
sudo apt-get install gawk
and then retry. This worked for me.

Gcc compilation "cannot compute suffix of object files: cannot compile"

I'm actually reading the LFS book (version 7.1) and I'm blocked at page 53. Trying to compile gcc, I tried the following command:
./configure --target=$LFS_TGT --prefix=$LFS/build/gcc-build --disable-nls\
--disable-shared --disable-multilib --disable-decimal-float --disable-threads\
--disable-libmudflap --disable-libssp --disable-libgomp --disable-libquadmath\
--disable-target-libiberty --disable-target-zlib\
--enable-languages=c\
--without-ppl --without-cloog\
--with-mpfr-include=$LFS/source/mpfr/src
--with-mpfr-lib=$LFS/source/mpfr/src/.libs\
--with-gmp-include=/mnt/LFS/source/gmp\
--with-gmp-lib=/mnt/LFS/source/gmp/.libs\
--with-mpc-include=/mnt/LFS/source/mpc/src\
--with-mpc-lib=/mnt/LFS/source/mpc/src/.libs
to run the configure script of gcc (of course I already compiled mpfr, mpc and gmp as well).
But once I launch:
make -j4
I get the following error:
checking for suffix of object files... configure: error: in `/mnt/LFS/source/gcc-4.6.2/x86_64-lfs-linux-gnu/libgcc':
configure: error: cannot compute suffix of object files: cannot compile
See `config.log' for more details.
make[1]: *** [configure-target-libgcc] Error 1
I tried to google for it and tried the solutions I found but nothing worked. Does anyone know why I get this error?
This issue is caused by dyanmic link library path issue when the test programs try to link against libmpc/libmpfr/libgmp.
Append below environment variable to allow ld link against the correct so file:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path/to/mpc/lib/
Then try build gcc again.
"Building GCC is not trivial, but is not difficult if you follow the instructions carefully.
Many people rush into trying to build it without reading the installation docs properly and make one or more of these common mistakes:
do not run ./configure from gcc src dir (this is not supported) => you need to run configure from outside the gcc source directory
Note: if GCC links dynamically to the prerequisite libs (GMP/MPFR/MPC) then the shared libraries must be in the dynamic linker's path (LD_LIBRARY_PATH), both when building gcc and when using the installed compiler."
Simple example (without dynamic link to GMP/MPFR/MPC):
tar xzf gcc-4.8.0.tar.gz
cd gcc-4.8.0
./contrib/download_prerequisites
cd ..
mkdir objdir
cd objdir
$PWD/../gcc-4.8.0/configure --prefix=/opt/gcc-4.8.0
make
make install
Sources:
Advogato Doc -
GNU Doc
This error message can arise from a number of different reasons. The best way to figure out which one is to check the logfile '/home/manu/gcc/gcc/i686-pc-linux-gnu/libgcc/config.log' in the example below. Or in the original posters case '/mnt/LFS/source/gcc-4.6.2/x86_64-lfs-linux-gnu/libgcc' and look for the last error line.
Quoting GCC FAQ: http://gcc.gnu.org/wiki/FAQ#configure_suffix
Like any of the GNU projects, GCC is using the GNU autotools to
commonly configure the compilation for the specifics of the build
system. The configure script thereby uses small test programs -
usually called conftest.c - to test if certain functions and/or
features are available. If the compilation of such a test program
fails, you'll see an error message like:
checking for suffix of object files... configure: error: in
`/home/manu/gcc/gcc/i686-pc-linux-gnu/libgcc': configure: error:
cannot compute suffix of object files: cannot compile See `config.log'
for more details. make[2]: *** [configure-stage1-target-libgcc] Error
1 make[2]: Leaving directory `/home/manu/gcc/gcc'
This error message is quite misleading and frequently the problem has
nothing to do with the message. You have to check the file
'config.log' in the directory where the error occurred. In the example
above, you would have to check the 'config.log' file in the directory
'/home/manu/gcc/gcc/i686-pc-linux-gnu/libgcc'. There might be several
test programs that failed during the configuration, but some of these
failures are non-critical. Check for the last error entry in the file.
Common causes for this error message are:
Required libraries for the GCC build are missing, specifically MPFR,
GMP and MPC. If installed as shared libraries they must be in the
runtime linker's search path so they can be found. Please, follow the
instructions in the answer to Why does my ./configure and make fail?
The compiler crashed. For example, if there is an error such as
'conftest.c: internal compiler error:', this indicates a bug in the
compiler. If you are using an unmodified version of GCC, please follow
the procedure to report the bug.
This happens while creating a cross-compiler.
It's not referring to the top-level config.log, but $LFS_TGT/libgcc/config.log.
For me, in there, it says:
configure:3566: /foo/gcc/build/./gcc/xgcc -B/foo/gcc/build/./gcc/ -B/opt/gcc-cross-11.1.0/aarch64-none-elf/bin/ -B/opt/gcc-cross-11.1.0/aarch64-none-elf/lib/ -isystem /opt/gcc-cross-11.1.0/aarch64-none-elf/include -isystem /opt/gcc-cross-11.1.0/aarch64-none-elf/sys-include -o conftest -g -O2 conftest.c >&5
conftest.c:9:10: fatal error: stdio.h: No such file or directory
9 | #include <stdio.h>
| ^~~~~~~~~
compilation terminated.
configure:3569: $? = 1
configure:3782: checking for suffix of object files
configure:3804: /foo/gcc/build/./gcc/xgcc -B/foo/gcc/build/./gcc/ -B/opt/gcc-cross-11.1.0/aarch64-none-elf/bin/ -B/opt/gcc-cross-11.1.0/aarch64-none-elf/lib/ -isystem /opt/gcc-cross-11.1.0/aarch64-none-elf/include -isystem /opt/gcc-cross-11.1.0/aarch64-none-elf/sys-include -c -g -O2 conftest.c >&5
/foo/gcc/build/./gcc/as: line 106: exec: -E: invalid option
exec: usage: exec [-cl] [-a name] [command [arguments ...]] [redirection ...]
configure:3808: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "GNU C Runtime Library"
| #define PACKAGE_TARNAME "libgcc"
| #define PACKAGE_VERSION "1.0"
| #define PACKAGE_STRING "GNU C Runtime Library 1.0"
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL "http://www.gnu.org/software/libgcc/"
| /* end confdefs.h. */
|
| int
| main ()
| {
|
| ;
| return 0;
| }
configure:3822: error: in `/foo/gcc/build/aarch64-none-elf/libgcc':
configure:3824: error: cannot compute suffix of object files: cannot compile
See `config.log' for more details
Was your logfile similar?
It's my belief that the gcc compilation/installation process will take the various includes, run them through fixincludes to fix problems and tailor them to the target arch. The expected file is not present.
Referring to the Prerequisites page, I believe this section is relevant (emphasis mine):
C standard library and headers
In order to build GCC, the C standard library and headers must be present for all
target variants for which target libraries will be built (and not only the variant
of the host C++ compiler).
This affects the popular ‘x86_64-pc-linux-gnu’ platform (among other multilib
targets), for which 64-bit (‘x86_64’) and 32-bit (‘i386’) libc headers are usually
packaged separately. If you do a build of a native compiler on ‘x86_64-pc-linux-gnu’,
make sure you either have the 32-bit libc developer package properly installed (the
exact name of the package depends on your distro) or you must build GCC as a 64-bit
only compiler by configuring with the option --disable-multilib. Otherwise, you may
encounter an error such as ‘fatal error: gnu/stubs-32.h: No such file’
I believe that the solution is to obtain headers for the TARGET platform.
The problem is the assembler, "as" is missing. Build and install binutils for the target first.
In my case it was:
export LD_LIBRARY_PATH=/usr/mpc-082/lib:/usr/gmp501/lib:/usr/libelf0812/lib
Whereas each of the above library is the destination of what additional libraries you installed appended with /lib at the end.
Example: Lib-MPC:
1) Downloaded onto /usr/src/libmpc-src
2) cd into /usr/src/mpc-082
3) ../configure --prefix=/usr/mpc-082
4) make
5) make install
6) once installed, verify that you have the new libs installed under /usr/mpc-082-lib
7) add it to your LD_LIBRARY_PATH by doing:
export LD_LIBRARY_PATH=/usr/mpc-082/lib:$LD_LIBDADY_PATH
8) Repeat the same with your LibELF, and LibGMP
9) Go back and compile your GCC, should work after this.
Cheers
H

node.js cygwin windows xp error ./configure

I already did ash.exe /bin/rebaseall -v without errors but I still get the following error when trying to ./configure:
Checking for program g++ or c++ : /usr/bin/g++
/node/wscript:232: error: could not configure a cxx compiler
I installed gcc4-g++ 4.5.x, openssl and all the needed dependencies.
Are you carefully following the steps from: github.com/joyent/node/wiki/Building-node.js-on-Cygwin-(Windows) ?
It suggests running another command and then rebooting after rebase.

Resources