[ https://issues.apache.org/jira/browse/IMPALA-6974?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16469042#comment-16469042 ]
ASF subversion and git services commented on IMPALA-6974: --------------------------------------------------------- Commit 88f87bea951fdf6566a65077b4fd8c9b87a2725e in impala's branch refs/heads/2.x from [~joemcdonnell] [ https://git-wip-us.apache.org/repos/asf?p=impala.git;h=88f87be ] IMPALA-6974: Use CMAKE_POSITION_INDEPENDENT_CODE in backend Compilation of individual c++ files are only slightly different between static and shared compilation. First, CMake adds -D${LIBRARY_NAME}_EXPORTS to each compilation. Second, CMake sets CMAKE_POSITION_INDEPENDENT_CODE, which adds an -fPIC/-fPIE flag automatically. The extra define is not used by our code, so preprocessing results in identical code. However, we currently add a global -fPIC to all compilation whether static or shared. This introduces a second -fPIC flag on shared where static only has one. This prevents a hit in ccache, even after preprocessing. Switching a global -fPIC to CMAKE_POSITION_INDEPENDENT_CODE eliminates the difference between shared and static compilation (apart from the added define). This allows a ccache hit after preprocessing. There is a slight difference in some of the compile commands. CMAKE_POSITION_INDEPENDENT_CODE will add an -fPIC or a -fPIE depending on whether the C++ file is going to be an executable. For example, daemon-main.cc gets -fPIE whereas hdfs-scan-node.cc gets -fPIC. Previously, everything had an -fPIC. This saves about an hour on all-build-options-ub1604 due to a higher ccache hit rate. Before: cache hit (direct) 1523 cache hit (preprocessed) 61 cache miss 12690 After: cache hit (direct) 1513 cache hit (preprocessed) 5575 cache miss 7186 Change-Id: Id37bb5afa6a9b7909bb4efe1390a67f7d1469544 Reviewed-on: http://gerrit.cloudera.org:8080/10267 Reviewed-by: Dan Hecht <dhe...@cloudera.com> Reviewed-by: Tim Armstrong <tarmstr...@cloudera.com> Tested-by: Impala Public Jenkins <impala-public-jenk...@cloudera.com> > Static and shared compilation don't have compatible ccache entries > ------------------------------------------------------------------ > > Key: IMPALA-6974 > URL: https://issues.apache.org/jira/browse/IMPALA-6974 > Project: IMPALA > Issue Type: Bug > Components: Backend > Affects Versions: Impala 2.13.0 > Reporter: Joe McDonnell > Assignee: Joe McDonnell > Priority: Major > > In be/CMakeLists.txt, we add an -fPIC flag unconditionally: > {code:java} > # allow linking of static libs into dynamic lib > add_definitions(-fPIC) > {code} > When building in static mode, every command will have an -fPIC flag. However, > when building in shared mode, CMake adds -fPIC (or -fPIE) automatically, so > every command will have -fPIC plus another -fPIC added by CMake. These extra > flags prevent ccache from sharing entries between static and shared builds > even after preprocessing. > -- This message was sent by Atlassian JIRA (v7.6.3#76005) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-all-unsubscr...@impala.apache.org For additional commands, e-mail: issues-all-h...@impala.apache.org