Closed yeoppoey closed 6 years ago
We've seen this error before. I'm assuming you're running this on Ubuntu 17.04 and am experiencing this problem. The solution is to either explicitly tell CMake to gcc-5 rather than gcc-6, or if you insist on using gcc-6, add the flag -no-pie to the CFLAGS.
Thanks, How about building LLVM-Tracer without example/triads ?
That doesn't solve your problem, since whenever you actually try to use the tracer, you'll need to invoke gcc to link the final binary, and you'll hit this same problem.
I changed my gcc/g++ version to 5 but same problem is occurred. Do you have any idea else?
Here is my full log.
jay@jay-VirtualBox: ~/LLVM-Tracer/build$ cmake ..
-- The CXX compiler identification is GNU 5.5.0
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- use LLVM_ROOT : /usr/local
-- find LLVM-Config : /usr/local/bin/llvm-config
-- LLVM version : 3.4svn
-- LLVM_LINK found : /usr/local/bin/llvm-link
-- LLVM_OPT found : /usr/local/bin/opt
-- LLVM_LLC found : /usr/local/bin/llc
-- LLVM_COMPILER found : /usr/local/bin/clang-3.4
-- Found ZLIB: /usr/local/lib/libz.so (found suitable version "1.2.11", minimum required is "1.2.10")
-- Found Curses: /usr/lib/x86_64-linux-gnu/libcurses.so
-- Configuring done
-- Generating done
-- Build files have been written to: /home/jay/LLVM-Tracer/build
jay@jay-VirtualBox: ~/LLVM-Tracer/build$ make
Scanning dependencies of target full_trace
[ 7%] Building CXX object full-trace/CMakeFiles/full_trace.dir/full_trace.cpp.o
In file included from /home/jay/LLVM-Tracer/full-trace/full_trace.cpp:21:0:
/home/jay/LLVM-Tracer/full-trace/SlotTracker.h:137:21: warning: ‘SlotTracker createSlotTracker(const llvm::Value)’ defined but not used [-Wunused-function]
static SlotTracker createSlotTracker(const Value V) {
^
[ 14%] Linking CXX shared library full_trace.so
[ 14%] Built target full_trace
Scanning dependencies of target trace_logger
[ 21%] Generating trace_logger.obj.llvm
[ 28%] Generating trace_logger.unopt.llvm
[ 35%] Generating trace_logger.llvm
[ 35%] Built target trace_logger
Scanning dependencies of target PROFILE_FUNC
[ 35%] Built target PROFILE_FUNC
Scanning dependencies of target get-labeled-stmts
[ 42%] Building CXX object ast-pass/CMakeFiles/get-labeled-stmts.dir/GetLabeledStmts.cpp.o
[ 50%] Linking CXX executable get-labeled-stmts
[ 50%] Built target get-labeled-stmts
Scanning dependencies of target Tracer_triad
[ 57%] Generating triad.obj.llvm
[ 64%] Generating triad.unopt.llvm
[ 71%] Generating triad.llvm
[ 78%] Generating triad-opt.llvm
[ 85%] Generating full.llvm
[ 92%] Generating full.s
[100%] Generating triad-instrumented
/usr/bin/ld: /tmp/ccWGeuAk.o: relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
example/triad/CMakeFiles/Tracer_triad.dir/build.make:60: recipe for target 'example/triad/triad-instrumented' failed
make[2]: [example/triad/triad-instrumented] Error 1
CMakeFiles/Makefile2:303: recipe for target 'example/triad/CMakeFiles/Tracer_triad.dir/all' failed
make[1]: [example/triad/CMakeFiles/Tracer_triad.dir/all] Error 2
Makefile:140: recipe for target 'all' failed
make: *** [all] Error 2
Did you try adding -no-pie to CFLAGS?
Also we have a Docker image that you should use. It solves all of these environment problems for you. You can find that here: https://hub.docker.com/r/xyzsam/gem5-aladdin/.
I added below line into /LLVM-Tracer/CMakeList.txt
set(CMAKE_C_FLAGS "-no-pie")
Is it a wrong way?
Yeah I think that doesn't actually work in our CMake setup. It's a bit confusing, because we have different CFLAGS for different steps of the tracer instrumentation process (generation of initial LLVM, options to pass to opt, then asm generation, then final linking). Look in cmake-scripts/buildTracerBitcode.cmake and make the changes to the different CFLAGS variables there.
On Thu, Jul 19, 2018 at 9:21 AM yeoppoey notifications@github.com wrote:
I added below line into /LLVM-Tracer/CMakeList.txt
set(CMAKE_C_FLAGS "-no-pie")
Is it a wrong way?
— You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/ysshao/LLVM-Tracer/issues/24#issuecomment-406273857, or mute the thread https://github.com/notifications/unsubscribe-auth/ABSxXM5zjf9tPgZot16EJ_legNb1vRBmks5uIIfjgaJpZM4VT06x .
-- Thanks,
Sam Xi Harvard University Computer Science, Ph.D. Candidate http://www.samxi.org
The cmake scripts invoke two compilers for two purposes.
full-trace
, where CMAKE_C_FLAGS is used.profile-func
and triad
, where LLVMC_FLAGS is used.Please try set(LLVMC_FLAGS "-no-pie")
in CMakeLists.txt
https://github.com/ysshao/LLVM-Tracer/blob/master/cmake-scripts/buildBitcode.cmake#L6
Thank you guys all. Unfortunately, I didn't clear the problem with your solution yet. But, the docker image is going well, I decided to use docker image.
I'm gonna close this issue.
Thanks
Hello, I have some error when I build LLVM-Tracer. Do you have any idea to solve this? Thanks.
/usr/bin/x86_64-linux-gnu-ld: /tmp/ccMIYvHB.o: relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIC /usr/bin/x86_64-linux-gnu-ld: final link failed: Nonrepresentable section on output collect2: error: ld returned 1 exit status example/triad/CMakeFiles/Tracer_triad.dir/build.make:60: recipe for target 'example/triad/triad-instrumented' failed make[2]: [example/triad/triad-instrumented] Error 1 CMakeFiles/Makefile2:303: recipe for target 'example/triad/CMakeFiles/Tracer_triad.dir/all' failed make[1]: [example/triad/CMakeFiles/Tracer_triad.dir/all] Error 2 Makefile:140: recipe for target 'all' failed make: *** [all] Error 2