riscv-software-src / riscv-perf-model

Example RISC-V Out-of-Order/Superscalar Processor Performance Core and MSS Model
Apache License 2.0
117 stars 43 forks source link

Cannot compile with Profile build type #158

Open danbone opened 4 months ago

danbone commented 4 months ago

I'm trying to compile with CMAKE_BUILD_TYPE=Profile but I'm getting the following error:

/home/dan/anaconda3/envs/sparta/bin/../lib/gcc/x86_64-conda-linux-gnu/12.3.0/../../../../x86_64-conda-linux-gnu/bin/ld: /home/dan/anaconda3/envs/sparta/bin/../x86_64-conda-linux-gnu/sysroot/usr/lib/../lib/gcrt1.o: relocation R_X86_64_32S against symbol `__libc_csu_fini' can not be used when making a PIE object; recompile with -fPIE
/home/dan/anaconda3/envs/sparta/bin/../lib/gcc/x86_64-conda-linux-gnu/12.3.0/../../../../x86_64-conda-linux-gnu/bin/ld: failed to set dynamic section sizes: bad value

Has anyone else encountered this?

klingaard commented 4 months ago

I don't have that issue, but a different one. Specifically stf is built with LTO while the linking stage doesn't accept it. Got a flag mismatch.

Have you tried with clang?

danbone commented 4 months ago

Same error as this?

/home/dan/anaconda3/envs/riscv_perf_model/bin/../lib/gcc/x86_64-conda-linux-gnu/10.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: stf_lib/lib/libstf.a: error adding symbols: file format not recognized
clang-14: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [CMakeFiles/olympia.dir/build.make:131: olympia] Error 1
make[1]: *** [CMakeFiles/Makefile2:360: CMakeFiles/olympia.dir/all] Error 2
make: *** [Makefile:91: all] Error 2
danbone commented 4 months ago

Managed to fix it by moving the setup_stf_linker out of the Release build only

diff --git a/CMakeLists.txt b/CMakeLists.txt
index bee99e2..4fc4298 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -38,9 +38,10 @@ set (DISABLE_STF_DOXYGEN ON)

 if (CMAKE_BUILD_TYPE MATCHES "^[Rr]elease")
   set (FULL_LTO true)
-  include(${STF_LIB_BASE}/cmake/stf_linker_setup.cmake)
-  setup_stf_linker(false)
 endif()
+include(${STF_LIB_BASE}/cmake/stf_linker_setup.cmake)
+setup_stf_linker(false)
+

 # Use ccache if installed
 find_program (CCACHE_PROGRAM ccache)

Will create PR

klingaard commented 4 months ago

Yep. That’s the one. Thanks for debugging On Mar 5, 2024, at 4:42 PM, danbone @.***> wrote: Managed to fix it by moving the setup_stf_linker out of the Release build only diff --git a/CMakeLists.txt b/CMakeLists.txt index bee99e2..4fc4298 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,9 +38,10 @@ set (DISABLE_STF_DOXYGEN ON)

if (CMAKE_BUILD_TYPE MATCHES "^[Rr]elease") set (FULL_LTO true)

Will create PR

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>