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

propeller_optimize_clang.sh NOT working on CentOS Stream release 9 (Fedora) #228

Open
yonghong-song opened this issue Aug 26, 2024 · 3 comments

Comments

@yonghong-song
Copy link

yonghong-song commented Aug 26, 2024

I tried to build propeller on CentOS Stream release 9 with the following command

  propeller_optimize_clang.sh

(the directory propeller_optimize_clang.dir has been created before running the above command).

I got the following the error message:

CMake Error at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find Protobuf (missing: Protobuf_LIBRARIES) (found version
  "3.14.0")
Call Stack (most recent call first):
  /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake/Modules/FindProtobuf.cmake:650 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  CMakeLists.txt:10 (find_package)
  CMakeLists.txt:841 (execute_perf_protobuf)

Fixing the above, I got some errors. Eventually I made it work with the following change:

diff --git a/propeller_optimize_clang.sh b/propeller_optimize_clang.sh                                                                      
index 23e6d05..6f5b584 100755                                                                                                               
--- a/propeller_optimize_clang.sh                                                                                                           
+++ b/propeller_optimize_clang.sh                                                                                                           
@@ -43,8 +43,11 @@ PATH_TO_CREATE_LLVM_PROF=${BASE_PROPELLER_CLANG_DIR}/create_llvm_prof_build                                              
 mkdir -p ${PATH_TO_CREATE_LLVM_PROF} && cd ${PATH_TO_CREATE_LLVM_PROF}                                                                     
                                                                                                                                            
 git clone --recursive git@github.com:google/autofdo.git                                                                                    
+cd autofdo && git apply /home/yhs/0001-debug.patch && cd ..                                                                                
 mkdir build && cd build                                                                                                                    
 cmake -G Ninja -DCMAKE_INSTALL_PREFIX="." \                                                                                                
+      -DCMAKE_BUILD_TYPE=Release \                                                                                                         
+      -DLLVM_ENABLE_LIBCXX=ON \                                                                                                            
       -DCMAKE_C_COMPILER="${PATH_TO_TRUNK_LLVM_INSTALL}/bin/clang" \                                                                       
       -DCMAKE_CXX_COMPILER="${PATH_TO_TRUNK_LLVM_INSTALL}/bin/clang++" \                                                                   
       -DLLVM_PATH="${PATH_TO_TRUNK_LLVM_INSTALL}" ../autofdo/

and /home/yhs/0001-debug.patch is

diff --git a/CMakeLists.txt b/CMakeLists.txt
index b300f00..f418d86 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -3,7 +3,7 @@ set(CMAKE_CXX_STANDARD 17)
 set(ABSL_PROPAGATE_CXX_STD on)
  
 project(autofdo)
-set (Protobuf_USE_STATIC_LIBS TRUE)
+# set (Protobuf_USE_STATIC_LIBS TRUE)
  
 function (execute_perf_protobuf)
  
@@ -846,10 +846,10 @@ elseif (${enable_tool} STREQUAL llvm)
   message(STATUS "Building tool \"LLVM\" ...")
  
   # Build static binaries.
-  set (BUILD_SHARED_LIBS OFF)
-  set (CMAKE_FIND_LIBRARY_SUFFIXES ".a")
+  # set (BUILD_SHARED_LIBS OFF)
+  # set (CMAKE_FIND_LIBRARY_SUFFIXES ".a")
   # Link static executables.
-  set (CMAKE_EXE_LINKER_FLAGS "-static")
+  # set (CMAKE_EXE_LINKER_FLAGS "-static")
  
   build_llvm()
 else ()

Basically I need to disable static linking and add a couple of options for llvm build.

I also need to add some packages to make it work.

It would be good if we have clear instructions in README file about fedora/centos system.

@shenhanc78
Copy link
Collaborator

Thanks Yonghong for reporting and posting fixes.

Right, currently, the build instructions are only tested on Ubuntu 20.04 and Ubuntu 22.04. We will make this possible on Fedora/CentOS and post updates.

@shenhanc78
Copy link
Collaborator

It turns out to my surprise that CentOS-Stream-9 does not have in its repositories some static packages, like static libelf, static libcrypot (part of openssl) and even static libprotobuf. I'll provide an option to build non-static build create_llvm_prof.

@shenhanc78
Copy link
Collaborator

Create #229

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
@yonghong-song @shenhanc78 and others