Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot compile with Profile build type #158

Open
danbone opened this issue Mar 5, 2024 · 9 comments
Open

Cannot compile with Profile build type #158

danbone opened this issue Mar 5, 2024 · 9 comments

Comments

@danbone
Copy link
Contributor

danbone commented Mar 5, 2024

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
Copy link
Collaborator

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
Copy link
Contributor Author

danbone commented Mar 5, 2024

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
Copy link
Contributor Author

danbone commented Mar 5, 2024

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
Copy link
Collaborator

klingaard commented Mar 6, 2024 via email

klingaard pushed a commit that referenced this issue Mar 11, 2024
@Shubhf
Copy link
Contributor

Shubhf commented Aug 13, 2024

@danbone Can I take up this issue?

@klingaard
Copy link
Collaborator

Unless Dan disagrees, feel free to take it. I just reproduced the original issue.

@danbone
Copy link
Contributor Author

danbone commented Aug 14, 2024

@klingaard didn't this get fixed by
9d9a345

@Shubhf
Copy link
Contributor

Shubhf commented Aug 14, 2024

@danbone Can I take up this issue?
If you allow me to do so..
I think in this issue we are supposed to work on "-fPIE" error during compilation, with "CMAKE_BUILD_TYPE=Profile" in conda environment. It will be solved by adjusting compiler flags for PIE compatiability. I am interested to work on this

@danbone
Copy link
Contributor Author

danbone commented Aug 15, 2024

Yes, absolutely fine by me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants