-fPIE error when make presto-native-execution
See original GitHub issueI encountered following error when make presto-native-execution - presto_cpp/main/thrift/libpresto_thrift-cpp2.a(presto_thrift_types.cpp.o): relocation R_X86_64_32S against undefined symbol `$1' can not be used when making a PIE object; recompile with -fPIE
Env:
System: Ubuntu 20.04.1
make version: GNU Make 4.2.1
gcc version: 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.1)
g++ version: 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.1)
Log detail:
FAILED: presto_cpp/main/presto_server
: && /usr/bin/c++ -mavx2 -mfma -mavx -mf16c -masm=intel -mlzcnt -Werror -O3 -DNDEBUG velox/velox/functions/prestosql/aggregates/CMakeFiles/velox_aggregates.dir/ApproxDistinctAggregate.cpp.o velox/velox/functions/prestosql/aggregates/CMakeFiles/velox_aggregates.dir/ApproxPercentileAggregate.cpp.o velox/velox/functions/prestosql/aggregates/CMakeFiles/velox_aggregates.dir/ArbitraryAggregate.cpp.o velox/velox/functions/prestosql/aggregates/CMakeFiles/velox_aggregates.dir/ArrayAggAggregate.cpp.o velox/velox/functions/prestosql/aggregates/CMakeFiles/velox_aggregates.dir/AverageAggregate.cpp.o velox/velox/functions/prestosql/aggregates/CMakeFiles/velox_aggregates.dir/BitwiseAggregates.cpp.o velox/velox/functions/prestosql/aggregates/CMakeFiles/velox_aggregates.dir/BoolAggregates.cpp.o velox/velox/functions/prestosql/aggregates/CMakeFiles/velox_aggregates.dir/CountIfAggregate.cpp.o velox/velox/functions/prestosql/aggregates/CMakeFiles/velox_aggregates.dir/CovarianceAggregates.cpp.o velox/velox/functions/prestosql/aggregates/CMakeFiles/velox_aggregates.dir/ChecksumAggregate.cpp.o velox/velox/functions/prestosql/aggregates/CMakeFiles/velox_aggregates.dir/MapAggAggregate.cpp.o velox/velox/functions/prestosql/aggregates/CMakeFiles/velox_aggregates.dir/MinMaxAggregates.cpp.o velox/velox/functions/prestosql/aggregates/CMakeFiles/velox_aggregates.dir/MinMaxByAggregates.cpp.o velox/velox/functions/prestosql/aggregates/CMakeFiles/velox_aggregates.dir/CountAggregate.cpp.o velox/velox/functions/prestosql/aggregates/CMakeFiles/velox_aggregates.dir/PrestoHasher.cpp.o velox/velox/functions/prestosql/aggregates/CMakeFiles/velox_aggregates.dir/SingleValueAccumulator.cpp.o velox/velox/functions/prestosql/aggregates/CMakeFiles/velox_aggregates.dir/SumAggregate.cpp.o velox/velox/functions/prestosql/aggregates/CMakeFiles/velox_aggregates.dir/ValueList.cpp.o velox/velox/functions/prestosql/aggregates/CMakeFiles/velox_aggregates.dir/VarianceAggregates.cpp.o velox/velox/connectors/hive/CMakeFiles/velox_hive_connector.dir/HiveConnector.cpp.o velox/velox/connectors/hive/CMakeFiles/velox_hive_connector.dir/FileHandle.cpp.o presto_cpp/main/CMakeFiles/presto_server.dir/PrestoMain.cpp.o -o presto_cpp/main/presto_server presto_cpp/main/libpresto_server_lib.a velox/velox/functions/prestosql/registration/libvelox_functions_prestosql.a velox/velox/serializers/libvelox_presto_serializer.a velox/velox/dwio/dwrf/reader/libvelox_dwio_dwrf_reader.a presto_cpp/main/types/CMakeFiles/presto_type_converter.dir/TypeSignatureTypeConverter.cpp.o presto_cpp/main/types/CMakeFiles/presto_type_converter.dir/antlr/TypeSignatureLexer.cpp.o presto_cpp/main/types/CMakeFiles/presto_type_converter.dir/antlr/TypeSignatureParser.cpp.o presto_cpp/main/types/CMakeFiles/presto_types.dir/PrestoToVeloxQueryPlan.cpp.o presto_cpp/main/types/CMakeFiles/presto_types.dir/PrestoToVeloxExpr.cpp.o presto_cpp/main/types/CMakeFiles/presto_types.dir/PrestoToVeloxSplit.cpp.o presto_cpp/presto_protocol/CMakeFiles/presto_protocol.dir/presto_protocol.cpp.o presto_cpp/presto_protocol/CMakeFiles/presto_protocol.dir/Base64Util.cpp.o presto_cpp/presto_protocol/CMakeFiles/presto_protocol.dir/DataSize.cpp.o presto_cpp/presto_protocol/CMakeFiles/presto_protocol.dir/Duration.cpp.o presto_cpp/presto_protocol/CMakeFiles/presto_protocol.dir/Connectors.cpp.o presto_cpp/main/connectors/hive/storage_adapters/libpresto_adapters.a presto_cpp/main/common/libpresto_common.a presto_cpp/main/thrift/libpresto_thrift-cpp2.a /usr/local/lib/libthriftcpp2.a /usr/local/lib/libthriftprotocol.a /usr/local/lib/libthriftmetadata.a /usr/local/lib/libthrift-core.a /usr/local/lib/libtransport.a presto_cpp/main/thrift/libpresto_thrift_extra.a presto_cpp/main/common/libpresto_exception.a presto_cpp/main/http/libpresto_http.a /usr/local/lib/libproxygenhttpserver.a /usr/local/lib/libproxygen.a /usr/local/lib/libwangle.a /usr/local/lib/libfizz.a velox/velox/dwio/common/exception/libvelox_dwio_common_exception.a velox/velox/connectors/hive/libvelox_hive_partition_function.a /usr/local/lib/libantlr4-runtime.so -lpthread velox/velox/functions/lib/libvelox_functions_lib.a /usr/lib/x86_64-linux-gnu/libre2.so velox/velox/functions/prestosql/json/libvelox_functions_json.a velox/velox/external/md5/libmd5.a velox/velox/functions/prestosql/types/libvelox_presto_types.a velox/velox/exec/libvelox_exec.a velox/velox/codegen/libvelox_codegen.a velox/velox/exec/libvelox_exec.a velox/velox/codegen/libvelox_codegen.a velox/velox/expression/libvelox_expression.a velox/velox/core/libvelox_core.a velox/velox/expression/libvelox_expression_functions.a velox/velox/functions/prestosql/hyperloglog/libvelox_functions_hyperloglog.a velox/velox/connectors/libvelox_connector.a velox/velox/core/libvelox_config.a velox/velox/dwio/dwrf/writer/libvelox_dwio_dwrf_writer.a velox/velox/dwio/dwrf/common/libvelox_dwio_dwrf_common.a velox/velox/dwio/common/libvelox_dwio_common.a velox/velox/dwio/common/encryption/libvelox_dwio_common_encryption.a velox/velox/common/caching/libvelox_caching.a velox/velox/dwio/common/compression/libvelox_dwio_common_compression.a velox/velox/dwio/dwrf/utils/libvelox_dwio_dwrf_utils.a velox/velox/dwio/dwrf/proto/libvelox_dwio_dwrf_proto.a /usr/lib/x86_64-linux-gnu/libprotobuf.so /usr/lib/x86_64-linux-gnu/liblzo2.so velox/velox/common/file/libvelox_file.a velox/velox/vector/libvelox_vector.a velox/velox/common/time/libvelox_time.a velox/velox/type/libvelox_type.a velox/velox/type/tz/libvelox_type_tz.a velox/velox/common/serialization/libvelox_serialization.a velox/velox/common/base/libvelox_common_base.a velox/velox/external/date/libvelox_external_date.a velox/velox/common/encode/libvelox_encode.a velox/velox/common/memory/libvelox_memory.a velox/velox/common/base/libvelox_exception.a /usr/local/lib/libfmt.a velox/velox/common/process/libvelox_process.a /usr/local/lib/libfolly.a /usr/lib/x86_64-linux-gnu/libdouble-conversion.so /usr/lib/x86_64-linux-gnu/libz.so /usr/lib/x86_64-linux-gnu/libglog.so /usr/lib/x86_64-linux-gnu/libgflags.so.2.2.2 /usr/lib/x86_64-linux-gnu/libsodium.so /usr/lib/x86_64-linux-gnu/libssl.so /usr/lib/x86_64-linux-gnu/libcrypto.so /usr/lib/x86_64-linux-gnu/liblz4.so /usr/lib/x86_64-linux-gnu/libzstd.so /usr/local/lib/libfmt.a /usr/lib/x86_64-linux-gnu/libboost_context.so.1.71.0 -ldl /usr/lib/x86_64-linux-gnu/libevent.so /usr/lib/x86_64-linux-gnu/libsnappy.so /usr/lib/x86_64-linux-gnu/libbz2.so /usr/lib/x86_64-linux-gnu/libboost_filesystem.so.1.71.0 /usr/lib/x86_64-linux-gnu/libboost_program_options.so.1.71.0 /usr/lib/x86_64-linux-gnu/libboost_regex.so.1.71.0 /usr/lib/x86_64-linux-gnu/libboost_system.so.1.71.0 /usr/lib/x86_64-linux-gnu/libboost_thread.so.1.71.0 /usr/lib/x86_64-linux-gnu/libboost_atomic.so.1.71.0 /usr/lib/x86_64-linux-gnu/libglog.so /usr/lib/x86_64-linux-gnu/libgflags.so.2.2.2 lib/libgtest.a -lpthread && :
/usr/bin/ld: presto_cpp/main/thrift/libpresto_thrift-cpp2.a(presto_thrift_types.cpp.o): relocation R_X86_64_32S against undefined symbol `$1' can not be used when making a PIE object; recompile with -fPIE
collect2: error: ld returned 1 exit status
here are the commands I execute:
cd presto/presto-native-execution
mkdir _build
cd _build
cmake ..
make
this gave me error:
/usr/bin/ld: ../thrift/libpresto_thrift-cpp2.a(presto_thrift_types.cpp.o): relocation R_X86_64_32S against undefined symbol `$1' can not be used when making a PIE object; recompile with -fPIE
collect2: error: ld returned 1 exit status
make[2]: *** [presto_cpp/main/tests/CMakeFiles/presto_server_test.dir/build.make:312: presto_cpp/main/tests/presto_server_test] Error 1
make[1]: *** [CMakeFiles/Makefile2:5441: presto_cpp/main/tests/CMakeFiles/presto_server_test.dir/all] Error 2
make: *** [Makefile:141: all] Error 2
Then I changed presto_cpp/main/CMakeFiles/presto_server.dir/link.txt
, add -no-pie
option to /usr/bin/c++
, then it gave me error:
/usr/bin/ld: thrift/libpresto_thrift-cpp2.a(presto_thrift_types.cpp.o): in function `apache::thrift::detail::validate_bool(unsigned char)':
presto_thrift_types.cpp:(.text._ZN6apache6thrift6detail13validate_boolEh[_ZN6apache6thrift6detail13validate_boolEh]+0x28): undefined reference to `$1'
collect2: error: ld returned 1 exit status
Issue Analytics
- State:
- Created a year ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
How to solve: Recompile with -fPIE error? - Stack Overflow
I tried to compile the code with a makefile but this is the error ... when making a PIE object; recompile with -fPIE...
Read more >A gcc compilation error asking -fPIE option - Ask Ubuntu
After reading README.txt, I have run the following command on my terminal. make CC=gcc ARCH=x64 ASM=TRUE AVX2=TRUE.
Read more >fpic/-fPIE aren't clear and contain syntax error
It's not clear if -fPIC can be used when compiling files which are going to be linked into executables, or not. The description...
Read more >How to deal with ld error: 'can not be used when making a PIE ...
Hi, I have built the 3rd party Accellera SystemC library using CMake on Centos 7 with devtoolset-7. I can successfully link my C++ ......
Read more >fpie - Intel
Intel® C++ Compiler Classic Developer Guide and Reference. Development Reference Guides. Version: 2021.7; Last Updated: 09/08/2022; Public Content ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@mshang816 shared the root cause in another thread. The fix is to remove the “-masm=intel” compiler flag when building fbthrift and other external dependencies.
I have seen a variant of this using GCC 11
I don’t know the root cause as well. As a workaround, you should be able to remove thrift-related code as the thrift protocol support is a work in progress.