Skip to content

[R] Unable to compile R package with GCS on macOS M1 #34523

Closed

Description

@amoeba

Describe the bug, including details regarding any error messages, version, and platform.

I'm encountering an issue when trying to build the R package from a local build of Arrow C++ but only when I have GCS enabled. The error happens when I run R CMD INSTALL --preclean --no-multiarch .:

symbol not found in flat namespace '__ZN4absl12lts_2023012510FormatTimeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEENS0_4TimeENS0_8TimeZoneE

This looked very similar to what was reported in #32487, though I'm not building tests. I first tried setting CMAKE_CXX_STANDARD=17 which didn't help. @nealrichardson recommended absl_SOURCE=BUNDLED which also didn't help. I do have abseil via Homebrew.

I'm including some details of how I'm building everything below. I'm building off of main (2f3f41f):

How I'm building libarrow and the R package
$ echo $ARROW_HOME
/Users/bryce/builds/arrow-arm64

$ pwd
/Users/bryce/src/apache/arrow/cpp/build

$ cmake .. \
      -GNinja \
      -DARROW_COMPUTE=ON \
      -DARROW_CSV=ON \
      -DARROW_DATASET=ON \
      -DARROW_FILESYSTEM=ON \
      -DARROW_JSON=ON \
      -DARROW_PARQUET=ON \
      -DARROW_INSTALL_NAME_RPATH=OFF \
      -DARROW_S3=ON \
      -DARROW_GCS=ON \
      -DARROW_MIMALLOC=OFF \
      -DARROW_WITH_BROTLI=ON \
      -DARROW_WITH_BZ2=ON \
      -DARROW_WITH_LZ4=ON \
      -DARROW_WITH_SNAPPY=ON \
      -DARROW_WITH_ZLIB=ON \
      -DARROW_WITH_ZSTD=ON \
      -DARROW_EXTRA_ERROR_CONTEXT=ON \
      -DCMAKE_INSTALL_PREFIX=$ARROW_HOME \
      -DCMAKE_BUILD_TYPE=Release \
      -DGTest_SOURCE=BUNDLED \
      -DCMAKE_CXX_STANDARD=17 \
      -Dabsl_SOURCE=BUNDLED

$ ninja install
$ cd ~/src/apache/arrow/r
$ R CMD INSTALL --preclean --no-multiarch .
More complete R build output
installing to /Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/00LOCK-r/00new/arrow/libs
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
Error: package or namespace load failed for ‘arrow’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/00LOCK-r/00new/arrow/libs/arrow.so':
  dlopen(/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/00LOCK-r/00new/arrow/libs/arrow.so, 0x0006): symbol not found in flat namespace '__ZN4absl12lts_2023012510FormatTimeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEENS0_4TimeENS0_8TimeZoneE'
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/arrow’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/arrow’

Component(s)

R

Activity

  1. amoeba commented on Mar 9, 2023

    @amoeba
    MemberAuthor

    Removing Homebrew abseil then re-building from scratch worked. I was then able to reinstall abseil from Homebrew and build w/o absl_SOURCE=BUNDLED which is what I had been doing before I ran into this. So I'm not sure what state I had gotten my system into to run into this in the first place.

  2. kou commented on Mar 10, 2023

    @kou
    Member

    Ah, this is caused by mixing include paths.
    Some dependencies installed by Homebrew add -I$(brew --prefix)/include and it may be used before bundled Abseil. It mixes Homebrew Abseil's include/ and bundled Abseil's lib/.

  3. amoeba commented on Mar 10, 2023

    @amoeba
    MemberAuthor

    Interesting @kou, thanks. This is an area I'm not very familiar with but is there a possibility for an improvement to the build system here?

  4. kou commented on Mar 10, 2023

    @kou
    Member

    CMake has some features to control include path order. For example, target_include_directories() https://cmake.org/cmake/help/latest/command/target_include_directories.html provides AFTER/BEFORE.

    We may be able to solve this by these features.

  5. nealrichardson commented on May 2, 2023

    @nealrichardson
    Member

    @kou should we reopen this?

  6. kou commented on May 2, 2023

    @kou
    Member

    Yes.

  7. reopened this on May 2, 2023
  8. added a commit that references this issue on May 2, 2023
  9. added this to the 13.0.0 milestone on May 3, 2023
  10. added a commit that references this issue on May 3, 2023
  11. amoeba commented on May 3, 2023

    @amoeba
    MemberAuthor

    Thanks for the fix @kou !

  12. added a commit that references this issue on May 11, 2023
  13. added a commit that references this issue on May 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions