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

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

Closed
amoeba opened this issue Mar 9, 2023 · 7 comments · Fixed by #35387
Closed

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

amoeba opened this issue Mar 9, 2023 · 7 comments · Fixed by #35387
Assignees
Milestone

Comments

@amoeba
Copy link
Member

amoeba commented Mar 9, 2023

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

@amoeba
Copy link
Member Author

amoeba commented Mar 9, 2023

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.

@amoeba amoeba closed this as completed Mar 9, 2023
@kou
Copy link
Member

kou commented Mar 10, 2023

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/.

@amoeba
Copy link
Member Author

amoeba commented Mar 10, 2023

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?

@kou
Copy link
Member

kou commented Mar 10, 2023

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.

@nealrichardson
Copy link
Member

@kou should we reopen this?

@kou
Copy link
Member

kou commented May 2, 2023

Yes.

@kou kou reopened this May 2, 2023
@kou kou closed this as completed in #35387 May 3, 2023
@kou kou added this to the 13.0.0 milestone May 3, 2023
kou added a commit that referenced this issue May 3, 2023
### Rationale for this change

If we use a CMake target that provides the same include path for system Abseil in advance of a CMake target for bundled Abseil, header files for system Abseil are used.

It causes a link error when system Abseil and bundled Abseil are incompatible.  

### What changes are included in this PR?

Use a CMake target for bundled Abseil as early as possible.
 
### Are these changes tested?

Yes.

### Are there any user-facing changes?

Yes.
* Closes: #34523

Lead-authored-by: Sutou Kouhei <kou@clear-code.com>
Co-authored-by: Sutou Kouhei <kou@cozmixng.org>
Co-authored-by: David Li <li.davidm96@gmail.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
@amoeba
Copy link
Member Author

amoeba commented May 3, 2023

Thanks for the fix @kou !

liujiacheng777 pushed a commit to LoongArch-Python/arrow that referenced this issue May 11, 2023
…pache#35387)

### Rationale for this change

If we use a CMake target that provides the same include path for system Abseil in advance of a CMake target for bundled Abseil, header files for system Abseil are used.

It causes a link error when system Abseil and bundled Abseil are incompatible.  

### What changes are included in this PR?

Use a CMake target for bundled Abseil as early as possible.
 
### Are these changes tested?

Yes.

### Are there any user-facing changes?

Yes.
* Closes: apache#34523

Lead-authored-by: Sutou Kouhei <kou@clear-code.com>
Co-authored-by: Sutou Kouhei <kou@cozmixng.org>
Co-authored-by: David Li <li.davidm96@gmail.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
ArgusLi pushed a commit to Bit-Quill/arrow that referenced this issue May 15, 2023
…pache#35387)

### Rationale for this change

If we use a CMake target that provides the same include path for system Abseil in advance of a CMake target for bundled Abseil, header files for system Abseil are used.

It causes a link error when system Abseil and bundled Abseil are incompatible.  

### What changes are included in this PR?

Use a CMake target for bundled Abseil as early as possible.
 
### Are these changes tested?

Yes.

### Are there any user-facing changes?

Yes.
* Closes: apache#34523

Lead-authored-by: Sutou Kouhei <kou@clear-code.com>
Co-authored-by: Sutou Kouhei <kou@cozmixng.org>
Co-authored-by: David Li <li.davidm96@gmail.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
rtpsw pushed a commit to rtpsw/arrow that referenced this issue May 16, 2023
…pache#35387)

### Rationale for this change

If we use a CMake target that provides the same include path for system Abseil in advance of a CMake target for bundled Abseil, header files for system Abseil are used.

It causes a link error when system Abseil and bundled Abseil are incompatible.  

### What changes are included in this PR?

Use a CMake target for bundled Abseil as early as possible.
 
### Are these changes tested?

Yes.

### Are there any user-facing changes?

Yes.
* Closes: apache#34523

Lead-authored-by: Sutou Kouhei <kou@clear-code.com>
Co-authored-by: Sutou Kouhei <kou@cozmixng.org>
Co-authored-by: David Li <li.davidm96@gmail.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants