diff --git a/cpp/src/gandiva/engine.cc b/cpp/src/gandiva/engine.cc index 496722b1ea84..cc10eb352dbd 100644 --- a/cpp/src/gandiva/engine.cc +++ b/cpp/src/gandiva/engine.cc @@ -230,7 +230,11 @@ Result> BuildJIT( #endif jit_builder.setJITTargetMachineBuilder(std::move(jtmb)); +#if LLVM_VERSION_MAJOR >= 16 jit_builder.setDataLayout(std::make_optional(data_layout)); +#else + jit_builder.setDataLayout(llvm::Optional(data_layout)); +#endif if (object_cache.has_value()) { jit_builder.setCompileFunctionCreator(