apache / apache/arrow

[C++] Cross-compiling Apache Arrow & Parquet on WSL for ARM64 - free() invalid pointer Issue in libparquet and libarrow

Open
#44,004 1 comment 0 reactions 0 assignees View on GitHub
Component: C++ Type: bug
Dominant language
C++
Stars
17.1k
Forks
4.3k
Avg merge
3d 13h
Merged PRs (30d)
88

Description

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

Hi everyone,

I am encountering a memory issue while cross-compiling **Apache Arrow** and **Parquet** on a **WSL x86 Ubuntu environment** targeting **ARM64**. Specifically, I'm facing a `free() invalid pointer` error when running a function in `libparquet` that involves string deletion in the `ApplicationVersion` class destructor.

### Details of the Issue:

- **Environment**: WSL x86 Ubuntu cross-compiling for ARM64.
- **Libraries**: `libarrow.so` and `libparquet.so` are both compiled.
- **Issue**: When I invoke a function from `libparquet` (which calls `std::getline` and other standard C++ string manipulations), the program crashes due to a memory issue when the `ApplicationVersion` destructor tries to free a string.
- **Observed Behavior**:
- **Static linking of `libstdc++`**: When I modified the build of **Apache Arrow** to statically link `libstdc++`, the `getline` issue in `libarrow` was resolved.
- **Issue persists in `libparquet`**: However, `libparquet` still crashes with the same memory issue in the destructor of `ApplicationVersion`. The destructor tries to free memory for a string, but fails with a `free() invalid pointer` error.

### What I have tried:
- **Static Linking of `libstdc++`**: This resolved the issue for `libarrow`, but did not fix `libparquet`.
- **Checked ABI compatibility**: Ensured that both `libarrow` and `libparquet` were compiled with the same ABI settings (`-D_GLIBCXX_USE_CXX11_ABI=1`).
-
### Request for Help:
1. Has anyone encountered similar issues with **cross-compiling Apache Arrow and Parquet** for ARM64 on WSL or other environments?
2. Could this be an issue with memory management across shared libraries (`libarrow.so` and `libparquet.so`)?
3. What would be the best way to ensure consistent memory management between `libarrow` and `libparquet`?
4. Would statically linking `libstdc++` for **both** `libarrow` and `libparquet` be a viable solution to this problem?

Any insights or suggestions would be highly appreciated!

Thanks in advance for your help.

### Component(s)

C++

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.