Compiling 32 bit GLIBC - Missing object is circular reference - gcc

On CentOS 6.4 64-bit system I am trying to build a 32-bit version of GLIBC (2.18). Using yum I installed a 32-bit version of the GCC library in /lib. I use a directory named GLIBC32 for my build. After trial and research I settled on these options:
--prefix=/usr/local/lib32 --exec-prefix=/usr/local/bin32 --build=i686-pc-linux-gnu CC="gcc -m32" CXX="gxx -m32"
A lot of the build is successful except it seems that SUNRPC components need objects (crt1.o) and libraries being created by the build. If I had the GLIBC library objects SUNRPC wants I wouldn't need to build the library!!!!
*If I stop and copy crt1.o into /lib, then the build complains about libc.so. ANY SUGGESTIONS APPRECIATED. THANKS*
gcc -m32 /home/oracle/tmp/glibc32/sunrpc/cross-rpc_main.o /home/oracle/tmp/glibc32/sunrpc/cross-rpc_hout.o /home/oracle/tmp/glibc32/sunrpc/cross-rpc_cout.o /home/oracle/tmp/glibc32/sunrpc/cross-rpc_parse.o /home/oracle/tmp/glibc32/sunrpc/cross-rpc_scan.o /home/oracle/tmp/glibc32/sunrpc/cross-rpc_util.o /home/oracle/tmp/glibc32/sunrpc/cross-rpc_svcout.o /home/oracle/tmp/glibc32/sunrpc/cross-rpc_clntout.o /home/oracle/tmp/glibc32/sunrpc/cross-rpc_tblout.o /home/oracle/tmp/glibc32/sunrpc/cross-rpc_sample.o -o /home/oracle/tmp/glibc32/sunrpc/cross-rpcgen
/usr/bin/ld: crt1.o: No such file: No such file or directory
collect2: ld returned 1 exit status
make[2]: * [/home/oracle/tmp/glibc32/sunrpc/cross-rpcgen] Error 1
make[2]: Leaving directory /home/oracle/tmp/glibc-2.18/sunrpc'
make[1]: *** [sunrpc/others] Error 2
make[1]: Leaving directory/home/oracle/tmp/glibc-2.18'
make: * [all] Error 2
Here are the contents of /lib
[oracle#qawebtech glibc32]$ ls -l /lib
total 156
drwxr-xr-x. 3 root root 4096 Oct 18 19:53 alsa
lrwxrwxrwx. 1 root root 14 Oct 18 19:53 cpp -> ../usr/bin/cpp
drwxr-xr-x. 3 root root 4096 Oct 18 19:57 crda
drwxr-xr-x. 43 root root 4096 Oct 18 20:21 firmware
drwxr-xr-x. 6 root root 4096 Oct 18 19:56 kbd
-rwxr-xr-x. 1 root root 120672 Feb 21 2013 libgcc_s-4.4.7-20120601.so.1
lrwxrwxrwx. 1 root root 28 Oct 26 00:39 libgcc_s.so.1 -> libgcc_s-4.4.7-20120601.so.1
drwxr-xr-x. 2 root root 4096 Oct 18 19:57 lsb
dr-xr-xr-x. 4 root root 4096 Oct 18 20:20 modules
drwxr-xr-x. 2 root root 4096 Feb 21 2013 security
drwxr-xr-x. 6 root root 4096 Oct 18 19:52 terminfo
drwxr-xr-x. 5 root root 4096 Oct 26 03:49 udev

There is another less painful way to obtain the 32 bit libraries for Centos 6.4. You can download the i386 RPMs from the Centos repository (http://mirror.centos.org). Then use rpm to install them into a new root. Once you have the library files, move them into /lib and your 32 bit app will be able to find them. You might have to manually repair some links. See this link for details about downloading RPMs into a new root.
How to build a chroot jail for Centos
GLIBC is not really set up to be built on an already existing system unless you are cross-compiling.

Related

error: Failed dependencies: /usr/lib/libc.so is needed by devtoolset-8-systemtap-testsuite-3.3-1.el7.x86_64

I was trying to install devtoolset-8 in my slave node with no active internet connection running centos7. I am using all .rpm packages required as dependencies.
During installation through rpm -ivh * I get
[root#node3 install]# rpm -ivh *
warning: dejagnu-1.5.1-3.el7.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
warning: devtoolset-8-8.0-2.el7.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID f2ee9d55: NOKEY
warning: package devtoolset-8-8.0-2.el7.x86_64 was already added, replacing with devtoolset-8-8.1-1.el7.x86_64
warning: package devtoolset-8-build-8.0-2.bs1.el7.x86_64 was already added, replacing with devtoolset-8-build-8.0-2.el7.x86_64
warning: package devtoolset-8-build-8.0-2.el7.x86_64 was already added, replacing with devtoolset-8-build-8.1-1.el7.x86_64
warning: package devtoolset-8-8.1-1.el7.x86_64 was already added, skipping devtoolset-8-dockerfiles-8.0-2.bs1.el7.x86_64
warning: package devtoolset-8-8.1-1.el7.x86_64 was already added, skipping devtoolset-8-dockerfiles-8.0-2.el7.x86_64
warning: package devtoolset-8-perftools-8.0-2.bs1.el7.x86_64 was already added, replacing with devtoolset-8-perftools-8.0-2.el7.x86_64
warning: package devtoolset-8-perftools-8.0-2.el7.x86_64 was already added, replacing with devtoolset-8-perftools-8.1-1.el7.x86_64
warning: package devtoolset-8-runtime-8.0-2.bs1.el7.x86_64 was already added, replacing with devtoolset-8-runtime-8.0-2.el7.x86_64
warning: package devtoolset-8-runtime-8.0-2.el7.x86_64 was already added, replacing with devtoolset-8-runtime-8.1-1.el7.x86_64
warning: package devtoolset-8-toolchain-8.0-2.bs1.el7.x86_64 was already added, replacing with devtoolset-8-toolchain-8.0-2.el7.x86_64
warning: package devtoolset-8-toolchain-8.0-2.el7.x86_64 was already added, replacing with devtoolset-8-toolchain-8.1-1.el7.x86_64
error: Failed dependencies:
/usr/lib/libc.so is needed by devtoolset-8-systemtap-testsuite-3.3-1.el7.x86_64
output of locate libc.so is as follows
[root#node3 install]# locate libc.so
/opt/intel/advisor_2018.1.1.535164/lib32/pinruntime/glibc/libc.so.6
/opt/intel/advisor_2018.1.1.535164/lib64/pinruntime/glibc/libc.so.6
/usr/lib/libc.so
/usr/lib/libc.so.6
/usr/lib/x86_64-redhat-linux6E/lib64/libc.so
/usr/lib64/libc.so
/usr/lib64/libc.so.6
[root#node3 install]#
The details of lib and lib64 libc.so is as follows
[root#node3 install]# ll /usr/lib64/libc.so*
-rw-r--r--. 1 root root 253 Nov 5 2016 /usr/lib64/libc.so
lrwxrwxrwx. 1 root root 12 Oct 13 2017 /usr/lib64/libc.so.6 -> libc-2.17.so
[root#node3 install]# ll /usr/lib/libc.so*
lrwxrwxrwx 1 root root 18 Dec 16 16:45 /usr/lib/libc.so -> /usr/lib64/libc.so
lrwxrwxrwx 1 root root 23 Dec 16 17:35 /usr/lib/libc.so.6 -> /usr/lib64/libc-2.17.so
I need updated gcc , and only way is I found it through devtoolset. please suggest any possible solution that does not require active internet connectivity.
Thank you
Are you sure you need to install devtoolset-8-systemtap-testsuite? This package is only needed for testing Systemtap (not even using Systemtap).
Apart from that, these symbolic links are very unusual and suggest that something is broken with the system:
lrwxrwxrwx 1 root root 18 Dec 16 16:45 /usr/lib/libc.so -> /usr/lib64/libc.so
lrwxrwxrwx 1 root root 23 Dec 16 17:35 /usr/lib/libc.so.6 -> /usr/lib64/libc-2.17.so
/usr/lib/libc.so should be a linker script for linking with the 32-bit version of glibc. It is installed by the glibc-devel.i686 package.

Building binutils on ARM64 - make check fails - section ordering

Compiling binutils-2.33.1 for ARM64 (aarch64*--).
The build passes but I'm getting strange issues in some programs. GNU MP for example core dumps when building its generator. Handling of long's seem broken.
When I run make check on the binutils-2.33.1 build. There is only 3 unexpected failures. They definitely stands out:
Running /custom_toolchain/binutils-2.33.1/binutils/testsuite/binutils-all/aarch64/aarch64.exp ...
FAIL: Check if disassembler can handle all sections in default order
FAIL: Check if disassembler can handle all sections in different order than header
Running /custom_toolchain/binutils-2.33.1/binutils/testsuite/binutils-all/objdump.exp ...
Version /custom_toolchain/build/binutils/objdump 2.33.1
FAIL: build-id-debuglink (grepping for source file name in disassembly output)
Can I safely ignore these failures? If not, any thought to the cause?
You should not ignore those failures. If you have access to a linux x86_64 system, you could cross-compile binutils 2.33.1 using a toolchain that can be trusted, such as a gcc toolchain from either Linaro or Arm: The root cause may be a defective tool on your Aarch64 system.
A procedure for cross-compiling binutils on a linux x86_64 system would be:
wget https://mirror.csclub.uwaterloo.ca/gnu/binutils/binutils-2.33.1.tar.xz
wget https://releases.linaro.org/components/toolchain/binaries/7.5-2019.12/aarch64-linux-gnu/gcc-linaro-7.5.0-2019.12-i686_aarch64-linux-gnu.tar.xz
tar Jxf binutils-2.33.1.tar.xz
tar Jxf aarch64-linux-gnu/gcc-linaro-7.5.0-2019.12-i686_aarch64-linux-gnu.tar.xz
export CROSS_COMPILE=$(pwd)/gcc-linaro-7.5.0-2019.12-i686_aarch64-linux-gnu/bin/aarch64-linux-gnu-
export PREFIX=$(pwd)/binutils-2.33.1-aarch64-linux-gnu
mkdir binutils
cd binutils
../binutils-2.33.1/configure --host=aarch64-linux-gnu --with-static-standard-libraries --program-prefix=aarch64-linux-gnu- --prefix=${PREFIX}
make all install
cd -
ls -Gg binutils-2.33.1-aarch64-linux-gnu/bin/
total 98316
-rwxr-xr-x 1 5744720 Dec 13 23:41 aarch64-linux-gnu-addr2line
-rwxr-xr-x 2 5926304 Dec 13 23:41 aarch64-linux-gnu-ar
-rwxr-xr-x 2 8713560 Dec 13 23:41 aarch64-linux-gnu-as
-rwxr-xr-x 1 5696976 Dec 13 23:41 aarch64-linux-gnu-c++filt
-rwxr-xr-x 1 108784 Dec 13 23:41 aarch64-linux-gnu-elfedit
-rwxr-xr-x 1 6314920 Dec 13 23:41 aarch64-linux-gnu-gprof
-rwxr-xr-x 4 9739912 Dec 13 23:42 aarch64-linux-gnu-ld
-rwxr-xr-x 4 9739912 Dec 13 23:42 aarch64-linux-gnu-ld.bfd
-rwxr-xr-x 2 5789736 Dec 13 23:41 aarch64-linux-gnu-nm
-rwxr-xr-x 2 6529712 Dec 13 23:41 aarch64-linux-gnu-objcopy
-rwxr-xr-x 2 9437264 Dec 13 23:41 aarch64-linux-gnu-objdump
-rwxr-xr-x 2 5926304 Dec 13 23:41 aarch64-linux-gnu-ranlib
-rwxr-xr-x 2 2980560 Dec 13 23:41 aarch64-linux-gnu-readelf
-rwxr-xr-x 1 5735096 Dec 13 23:41 aarch64-linux-gnu-size
-rwxr-xr-x 1 5732376 Dec 13 23:41 aarch64-linux-gnu-strings
-rwxr-xr-x 2 6529704 Dec 13 23:41 aarch64-linux-gnu-strip
You could then replace copy binutils executables into your target system: if your problem was binutils-related, this may well solve it.

Pod Init not creating a xcworkspace?

I've started a new Mac, ran sudo gem install cocoapods. Done pod init. The Pod file is created but without the .xcworkspace file
Using Xcode 9.3
Any help appreciated.
Tried:
Uninstalling cocoapods and reinstalling with no luck.
The pod install will create the .xcworkspace.
The pod init will just create the Podfile file. –
At start:
>$ ls -la
drwxr-xr-x 5 ... ... 170 12 avr 11:04 .
drwxr-xr-x 34 ... ... 1156 12 avr 10:03 ..
drwxr-xr-x 12 ... ... 408 12 avr 10:33 MyProjectName
drwxr-xr-x 5 ... ... 170 12 avr 10:17 MyProjectName.xcodeproj
After pod init:
>$ pod init
>$ ls -la
total 8
drwxr-xr-x 5 ... ... 170 12 avr 11:04 .
drwxr-xr-x 34 ... ... 1156 12 avr 10:03 ..
drwxr-xr-x 12 ... ... 408 12 avr 10:33 MyProjectName
drwxr-xr-x 5 ... ... 170 12 avr 10:17 MyProjectName.xcodeproj
-rw-r--r-- 1 ... ... 254 12 avr 11:04 Podfile
=> File added: Podfile
After pod install:
>$ pod install
Analyzing dependencies
Downloading dependencies
Generating Pods project
Integrating client project
[!] Please close any current Xcode sessions and use `MyProjectName.xcworkspace` for this project from now on.
Sending stats
Pod installation complete! There are 0 dependencies from the Podfile and 0 total pods installed.
[!] The Podfile does not contain any dependencies.
[!] Automatically assigning platform `ios` with version `11.2` on target `MyProjectName` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.
>$ ls -la
total 16
drwxr-xr-x 8 ... ... 272 12 avr 11:05 .
drwxr-xr-x 34 ... ... 1156 12 avr 10:03 ..
drwxr-xr-x 12 ... ... 408 12 avr 10:33 MyProjectName
drwxr-xr-x 5 ... ... 170 12 avr 11:05 MyProjectName.xcodeproj
drwxr-xr-x 3 ... ... 102 12 avr 11:05 MyProjectName.xcworkspace
-rw-r--r-- 1 ... ... 254 12 avr 11:04 Podfile
-rw-r--r-- 1 ... ... 77 12 avr 11:05 Podfile.lock
drwxr-xr-x 7 ... ... 238 12 avr 11:05 Pods
=> File added: MyProjectName.xcworkspace, Podfile.lock, Folder added: Pods

How to set LD_LIBRARY_PATH (and maybe DYLD_ as well) for google protobuf on mac?

protobuf 2.5 has been installed (via brew) and is in the path:
$which protoc
/usr/local/opt/protobuf#2.5/bin/protoc
When compiling (caffe) it is not being found: presumably due to library path settings.
ld: library not found for -lprotobuf
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [.build_release/lib/libcaffe.so.1.0.0-rc3] Error 1
Which env vars need to be updated? I am unclear among which combination of
LD_LIBRARY_PATH
DYLD_LIBRARY_PATH
LIBRARY_PATH
were required
Also: is the following path /usr/local/Cellar/protobuf#2.5/2.5.0/lib correct to use?
$ll /usr/local/Cellar/protobuf#2.5/2.5.0/lib
total 12392
-r--r--r-- 1 boescst admin 1120832 Feb 26 2013 libprotoc.a
-r--r--r-- 1 boescst admin 1536576 Feb 26 2013 libprotobuf.a
-r--r--r-- 1 boescst admin 215672 Feb 26 2013 libprotobuf-lite.a
drwxr-xr-x 12 boescst admin 408 Feb 26 2013 .
drwxr-xr-x 4 boescst admin 136 Mar 12 11:46 pkgconfig
-r--r--r-- 1 boescst admin 659108 Mar 12 11:46 libprotoc.dylib
-r--r--r-- 1 boescst admin 659108 Mar 12 11:46 libprotoc.8.dylib
-r--r--r-- 1 boescst admin 930424 Mar 12 11:46 libprotobuf.dylib
-r--r--r-- 1 boescst admin 930424 Mar 12 11:46 libprotobuf.8.dylib
-r--r--r-- 1 boescst admin 138008 Mar 12 11:46 libprotobuf-lite.dylib
-r--r--r-- 1 boescst admin 138008 Mar 12 11:46 libprotobuf-lite.8.dylib
drwxr-xr-x 11 boescst admin 374 Mar 12 11:46 ..
Finally: do I need to make any symbolic links inside that directory - to make the calling program (caffe in my case ) be able to find the libs?
The libraries included are shown in the Makefile as so:
INCLUDE_DIRS += $(BLAS_INCLUDE)
LIBRARY_DIRS += $(BLAS_LIB)
LIBRARY_DIRS += /usr/local/Cellar/protobuf#2.5/2.5.0/lib
LDFLAGS += $(foreach librarydir,$(LIBRARY_DIRS),-L$(librarydir)) $(PKG_CONFIG)
$(foreach library,$(LIBRARIES),-l$(library))
So is there a way to print out these libraries - without resorting to make -d that generates 265K lines?
When the compiler returns the error:
clang: error: linker command failed with exit code 1 (use -v to see invocation)
This indicates that a particular library attempting to be linked is unable to be located. In most cases it's usually a matter of informing the compiler where the library in question actually is. There are several ways to do this, and it depends on the way something is being built. Since you are using a Makefile adding the following environment variable should resolve the issue:
LIBRARY_PATH=/usr/local/Cellar/protobuf#2.5/2.5.0/lib:$LIBRA‌​RY_PATH
This adds the libraries location temporarily in the environment so the compiler is able to locate it.
NOTE: In the case LIBRARY_PATH isn't recognized, LIBRARY_DIRS is the correct variable to use.

GCC installed but command not found

I'm new to linux and I'm having a hard time trying to get this work.
I uninstalled and installed gcc a few times. Now when I run gcc --version, it still says zsh: command not found.
When I go to /usr/local/bin and run ls -l I find multiple versions of gcc
lrwxr-xr-x 1 ps032791 admin 33 Jul 2 2014 c++-4.6 -> ../Cellar/gcc46/4.6.4/bin/c++-4.6
lrwxr-xr-x 1 ps032791 admin 33 Apr 6 11:58 c++-4.7 -> ../Cellar/gcc47/4.7.3/bin/c++-4.7
lrwxr-xr-x 1 ps032791 admin 33 Apr 6 15:27 c++-4.8 -> ../Cellar/gcc/4.8.3_1/bin/c++-4.8
lrwxr-xr-x 1 ps032791 admin 32 Apr 6 15:19 cloog -> ../Cellar/cloog/0.18.1/bin/cloog
lrwxr-xr-x 1 ps032791 admin 33 Jul 2 2014 cpp-4.6 -> ../Cellar/gcc46/4.6.4/bin/cpp-4.6
lrwxr-xr-x 1 ps032791 admin 33 Apr 6 11:58 cpp-4.7 -> ../Cellar/gcc47/4.7.3/bin/cpp-4.7
lrwxr-xr-x 1 ps032791 admin 33 Apr 6 15:27 cpp-4.8 -> ../Cellar/gcc/4.8.3_1/bin/cpp-4.8
lrwxr-xr-x 1 ps032791 admin 28 May 29 2014 erb -> ../Cellar/ruby/2.1.2/bin/erb
lrwxr-xr-x 1 ps032791 admin 33 Jul 2 2014 g++-4.6 -> ../Cellar/gcc46/4.6.4/bin/g++-4.6
lrwxr-xr-x 1 ps032791 admin 33 Apr 6 11:58 g++-4.7 -> ../Cellar/gcc47/4.7.3/bin/g++-4.7
lrwxr-xr-x 1 ps032791 admin 33 Apr 6 15:27 g++-4.8 -> ../Cellar/gcc/4.8.3_1/bin/g++-4.8
-rw-r--r-- 1 ps032791 admin 0 Apr 6 13:23 gcc-4.2
lrwxr-xr-x 1 ps032791 admin 33 Jul 2 2014 gcc-4.6 -> ../Cellar/gcc46/4.6.4/bin/gcc-4.6
lrwxr-xr-x 1 ps032791 admin 33 Apr 6 11:58 gcc-4.7 -> ../Cellar/gcc47/4.7.3/bin/gcc-4.7
lrwxr-xr-x 1 ps032791 admin 33 Apr 6 15:27 gcc-4.8 -> ../Cellar/gcc/4.8.3_1/bin/gcc-4.8
lrwxr-xr-x 1 ps032791 admin 36 Apr 6 11:58 gcc-ar-4.7 -> ../Cellar/gcc47/4.7.3/bin/gcc-ar-4.7
lrwxr-xr-x 1 ps032791 admin 36 Apr 6 15:27 gcc-ar-4.8 -> ../Cellar/gcc/4.8.3_1/bin/gcc-ar-4.8
lrwxr-xr-x 1 ps032791 admin 36 Apr 6 11:58 gcc-nm-4.7 -> ../Cellar/gcc47/4.7.3/bin/gcc-nm-4.7
lrwxr-xr-x 1 ps032791 admin 36 Apr 6 15:27 gcc-nm-4.8 -> ../Cellar/gcc/4.8.3_1/bin/gcc-nm-4.8
lrwxr-xr-x 1 ps032791 admin 40 Apr 6 11:58 gcc-ranlib-4.7 -> ../Cellar/gcc47/4.7.3/bin/gcc-ranlib-4.7
lrwxr-xr-x 1 ps032791 admin 40 Apr 6 15:27 gcc-ranlib-4.8 -> ../Cellar/gcc/4.8.3_1/bin/gcc-ranlib-4.8
I ran 'brew doctor', and I get the following output,
Warning: You have MacPorts or Fink installed:
/opt/local/bin/port
This can cause trouble. You don't have to uninstall them, but you may want to
temporarily move them out of the way, e.g.
sudo mv /opt/local ~/macports
Warning: Your Homebrew is outdated.
You haven't updated for at least 24 hours, this is a long time in brewland!
To update Homebrew, run `brew update`.
Warning: You have unlinked kegs in your Cellar
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
gcc48
Warning: You have uncommitted modifications to Homebrew
If this a surprise to you, then you should stash these modifications.
Stashing returns Homebrew to a pristine state but can be undone
should you later need to do so for some reason.
cd /usr/local/Library && git stash && git clean -d -f
Warning: /usr/bin occurs before /usr/local/bin
This means that system-provided programs will be used instead of those
provided by Homebrew. The following tools exist at both paths:
erb
gem
git
git-cvsserver
git-receive-pack
git-shell
git-upload-archive
git-upload-pack
irb
rake
rdoc
ri
ruby
testrb
Consider setting your PATH so that /usr/local/bin
occurs before /usr/bin. Here is a one-liner:
echo export PATH='/usr/local/bin:$PATH' >> ~/.bash_profile
I tried running echo export PATH='/usr/local/bin:$PATH' >> ~/.bash_profile, restarted the terminal and again ran brew doctor, it still complains the same thing. I'm totally lost here. Can someone guide me with this? What am I doing wrong? Thanks in advance.
You are not configuring the correct config file. Check this out:
https://wiki.archlinux.org/index.php/Zsh#Configuring_.24PATH
Check that gcc is installed correctly:
brew install gcc
brew link gcc48
Create an alias to whatever link brew created and put it in your .zshrc
cd /usr/local/bin
ls cpp*
ls c++*
alias gcc=/usr/local/bin/<whatever_link_you_found>

Resources