Skip to content

SNOW-2175083: Compilation fails when building from sources with libc++: src/snowflake/connector/nanoarrow_cpp/ArrowIterator/Util/time.cpp:56:25: error: no member named 'abs' in namespace 'std' #2376

@BwL1289

Description

@BwL1289

Python version

3.12.7

Operating system and processor architecture

Linux-6.12.5-linuxkit-aarch64-with-glibc2.3

Installed packages

N/A

What did you do?

When compiling from source with LLVM and libc++ you need to insert #include <cstdlib> at the top of time.cpp to avoid compile time errors:

src/snowflake/connector/nanoarrow_cpp/ArrowIterator/Util/time.cpp:56:25: error: no member named 'abs' in namespace 'std'; did you mean simply 'abs'?
     56 |     int64_t fractions = std::abs(units % internal::powTenSB4[scale]);
        |                         ^~~~~~~~
        |                         abs
  /opt/llvm_toolchain/bin/../include/c++/v1/stdlib.h:125:60: note: 'abs' declared here
    125 | [[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI long double abs(long double __lcpp_x) _NOEXCEPT {
        |                                                            ^
  1 error generated.
  error: command '/opt/llvm_toolchain/bin/clang++' failed with exit code 1
  error: subprocess-exited-with-error

What did you expect to see?

Successful compilation

Can you set logging to DEBUG and collect the logs?

import logging
import os

for logger_name in ('snowflake.connector',):
    logger = logging.getLogger(logger_name)
    logger.setLevel(logging.DEBUG)
    ch = logging.StreamHandler()
    ch.setLevel(logging.DEBUG)
    ch.setFormatter(logging.Formatter('%(asctime)s - %(threadName)s %(filename)s:%(lineno)d - %(funcName)s() - %(levelname)s - %(message)s'))
    logger.addHandler(ch)

Metadata

Metadata

Labels

bugstatus-triage_doneInitial triage done, will be further handled by the driver team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions