LTO compilation question when linking X86/marshal file - gem5

Envs: Ubuntu 18.04, Miniconda3, python=3.7(GCC=7.3.0), GCC -v (7.4.0)
The error occurs when I run the following command:
scons build/X86/gem5.opt -j8
The error is as follow:
[ LINK] -> X86/marshal
lto1: internal compiler error: in lto_tag_to_tree_code, at lto-streamer.h:1005
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-7/README.Bugs> for instructions.
lto-wrapper: fatal error: g++ returned 1 exit status
compilation terminated.
/usr/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
scons: *** [build/X86/marshal] Error 1
scons: building terminated because of errors.
And I am wondering how to fix it.

Related

How to solve cmake linking error `lld: error: undefined symbol: llvm::ConstantInt::get(llvm::IntegerType*, unsigned long, bool) ...`

I am trying to compile from source ypsilon, but couldn't get it installed on Ubunut 22.04 LTS after multiple trial-and-errors.
I followed the official instructions linked above but process fails at cmake --build ., complaining that it couldn't find llvm. Then, I used cmake -DLLVM_DIR=/usr/lib/llvm-14/cmake .... Now, the compilation is OK, but there are many link errors even after trying out -DCMAKE_EXE_LINKER_FLAGS_RELEASE=:
$ cmake -DLLVM_DIR=/usr/lib/llvm-14/cmake -DCMAKE_EXE_LINKER_FLAGS_RELEASE=-L/usr/lib/llvm-14/lib -DCMAKE_BUILD_TYPE=Release .. && cmake --build . |& tee ~/a.txt
-- Build type: Release
-- Found LLVM 14.0.0
-- Using LLVMConfig.cmake in: /usr/lib/llvm-14/cmake
-- Configuring done
-- Generating done
-- Build files have been written to: /home/user/tmp/ypsilon/build
[ 2%] Building CXX object CMakeFiles/ypsilon.dir/src/arith.cpp.o
...
[100%] Linking CXX executable ypsilon
ld.lld: error: undefined symbol: llvm::Type::getInt32Ty(llvm::LLVMContext&)
>>> referenced by ld-temp.o
>>> lto.tmp:(digamma_t::reg_cache_t<8>::copy(llvm::Value*))
>>> referenced by ld-temp.o
>>> lto.tmp:(digamma_t::reg_cache_t<24>::copy(llvm::Value*))
>>> referenced by ld-temp.o
>>> lto.tmp:(digamma_t::reg_cache_t<16>::copy(llvm::Value*))
>>> referenced 96 more times
ld.lld: error: undefined symbol: llvm::ConstantInt::get(llvm::IntegerType*, unsigned long, bool)
...
ld.lld: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
gmake[2]: *** [CMakeFiles/ypsilon.dir/build.make:817: ypsilon] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:164: CMakeFiles/ypsilon.dir/all] Error 2
gmake: *** [Makefile:146: all] Error 2
I am not familiar with cmake or its linking flags on the command line.
Does any one know how to fix the cmake linking issue in the above commands?
The steps I tried are as follows:
sudo apt install clang lld
git clone https://github.com/fujita-y/ypsilon.git
cd ypsilon/ ; mkdir -p build ; cd build
cmake -DLLVM_DIR=/usr/lib/llvm-14/cmake -DCMAKE_EXE_LINKER_FLAGS_RELEASE=-L/usr/lib/llvm-14/lib -DCMAKE_BUILD_TYPE=Release .. && cmake --build .

ld unrecognised emulation mode aarch64linux

When running make in CMake, I only get an error that says /usr/bin/ld unrecognised emulation mode aarch64linux.
Im trying to build DualBootPatcher app for Android, this is the error:
/usr/bin/ld: unrecognised emulation mode: aarch64linux
Supported emulations: elf_x86_64 elf32_x86_64 elf_i386 elf_iamcu elf_l1om elf_k1om i386pep i386pe
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[5]: *** [misc/CMakeFiles/fsck-wrapper.dir/build.make:76: misc/fsck-wrapper] Error 1
make[4]: *** [CMakeFiles/Makefile2:1786: misc/CMakeFiles/fsck-wrapper.dir/all] Error 2
make[3]: *** [Makefile:163: all] Error 2
make[2]: *** [android/CMakeFiles/android-system_arm64-v8a.dir/build.make:111: android/android-system_arm64-v8a-prefix/src/android-system_arm64-v8a-stamp/android-system_arm64-v8a-build] Error 2
make[1]: *** [CMakeFiles/Makefile2:1868: android/CMakeFiles/android-system_arm64-v8a.dir/all] Error 2
make: *** [Makefile:163: all] Error 2>
Im running latest Cmake and binutils. Also tried reinstalling binutils.
Im NOT a developers, so it would be nice if you could explain it^^
Does anyone has a solution?
The issue is clear from the fact that the output is coming from /usr/bin/ld. This is the system ld, rather than the ld included with the NDK. You should investigate why this ld is being executed instead, for example via strace.
For me it turned out to be a file permissions issue - the NDK zip file had extracted without execute permissions, so the toolchain binaries were silently ignored. A few chmod +x later and all was well.

Install libssh fail due to cmake error

So I was trying to install libssh base on instruction from https://github.com/substack/libssh/blob/master/INSTALL
Then when I was trying to build using cmake I have run into problems. I have cmake module on my linux server "cmake/3.7.2-1"
When I have executed command
cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Debug ..
I got following errors:
CMake Error at /afs/.../RHEL6-x86_64/cmake/3.7.2-1/share/cmake-3.7/Modules/CMakeTestCXXCompiler.cmake:44 (message):
The C++ compiler ".../4.9.1/Linux_x86_64_compiled/bin/gcc"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: /local/efrimaz/libSSH/v0-6/build/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/gmake" "cmTC_e97bb/fast"
/usr/bin/gmake -f CMakeFiles/cmTC_e97bb.dir/build.make
CMakeFiles/cmTC_e97bb.dir/build
gmake[1]: Entering directory
`/local/efrimaz/libSSH/v0-6/build/CMakeFiles/CMakeTmp'
Building CXX object CMakeFiles/cmTC_e97bb.dir/testCXXCompiler.cxx.o
/.../4.9.1/Linux_x86_64_compiled/bin/gcc -o
CMakeFiles/cmTC_e97bb.dir/testCXXCompiler.cxx.o -c
/local/efrimaz/libSSH/v0-6/build/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
Linking CXX executable cmTC_e97bb
/afs/.../cmake/3.7.2-1/bin/cmake
-E cmake_link_script CMakeFiles/cmTC_e97bb.dir/link.txt --verbose=1
/.../4.9.1/Linux_x86_64_compiled/bin/gcc
CMakeFiles/cmTC_e97bb.dir/testCXXCompiler.cxx.o -o cmTC_e97bb -rdynamic
/usr/bin/ld: unrecognized option '-plugin'
/usr/bin/ld: use the --help option for usage information
collect2: error: ld returned 1 exit status
gmake[1]: *** [cmTC_e97bb] Error 1
gmake[1]: Leaving directory
`/local/efrimaz/libSSH/v0-6/build/CMakeFiles/CMakeTmp'
gmake: *** [cmTC_e97bb/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
examples/CMakeLists.txt:1 (project)
-- Configuring incomplete, errors occurred!
Google didnt help. Any adivse appreciate.

Library `Coroutines' not found in list of llvm libraries

I'm trying to setup LLVM release version 3.5 on my ubuntu 16.04 LTS 64-bit machine, and have been facing errors related to CMake.
How to solve: Library `Coroutines' not found in list of llvm libraries ?
I followed instructions given here, to the T.
I got the following error log on executing cmake -G "Unix Makefiles" ../llvm
/home/.../llvm_dir/build/CMakeFiles/CMakeTmp/CheckIncludeFile.c:1:27: fatal error: malloc/malloc.h: No such file or directory
compilation terminated.
CMakeFiles/cmTC_23510.dir/build.make:65: recipe for target 'CMakeFiles/cmTC_23510.dir/CheckIncludeFile.c.o' failed
make1: *** [CMakeFiles/cmTC_23510.dir/CheckIncludeFile.c.o] Error 1
...
/home/.../llvm_dir/build/CMakeFiles/CMakeTmp/CheckIncludeFile.c:1:18: fatal error: ndir.h: No such file or directory
compilation terminated.
CMakeFiles/cmTC_a8c89.dir/build.make:65: recipe for target 'CMakeFiles/cmTC_a8c89.dir/CheckIncludeFile.c.o' failed
make1: *** [CMakeFiles/cmTC_a8c89.dir/CheckIncludeFile.c.o] Error 1
...
/home/.../llvm_dir/build/CMakeFiles/CMakeTmp/CheckIncludeFile.c:1:22: fatal error: sys/ndir.h: No such file or directory
compilation terminated.
CMakeFiles/cmTC_9297d.dir/build.make:65: recipe for target 'CMakeFiles/cmTC_9297d.dir/CheckIncludeFile.c.o' failed
make1: *** [CMakeFiles/cmTC_9297d.dir/CheckIncludeFile.c.o] Error 1
...
/home/.../llvm_dir/build/CMakeFiles/CMakeTmp/CheckIncludeFile.c:1:31: fatal error: valgrind/valgrind.h: No such file or directory
compilation terminated.
CMakeFiles/cmTC_14b5f.dir/build.make:65: recipe for target 'CMakeFiles/cmTC_14b5f.dir/CheckIncludeFile.c.o' failed
make1: *** [CMakeFiles/cmTC_14b5f.dir/CheckIncludeFile.c.o] Error 1
...
/home/.../llvm_dir/build/CMakeFiles/CMakeTmp/CheckIncludeFile.c:1:18: fatal error: zlib.h: No such file or directory
compilation terminated.
CMakeFiles/cmTC_a4254.dir/build.make:65: recipe for target 'CMakeFiles/cmTC_a4254.dir/CheckIncludeFile.c.o' failed
make1: *** [CMakeFiles/cmTC_a4254.dir/CheckIncludeFile.c.o] Error 1
...
/home/.../llvm_dir/build/CMakeFiles/CMakeTmp/CheckIncludeFile.c:1:23: fatal error: mach/mach.h: No such file or directory
compilation terminated.
CMakeFiles/cmTC_43c90.dir/build.make:65: recipe for target 'CMakeFiles/cmTC_43c90.dir/CheckIncludeFile.c.o' failed
make1: *** [CMakeFiles/cmTC_43c90.dir/CheckIncludeFile.c.o] Error 1
...
/home/.../llvm_dir/build/CMakeFiles/CMakeTmp/CheckIncludeFile.c:1:25: fatal error: mach-o/dyld.h: No such file or directory
compilation terminated.
CMakeFiles/cmTC_92df8.dir/build.make:65: recipe for target 'CMakeFiles/cmTC_92df8.dir/CheckIncludeFile.c.o' failed
make1: *** [CMakeFiles/cmTC_92df8.dir/CheckIncludeFile.c.o] Error 1
...
/usr/bin/cc -DCHECK_FUNCTION_EXISTS=compress2 CMakeFiles/cmTC_45dee.dir/CheckFunctionExists.c.o -o cmTC_45dee -rdynamic -lz -lm
/usr/bin/ld: cannot find -lz
collect2: error: ld returned 1 exit status
CMakeFiles/cmTC_45dee.dir/build.make:97: recipe for target 'cmTC_45dee' failed
make1: *** [cmTC_45dee] Error 1
...
/usr/bin/cc -DCHECK_FUNCTION_EXISTS=el_init CMakeFiles/cmTC_678de.dir/CheckFunctionExists.c.o -o cmTC_678de -rdynamic -ledit -lm
/usr/bin/ld: cannot find -ledit
collect2: error: ld returned 1 exit status
CMakeFiles/cmTC_678de.dir/build.make:97: recipe for target 'cmTC_678de' failed
make1: *** [cmTC_678de] Error 1
...
/usr/bin/ld: cannot find -ltinfo
collect2: error: ld returned 1 exit status
CMakeFiles/cmTC_b7cfe.dir/build.make:97: recipe for target 'cmTC_b7cfe' failed
make1: *** [cmTC_b7cfe] Error 1
...
/usr/bin/ld: cannot find -lterminfo
collect2: error: ld returned 1 exit status
CMakeFiles/cmTC_58a1c.dir/build.make:97: recipe for target 'cmTC_58a1c' failed
make1: *** [cmTC_58a1c] Error 1
...
/usr/bin/cc -DCHECK_FUNCTION_EXISTS=setupterm CMakeFiles/cmTC_adafa.dir/CheckFunctionExists.c.o -o cmTC_adafa -rdynamic -lcurses -lm
/usr/bin/ld: cannot find -lcurses
collect2: error: ld returned 1 exit status
CMakeFiles/cmTC_adafa.dir/build.make:97: recipe for target 'cmTC_adafa' failed
make1: *** [cmTC_adafa] Error 1
...
/usr/bin/cc -DCHECK_FUNCTION_EXISTS=setupterm CMakeFiles/cmTC_e466b.dir/CheckFunctionExists.c.o -o cmTC_e466b -rdynamic -lncurses -lm
/usr/bin/ld: cannot find -lncurses
collect2: error: ld returned 1 exit status
CMakeFiles/cmTC_e466b.dir/build.make:97: recipe for target 'cmTC_e466b' failed
make1: *** [cmTC_e466b] Error 1
...
/usr/bin/ld: cannot find -lncursesw
collect2: error: ld returned 1 exit status
CMakeFiles/cmTC_8dc06.dir/build.make:97: recipe for target 'cmTC_8dc06' failed
make1: *** [cmTC_8dc06] Error 1
...
/home/.../llvm_dir/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:8:19: error: ‘arc4random’ undeclared (first use in this function)
return ((int*)(&arc4random))[argc];
^
/home/.../llvm_dir/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:8:19: note: each undeclared identifier is reported only once for each function it appears in
CMakeFiles/cmTC_75c3b.dir/build.make:65: recipe for target 'CMakeFiles/cmTC_75c3b.dir/CheckSymbolExists.c.o' failed
make1: *** [CMakeFiles/cmTC_75c3b.dir/CheckSymbolExists.c.o] Error 1
...
/home/.../llvm_dir/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:2:17: fatal error: cmath: No such file or directory
compilation terminated.
CMakeFiles/cmTC_53670.dir/build.make:65: recipe for target 'CMakeFiles/cmTC_53670.dir/CheckSymbolExists.c.o' failed
make1: *** [CMakeFiles/cmTC_53670.dir/CheckSymbolExists.c.o] Error 1
...
/home/.../llvm_dir/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:2:20: fatal error: ieeefp.h: No such file or directory
compilation terminated.
CMakeFiles/cmTC_e4e6e.dir/build.make:65: recipe for target 'CMakeFiles/cmTC_e4e6e.dir/CheckSymbolExists.c.o' failed
make1: *** [CMakeFiles/cmTC_e4e6e.dir/CheckSymbolExists.c.o] Error 1
...
/home/.../llvm_dir/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:2:17: fatal error: cmath: No such file or directory
compilation terminated.
CMakeFiles/cmTC_b8170.dir/build.make:65: recipe for target 'CMakeFiles/cmTC_b8170.dir/CheckSymbolExists.c.o' failed
make1: *** [CMakeFiles/cmTC_b8170.dir/CheckSymbolExists.c.o] Error 1
...
/home/.../llvm_dir/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:8:19: error: ‘exp10’ undeclared (first use in this function)
return ((int*)(&exp10))[argc];
^
/home/.../llvm_dir/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:8:19: note: each undeclared identifier is reported only once for each function it appears in
CMakeFiles/cmTC_392cf.dir/build.make:65: recipe for target 'CMakeFiles/cmTC_392cf.dir/CheckSymbolExists.c.o' failed
make1: *** [CMakeFiles/cmTC_392cf.dir/CheckSymbolExists.c.o] Error 1
...
/home/.../llvm_dir/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:2:27: fatal error: malloc/malloc.h: No such file or directory
compilation terminated.
CMakeFiles/cmTC_ff0fe.dir/build.make:65: recipe for target 'CMakeFiles/cmTC_ff0fe.dir/CheckSymbolExists.c.o' failed
make1: *** [CMakeFiles/cmTC_ff0fe.dir/CheckSymbolExists.c.o] Error 1
...
/home/.../llvm_dir/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:8:19: error: ‘strerror_s’ undeclared (first use in this function)
return ((int*)(&strerror_s))[argc];
^
/home/.../llvm_dir/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:8:19: note: each undeclared identifier is reported only once for each function it appears in
CMakeFiles/cmTC_97097.dir/build.make:65: recipe for target 'CMakeFiles/cmTC_97097.dir/CheckSymbolExists.c.o' failed
make1: *** [CMakeFiles/cmTC_97097.dir/CheckSymbolExists.c.o] Error 1
...
A similar error was faced before and posted here. But since my Python version was of 2.7x series, this didn't help.
So going by the log above, I started with the simpler one, installing Valgrind.
After re-trying the command cmake -G "Unix Makefiles" ../llvm
to see if it's solving errors: I've been getting the Library Coroutines error ever since, and I am stuck.
Can you help me?
Solved with a workaround.
Installed clang-3.5 and llvm-3.5 using the sudo apt install method.

How to solve linker command failed with exit code 1 (use -v to see invocation) error in xcode 6.2 /objective c

My app having one error "ld: file not found: /Users/Fine-Mac/Library/Developer/Xcode/DerivedData/NeonatalApp-bvbdhtlpdjrirqfkvwpjfynxzwfm/Build/Products/Debug-iphoneos/NeonatalApp.app/NeonatalApp
clang: error: linker command failed with exit code 1 (use -v to see invocation)"
In my app having following framework:
1)libsqlite3.dylib
2)libsqlite3.0.dylib
3)QuartzCore.framework
4)CoreGraphics.framework
But i don't understand which file is not found.