Alexey Serbin has submitted this change and it was merged.

Change subject: build: fix codegen errors when using static linkage
......................................................................


build: fix codegen errors when using static linkage

Commit 1670a89 upgraded cmake from 3.2 to 3.6, and in the process, broke all
statically linked codegen-dependent Kudu executables. When run, they
produced errors like the following:

  LLVM ERROR: Program used external function 
'_ZN4kudu9ArenaBaseILb0EE21AllocateBytesFallbackEmm' which could not be 
resolved!

The release notes revealed the culprit: CMP0065[1]. This policy change
removed -rdynamic from every Kudu executable's link line, which had the side
effect of breaking codegen. I don't know why we need -rdynamic, but I
verified that restoring it manually (and using this patch to restore it) fix
the tests. I went digging for better solutions and saw that maybe we should
call ExecutionEngine::addGlobalMapping() on our created functions[2][3], but
after looking at the hairy mess that is JITWrapper, I decided to punt.

This wasn't caught in precommit tests because gerrit uses distributed
testing, which means release builds are dynamically linked to reduce
executable disk space consumption.

1. https://cmake.org/cmake/help/v3.4/policy/CMP0065.html
2. 
http://stackoverflow.com/questions/4425797/linking-llvm-jit-code-to-external-c-functions
3. https://llvm.org/bugs/show_bug.cgi?id=20656

Change-Id: Ie803b93cfd9b5bed56ece5f24b769850b7b55b74
Reviewed-on: http://gerrit.cloudera.org:8080/4540
Tested-by: Kudu Jenkins
Reviewed-by: Alexey Serbin <aser...@cloudera.com>
---
M CMakeLists.txt
1 file changed, 8 insertions(+), 0 deletions(-)

Approvals:
  Alexey Serbin: Looks good to me, approved
  Kudu Jenkins: Verified



-- 
To view, visit http://gerrit.cloudera.org:8080/4540
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie803b93cfd9b5bed56ece5f24b769850b7b55b74
Gerrit-PatchSet: 2
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Adar Dembo <a...@cloudera.com>
Gerrit-Reviewer: Adar Dembo <a...@cloudera.com>
Gerrit-Reviewer: Alexey Serbin <aser...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Todd Lipcon <t...@apache.org>

Reply via email to