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

[Native Execution] Build failure on MacOS when PRESTO_ENABLE_PARQUET=ON #18261

Closed
majetideepak opened this issue Aug 31, 2022 · 28 comments · Fixed by #19021
Closed

[Native Execution] Build failure on MacOS when PRESTO_ENABLE_PARQUET=ON #18261

majetideepak opened this issue Aug 31, 2022 · 28 comments · Fixed by #19021
Labels

Comments

@majetideepak
Copy link
Collaborator

majetideepak commented Aug 31, 2022

The presto_server target build fails on MacOS with bunch of missing symbols when built with -DPRESTO_ENABLE_PARQUET=ON

bash$ PRESTO_ENABLE_PARQUET=ON make debug

.....
Undefined symbols for architecture x86_64:
  "apache::thrift::CodecConfig::__fbthrift_clear()", referenced from:
      apache::thrift::CodecConfig::~CodecConfig() in libpresto_thrift-cpp2.a(PrestoThriftAsyncClient.cpp.o)
      apache::thrift::CodecConfig::~CodecConfig() in libthriftcpp2.a(Cpp2Channel.cpp.o)
      apache::thrift::CodecConfig::~CodecConfig() in libthriftcpp2.a(RequestChannel.cpp.o)
      apache::thrift::CodecConfig::~CodecConfig() in libthriftcpp2.a(FramingHandler.cpp.o)
      apache::thrift::CodecConfig::~CodecConfig() in libthriftcpp2.a(RpcMetadataUtil.cpp.o)
  "apache::thrift::concurrency::Util::currentTimeTicks(long long)", referenced from:
      apache::thrift::concurrency::Util::currentTime() in libtransport.a(THttpParser.cpp.o)
  "apache::thrift::ContextStack::onReadData(apache::thrift::SerializedMessage const&)", referenced from:
      folly::exception_wrapper apache::thrift::detail::ac::recv_wrapped_helper<apache::thrift::BinaryProtocolReader, apache::thrift::ThriftPresult<true> >(apache::thrift::BinaryProtocolReader*, apache::thrift::ClientReceiveState&, apache::thrift::ThriftPresult<true>&) in libpresto_thrift-cpp2.a(PrestoThriftAsyncClient.cpp.o)
      folly::exception_wrapper apache::thrift::detail::ac::recv_wrapped_helper<apache::thrift::CompactProtocolReader, apache::thrift::ThriftPresult<true> >(apache::thrift::CompactProtocolReader*, apache::thrift::ClientReceiveState&, apache::thrift::ThriftPresult<true>&) in libpresto_thrift-cpp2.a(PrestoThriftAsyncClient.cpp.o)
.........
@mbasmanova
Copy link
Contributor

@mbasmanova
Copy link
Contributor

@majetideepak Deepak, are there any particular steps to reproduce this failure? I'm able to build successfully.

@mbasmanova
Copy link
Contributor

@majetideepak Deepak, does this happen only when PRESTO_ENABLE_PARQUET=ON ? I don't have this setting. I'll try to enable it and build.

@majetideepak
Copy link
Collaborator Author

@mbasmanova Yes, the build fails only when PRESTO_ENABLE_PARQUET=ON. I edited the description. Previously it was only in the title.

@majetideepak
Copy link
Collaborator Author

majetideepak commented Aug 31, 2022

Some observations

  1. This seems to happen only on MacOS and not on Linux.
  2. We have two thrift libraries, regular thrift (for Arrow) and FBThrift. Likely a conflict between both.
  3. I tried to see if we can use only FBThrift for Arrow as well. Unfortunately, this does not work since Arrow checks in regular thrift-generated Parquet Thrift CPP files.

@mshang816
Copy link
Contributor

PRESTO_ENABLE_PARQUET=ON

I can take a look. So this should be reproduced like this: make -DPRESTO_ENABLE_PARQUET=ON debug ?

@majetideepak
Copy link
Collaborator Author

PRESTO_ENABLE_PARQUET=ON make debug should do.

@mshang816
Copy link
Contributor

CodecConfig

it looks like I can reproduce the issue locally. I will take a look at the issue.

@uhyonc
Copy link

uhyonc commented Oct 6, 2022

Hi, I have the same problem as well. Can we get an update on this ticket? Thanks!

@mbasmanova
Copy link
Contributor

CC: @kgpai

@Mionsz
Copy link
Contributor

Mionsz commented Oct 16, 2022

@mbasmanova @majetideepak Here is the partial fix: https://github.com/prestodb/presto/pull/18213/files

You need to add also on line 158 in presto-native-execution/CMakeLists.txt (after find_library(RE2 re2)):

find_library(RE2 re2)
find_package(FBTHRIFT)
include_directories(${FBTHRIFT_INCLUDE_DIR})

You could adopt in somehow as we are waiting for legal team to finish the CLA process so it still can take some time.
P.s. Not sure if this will help with your issue :)

@majetideepak
Copy link
Collaborator Author

@Mionsz this fix did not work for me on my MacOS. Did you see the same build error in the description?

@Mionsz
Copy link
Contributor

Mionsz commented Oct 19, 2022

@majetideepak so now I see that we have some problems in building prestocpp - the latest version - so it is hard to tell if those are the same.
It is worth mentioning that Velox now uses ThirdpartyToolchain.cmake file for folly installation and linking. This is not reflected in PrestoCpp. There are also some issues with Presto protocol translation to PrestoCpp.

@dingqiaoyi
Copy link

Is someone working on this? Thanks in advance.

@dingqiaoyi
Copy link

@majetideepak @Mionsz

@mbasmanova
Copy link
Contributor

@mshang816 Michael, is this something you could help look into?

CC: @kgpai

@Mionsz
Copy link
Contributor

Mionsz commented Nov 8, 2022

@dingqiaoyi @majetideepak try using this PR #18572 please give me feedback if this helps

@majetideepak majetideepak changed the title [Native Execution] Build failure when PRESTO_ENABLE_PARQUET=ON [Native Execution] Build failure on MacOS when PRESTO_ENABLE_PARQUET=ON Nov 9, 2022
@majetideepak
Copy link
Collaborator Author

@Mionsz the build failure happens only on MacOS. I wrote this in one of my comments above. I clarified this in the title and in the description.

@Mionsz
Copy link
Contributor

Mionsz commented Nov 9, 2022

Yes I am aware -- try building Thrift part with -std=c++11 -stdlib=libc++ instead of -std=c++17 -stdlib=libstdc++. It is possible that -stdlib=libc++ could help.

@markjin1990
Copy link
Contributor

Yes I am aware -- try building Thrift part with -std=c++11 -stdlib=libc++ instead of -std=c++17 -stdlib=libstdc++. It is possible that -stdlib=libc++ could help.

Would you mind elaborating your proposed solution of "building Thrift part with -std=c++11 -stdlib=libc++"? Thanks!

@markjin1990
Copy link
Contributor

Hi, @majetideepak Did you finally figured out a solution for this problem? Both my colleagues and I encountered this problem recently.

@sungho-park-23
Copy link

@majetideepak I am running into this issue as well, have you figured out a solution for this?

@Mionsz
Copy link
Contributor

Mionsz commented Feb 4, 2023

Try instead of building fbthrift running this before the build starts:

sed -i '/^sudo --preserve-env apt install/a\  *thrift* \\' presto-native-execution/scripts/setup-macos.sh

so that it will be installed

@sungho-park-23
Copy link

sungho-park-23 commented Feb 4, 2023

Try instead of building fbthrift running this before the build starts:

sed -i '/^sudo --preserve-env apt install/a\  *thrift* \\' presto-native-execution/scripts/setup-macos.sh

so that it will be installed

@Mionsz This didn't work for me, I'm still getting the same error. What exactly is this command trying to do here?

I found that the sed command itself didnt work either, so I went around it and used gsed ( looks like some differences in Ubuntu vs mac). Not sure if that caused a difference.

@majetideepak
Copy link
Collaborator Author

I am able to manually build presto_server by changing the link order of thrift/libpresto_thrift-cpp2.a /usr/local/lib/libthriftcpp2.a. I will spend more time this week on a proper fix.

@majetideepak
Copy link
Collaborator Author

majetideepak commented Feb 6, 2023

I have a fix here #19021. I am able to verify locally. Can someone else verify as well?
CC: @sungho-park-23, @markjin1990
Thanks.

@markjin1990
Copy link
Contributor

@majetideepak Thanks for providing the fix! This solves the problem on my side. @sungho-park-23 Please double check it.

@sungho-park-23
Copy link

I have a fix here #19021. I am able to verify locally. Can someone else verify as well? CC: @sungho-park-23, @markjin1990 Thanks.

@majetideepak It works for me! Thanks a lot.

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

Successfully merging a pull request may close this issue.

8 participants