Need help on LFS-7.10 Pass2 binutils configure error - linux-from-scratch

I have been working on resolving issues in build scripts that were built based on LFS a few years
back. I tried over the last week and tried multiple versions and solutions from different sites.
Learned a lot as I put more effort. I need your help as I couldn't get the reason behind the issue.
Based on LFS, pass 1 completed and dummy.c file execution was a success. Then I get the error in
binutils in pass 2.
http://www.linuxfromscratch.org/lfs/view/7.10-systemd/chapter05/binutils-pass2.html GCC 6.2.0
binutils 2.27
glibc 2.24
Edit:
Let me try with a recent version of LFS as suggested
train#ubuntu:~$ uname -a Linux ubuntu 4.15.0-112-generic #113~16.04.1-Ubuntu SMP Fri Jul 10 04:37:08
UTC 2020 x86_64 x86_64 x86_64 GNU/Linux train#ubuntu:~$ gcc --version gcc (Ubuntu 5.4.0-
6ubuntu1~16.04.12) 5.4.0 20160609 train#ubuntu:~$ ldd --version ldd (Ubuntu GLIBC 2.23-0ubuntu11.2)
2.23
train#ubuntu:~$ gcc dummy.c train#ubuntu:~$ readelf -l a.out | grep linux [Requesting program
interpreter: /lib64/ld-linux-x86-64.so.2] train#ubuntu:~$ /tools/bin/x86_64-tc-linux-gnu-gcc dummy.c
train#ubuntu:~$ readelf -l a.out | grep linux [Requesting program interpreter: /tools/lib64/ld-linux-
x86-64.so.2]
cd binutils-2.27-compile; CXXFLAGS="-O2 -m64 -fPIC" CFLAGS="-O2 -m64 -fPIC" CC=x86_64-tc-linux-gnu-gcc
AR=x86_64-tc-linux-gnu-ar RANLIB=x86_64-tc-linux-gnu-ranlib ../binutils-2.27/configure --prefix=/tools
******* Contents from config log **************
configure:2297: checking build system type
configure:2311: result: x86_64-pc-linux-gnu
configure:2358: checking host system type
configure:2371: result: x86_64-pc-linux-gnu
configure:2391: checking target system type
configure:2404: result: x86_64-pc-linux-gnu
configure:2458: checking for a BSD-compatible install
configure:2526: result: /usr/bin//install -c
configure:2537: checking whether ln works
configure:2559: result: yes
configure:2563: checking whether ln -s works
configure:2567: result: yes
configure:2574: checking for a sed that does not truncate output
configure:2638: result: /bin/sed
configure:2647: checking for gawk
configure:2663: found /usr/bin//gawk
configure:2674: result: gawk
configure:4121: checking for gcc
configure:4148: result: x86_64-tc-linux-gnu-gcc
configure:4377: checking for C compiler version
configure:4386: x86_64-tc-linux-gnu-gcc --version >&5
x86_64-tc-linux-gnu-gcc (GCC) 6.2.0
Copyright (C) 2016 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.
configure:4397: $? = 0
configure:4386: x86_64-tc-linux-gnu-gcc -v >&5
Using built-in specs.
COLLECT_GCC=x86_64-tc-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/home/train/swe/distrib/tools/bin/../libexec/gcc/x86_64-tc-linux-gnu/6.2.0/lto-
wrapper
Target: x86_64-tc-linux-gnu
Configured with: ../gcc-6.2.0/configure --prefix=/tools --target=x86_64-tc-linux-gnu --prefix=/tools
--with-sysroot=/home/train/swe/distrib --with-newlib --without-headers --with-local-prefix=/tools --
with-native-system-header-dir=/tools/include --disable-nls --disable-shared --disable-multilib --
disable-decimal-float --disable-threads --disable-libmudflap --disable-libssp --disable-libatomic --
disable-libstdcxx --disable-libmpx --disable-libgomp --disable-libvtv --disable-libquadmath --enable-
languages=c,c++
Thread model: single
gcc version 6.2.0 (GCC)
configure:4397: $? = 0
configure:4386: x86_64-tc-linux-gnu-gcc -V >&5
x86_64-tc-linux-gnu-gcc: error: unrecognized command line option '-V'
x86_64-tc-linux-gnu-gcc: fatal error: no input files
compilation terminated.
configure:4397: $? = 1
configure:4386: x86_64-tc-linux-gnu-gcc -qversion >&5
x86_64-tc-linux-gnu-gcc: error: unrecognized command line option '-qversion'; did you mean '--
version'?
x86_64-tc-linux-gnu-gcc: fatal error: no input files
compilation terminated.
configure:4397: $? = 1
configure:4417: checking for C compiler default output file name
configure:4439: x86_64-tc-linux-gnu-gcc -O2 -m64 -fPIC conftest.c >&5
configure:4443: $? = 0
configure:4480: result: a.out
configure:4496: checking whether the C compiler works
configure:4505: ./a.out
../binutils-2.27/
configure: line 4507: 87493 Segmentation fault (core dumped) ./$ac_file
configure:4509: $? = 139
configure:4516: error: in `/home/train/swe/distrib/build/sources/binutils/binutils-2.27-compile':
configure:4520: error: cannot run C compiled programs.
If you meant to cross compile, use --host'. See config.log' for more details.
Would appreciate any help on this

Related

Error and Build Failed while setting up mediapipe on Raspberry Pi 4 (Raspbian OS 64 bit)

I am new to both Raspberry Pi and Mediapipe. I was following these steps: https://spyjetson.blogspot.com/2021/06/installing-mediapipecpu-mode-on.html
But on this step: root#raspberrypi:/usr/local/src/mediapipe# python3 setup.py bdist_wheel
I am getting error and build failed
Error is this:
ERROR: /usr/local/src/mediapipe/mediapipe/framework/stream_handler/BUILD:95:11: C++ compilation of rule '//mediapipe/framework/stream_handler:default_input_stream_handler' failed (Exit 1): gcc failed: error executing command /usr/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -g0 -O2 '-D_FORTIFY_SOURCE=1' -DNDEBUG -ffunction-sections ... (remaining 55 argument(s) skipped)
Use --sandbox_debug to see verbose messages from the sandbox gcc failed: error executing command /usr/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -g0 -O2 '-D_FORTIFY_SOURCE=1' -DNDEBUG -ffunction-sections ... (remaining 55 argument(s) skipped)
Use --sandbox_debug to see verbose messages from the sandbox
In file included from <command-line>:
/usr/include/stdc-predef.h: In substitution of 'template<class _Functor, class, class> std::function<std::unique_ptr<mediapipe::InputStreamHandler>(std::shared_ptr<mediapipe::tool::TagMap>, mediapipe::CalculatorContextManager*, const mediapipe::MediaPipeOptions&, bool)>::function(_Functor) [with _Functor = <missing>; <template-parameter-1-2> = <missing>; <template-parameter-1-3> = <missing>]':
mediapipe/framework/stream_handler/default_input_stream_handler.cc:24:1: required from here
/usr/include/stdc-predef.h:32:94: internal compiler error: Segmentation fault
32 | whether the overall intent is to support these features; otherwise,
| ^
0x7fa3cab217 __libc_start_main
../csu/libc-start.c:308
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <file:///usr/share/doc/gcc-10/README.Bugs> for instructions.
Target //mediapipe/modules/face_detection:face_detection_short_range_cpu failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 853.907s, Critical Path: 792.14s
INFO: 990 processes: 130 internal, 860 linux-sandbox.
FAILED: Build did NOT complete successfully
In my case it was a GCC issue. I downgraded from 10 to 9 and it compiled.
sudo apt install gcc-9 g++-9
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 100 --slave /usr/bin/g++ g++ /usr/bin/g++-9 --slave /usr/bin/gcov gcov /usr/bin/gcov-9

Error installing postgresql with homebrew

When I run brew install postgresql I get this as an error message:
Last 15 lines from /Users/admin/Library/Logs/Homebrew/icu4c/02.make:
./formatted_string_builder.h:227:9: note: subexpression not valid in a constant expression
U_ASSERT(category <= 0xf),
^
../common/uassert.h:35:26: note: expanded from macro 'U_ASSERT'
# define U_ASSERT(exp) void()
^
./formatted_string_builder.h:240:64: note: in call to 'Field(0, 1)'
constexpr FormattedStringBuilder::Field kGeneralNumericField = {UFIELD_CATEGORY_UNDEFINED, 1};
^
3 errors generated.
*** Failed compilation command follows: ----------------------------------------------------------
clang++ -DU_ATTRIBUTE_DEPRECATED= -DU_I18N_IMPLEMENTATION -DU_HAVE_STRTOD_L=1 -DU_HAVE_XLOCALE_H=1 -I. -I../common -O2 -W -Wall -pedantic -Wpointer-arith -Wwrite-strings -Wno-long-long -std=c++11 -Qunused-arguments -Wno-parentheses-equality -Wglobal-constructors -fvisibility=hidden -fno-common -c -MMD -MT numfmt.d numfmt.o numfmt.ao -o numfmt.ao numfmt.cpp
--- ( rebuild with "/Library/Developer/CommandLineTools/usr/bin/make VERBOSE=1 all" to show all parameters ) --------
make[1]: *** [numfmt.ao] Error 1
make: *** [all-recursive] Error 2
Do not report this issue to Homebrew/brew or Homebrew/core!
These open issues may also help:
icu4c 67.1 (make C++14 compatible) https://github.com/Homebrew/homebrew-core/pull/59540
Error: You are using macOS 10.10.
We (and Apple) do not provide support for this old version.
You will encounter build failures with some formulae.
Please create pull requests instead of asking for help on Homebrew's GitHub,
Discourse, Twitter or IRC. You are responsible for resolving any issues you
experience while you are running this old version.
I have tried brew update (I am already up to date), and the only issue brew doctor gives me is that there are unexpected header files.
I am using
OSX Yosemite 10.10.5
Homebrew 2.4.12

Install postgresql with Homebrew does not work

I tried to install PostgreSQL on my mac book with homebrew.
brew install postgresql
But I couldn't install it and got these error messages.
Does anyone know what is the solution for this issue?
./formatted_string_builder.h:227:9: note: subexpression not valid in a constant expression
U_ASSERT(category <= 0xf),
^
../common/uassert.h:35:26: note: expanded from macro 'U_ASSERT'
# define U_ASSERT(exp) void()
^
./formatted_string_builder.h:240:64: note: in call to 'Field(0, 1)'
constexpr FormattedStringBuilder::Field kGeneralNumericField = {UFIELD_CATEGORY_UNDEFINED, 1};
^
3 errors generated.
*** Failed compilation command follows: ----------------------------------------------------------
clang++ -DU_ATTRIBUTE_DEPRECATED= -DU_I18N_IMPLEMENTATION -DU_HAVE_STRTOD_L=1 -DU_HAVE_XLOCALE_H=1 -DU_HAVE_STRING_VIEW=1 -I. -I../common -O2 -W -Wall -pedantic -Wpointer-arith -Wwrite-strings -Wno-long-long -std=c++11 -Qunused-arguments -Wno-parentheses-equality -Wglobal-constructors -fvisibility=hidden -fno-common -c -MMD -MT numfmt.d numfmt.o numfmt.ao -o numfmt.ao numfmt.cpp
--- ( rebuild with "/Library/Developer/CommandLineTools/usr/bin/make VERBOSE=1 all" to show all parameters ) --------
make[1]: *** [numfmt.ao] Error 1
make: *** [all-recursive] Error 2
Do not report this issue to Homebrew/brew or Homebrew/core!
Error: You are using macOS 10.12.
We (and Apple) do not provide support for this old version.
You will encounter build failures with some formulae.
Please create pull requests instead of asking for help on Homebrew's GitHub,
Discourse, Twitter or IRC. You are responsible for resolving any issues you
experience while you are running this old version.
You need icu4c, The currently the version of icu4c written in Homebrew's Fomula is 67.1, and macOS is required to be High Sierra (10.13) or higher.

linking problem, can't find symbol even though nm shows symbol in library

I'm linking an app against lflutter_linux_glfw. nm tools shows it has glad_glTexImage2D:
nm libflutter_linux_glfw.so | grep glTexImage2D
00000000034e87a0 b glad_glTexImage2D
00000000034e87a8 b glad_glTexImage2DMultisample
So I included lflutter_linux_glfw.so before flutter_video_renderer.o, and I get this:
clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/7
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/7.4.0
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.4.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/7.4.0
Candidate multilib: .;#m64
Selected multilib: .;#m64
"/usr/bin/ld" -z relro --hash-style=gnu --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o /home/dev/orwell/orwell_flutter/linux/../build/linux/debug/flutter_desktop_example
/usr/bin/../lib/gcc/x86_64-linux-gnu/7.4.0/../../../x86_64-linux-gnu/crt1.o /usr/bin/../lib/gcc/x86_64-linux-gnu/7.4.0/../../../x86_64-linux-gnu/crti.o /usr/bin/../lib/gcc/x86_64-linux-gnu/7.4.0/crtbegin.o
-L/home/dev/orwell/orwell_flutter/linux/../build/linux/debug/lib -L/usr/bin/../lib/gcc/x86_64-linux-gnu/7.4.0 -L/usr/bin/../lib/gcc/x86_64-linux-gnu/7.4.0/../../../x86_64-linux-gnu -L/lib/x86_64-linux-gnu
-L/lib/../lib64 -L/usr/lib/x86_64-linux-gnu -L/usr/bin/../lib/gcc/x86_64-linux-gnu/7.4.0/../../.. -L/usr/lib/llvm-6.0/bin/../lib -L/lib -L/usr/lib -lflutter_linux_glfw
/home/dev/orwell/orwell_flutter/linux/../build/linux/obj/main.o /home/dev/orwell/orwell_flutter/linux/../build/linux/obj/flutter/generated_plugin_registrant.o
/home/dev/orwell/orwell_flutter/linux/../build/linux/obj//home/dev/orwell/orwell_flutter/linux/flutter/ephemeral/cpp_client_wrapper_glfw/flutter_window_controller.o
/home/dev/orwell/orwell_flutter/linux/../build/linux/obj//home/dev/orwell/orwell_flutter/linux/flutter/ephemeral/cpp_client_wrapper_glfw/plugin_registrar.o
/home/dev/orwell/orwell_flutter/linux/../build/linux/obj//home/dev/orwell/orwell_flutter/linux/flutter/ephemeral/cpp_client_wrapper_glfw/engine_method_result.o
/home/dev/orwell/orwell_flutter/linux/../build/linux/obj//home/dev/orwell/orwell_flutter/linux/flutter/ephemeral/cpp_client_wrapper_glfw/standard_codec.o
/home/dev/orwell/orwell_flutter/linux/../build/linux/obj//home/dev/orwell/orwell_flutter/common/src/flutter_video_renderer.o
/home/dev/orwell/orwell_flutter/linux/../build/linux/obj//home/dev/orwell/orwell_flutter/common/src/flutter_texture_video_renderer.o
/home/dev/orwell/orwell_flutter/linux/../build/linux/obj//home/dev/orwell/orwell_flutter/common/src/flutter_orwell_plugin.o "-rpath=\$ORIGIN/lib" -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc
/usr/bin/../lib/gcc/x86_64-linux-gnu/7.4.0/crtend.o /usr/bin/../lib/gcc/x86_64-linux-gnu/7.4.0/../../../x86_64-linux-gnu/crtn.o
/home/dev/orwell/orwell_flutter/linux/../build/linux/obj//home/dev/orwell/orwell_flutter/common/src/flutter_texture_video_renderer.o: In function
`flutter_orwell_plugin::FlutterTextureVideoRenderer::renderToTexture(unsigned long, unsigned long, unsigned int)':
flutter_texture_video_renderer.cc:(.text+0x1b6): undefined reference to `glad_glTexImage2D'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [/home/dev/orwell/orwell_flutter/linux/../build/linux/debug/flutter_desktop_example] Error 1
In other words, it complains there's no reference to glad_glTexImage2D even though it it indeed in
flutter_linux_glfw.so. I also tried adding flutter_linux_glfw.so after the flutter_texture_video_renderer.o but I get the same error
nm libflutter_linux_glfw.so | grep glTexImage2D
00000000034e87a0 b glad_glTexImage2D
00000000034e87a8 b glad_glTexImage2DMultisample
These symbols are local to the library (not exported from it).
You can see the list of exported symbols with:
nm -D libflutter_linux_glfw.so
You will observe that glad_glTexImage2D is not listed there.
P.S.
I included lflutter_linux_glfw.so before flutter_video_renderer.o
This is the opposite order of what you are supposed to do: libraries should follow the objects that refer to them (though this doesn't really matter for shared libraries).

bdw-gc install failed on lion with brew

i am install w3m with brew on lion. when i use the origin formula the installation is filed.
then i following the issues 7068 of homebrew update the bdw-gc.rb formula script
require 'formula'
class BdwGc < Formula
# url 'http://www.hpl.hp.com/personal/Hans_Boehm/gc/gc_source/gc-7.1.tar.gz'
url 'http://www.hpl.hp.com/personal/Hans_Boehm/gc/gc_source/gc-7.2alpha6.tar.gz'
homepage 'http://www.hpl.hp.com/personal/Hans_Boehm/gc/'
# 7.1
# md5 '2ff9924c7249ef7f736ecfe6f08f3f9b'
# 7.2alpha6
md5 '319d0b18cc4eb735c8038ece9df055e4'
fails_with_llvm "LLVM gives an unsupported inline asm error", :build => 2335
def install
# ucontext has been deprecated in 10.6
# use this flag to force the header to compile
# ENV.append 'CPPFLAGS', "-D_XOPEN_SOURCE" if MacOS.snow_leopard?
ENV.append 'CPPFLAGS', "-D_XOPEN_SOURCE"# if MacOS.snow_leopard?
system "./configure", "--disable-debug", "--disable-dependency-tracking",
"--prefix=#{prefix}"
system "make install"
end
end
and reinstall it, but it's still failed. here is the install log
brew install bdw-gc
==> Downloading http://www.hpl.hp.com/personal/Hans_Boehm/gc/gc_source/gc-7.2alp
File already downloaded in /Users/akira/Library/Caches/Homebrew
==> ./configure --disable-debug --prefix=/usr/local/Cellar/bdw-gc/6
==> make install
........
libtool: compile: /usr/bin/llvm-gcc -DHAVE_CONFIG_H -I./include -I./include -I./libatomic_ops/src -I./libatomic_ops/src -D_XOPEN_SOURCE -fexceptions -O3 -march=core2 -w -pipe -c obj_map.c -o obj_map.o >/dev/null 2>&1
/bin/sh ./libtool --tag=CC --mode=compile /usr/bin/llvm-gcc -DHAVE_CONFIG_H -I./include -I./include -I./libatomic_ops/src -I./libatomic_ops/src -D_XOPEN_SOURCE -fexceptions -O3 -march=core2 -w -pipe -c -o pcr_interface.lo pcr_interface.c
./libatomic_ops/src/atomic_ops/sysdeps/gcc/x86_64.h: In function 'AO_test_and_set_full':
./libatomic_ops/src/ato==> Exit Status: 2
http://github.com/mxcl/homebrew/blob/master/Library/Formula/bdw-gc.rb#L22
==> Environment
HOMEBREW_VERSION: 0.8
HEAD: bc90bd554da6bd1199bdec92a830edbca24fa34e
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
HOMEBREW_REPOSITORY: /usr/local
HOMEBREW_LIBRARY_PATH: /usr/local/Library/Homebrew
Hardware: quad-core 64-bit sandybridge
OS X: 10.7.2
Kernel Architecture: x86_64
Ruby: 1.8.7-249
/usr/bin/ruby => /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
Xcode: 4.2
GCC-4.0: N/A
GCC-4.2: build 5666
LLVM: build 2336
MacPorts or Fink? false
X11 installed? true
==> Build Flags
CC: /usr/bin/llvm-gcc => /usr/llvm-gcc-4.2/bin/llvm-gcc-4.2
CXX: /usr/bin/llvm-g++ => /usr/llvm-gcc-4.2/bin/llvm-g++-4.2
LD: /usr/bin/llvm-gcc => /usr/llvm-gcc-4.2/bin/llvm-gcc-4.2
CFLAGS: -O3 -march=core2 -w -pipe
CXXFLAGS: -O3 -march=core2 -w -pipe
CPPFLAGS: -D_XOPEN_SOURCE
MAKEFLAGS: -j4
Error: Failed executing: make install
These existing issues may help you:
https://github.com/mxcl/homebrew/issues/7068
Otherwise, please report the bug:
https://github.com/mxcl/homebrew/wiki/checklist-before-filing-a-new-issue
any suggestion?
this problem was fixed by Jack Nagel at Nov 15, 2011.
see the detail
bdw-gc: add 7.2alpha6 as the '--devel' version
but this batch still got a problem. the "make check" step does not works,so you can just skip this step and "make install".