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

[C++][Gandiva] Attribute mismatch error with unity build #43463

Closed
kou opened this issue Jul 29, 2024 · 1 comment
Closed

[C++][Gandiva] Attribute mismatch error with unity build #43463

kou opened this issue Jul 29, 2024 · 1 comment

Comments

@kou
Copy link
Member

kou commented Jul 29, 2024

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

[678/708] Building CXX object src/gandiva/precompiled/CMakeFiles/gandiva-precompiled-test.dir/Unity/unity_0_cxx.cxx.o
FAILED: src/gandiva/precompiled/CMakeFiles/gandiva-precompiled-test.dir/Unity/unity_0_cxx.cxx.o 
/opt/homebrew/bin/ccache /Library/Developer/CommandLineTools/usr/bin/c++ -DARROW_EXTRA_ERROR_CONTEXT -DARROW_HAVE_NEON -DARROW_STATIC -DARROW_WITH_TIMING_TESTS -DGANDIVA_STATIC -DGANDIVA_UNIT_TEST=1 -I/Users/kou/work/cpp/arrow/cpp.build/src -I/Users/kou/work/cpp/arrow/cpp/src -I/Users/kou/work/cpp/arrow/cpp/src/generated -isystem /Users/kou/work/cpp/arrow/cpp/thirdparty/flatbuffers/include -isystem /Users/kou/work/cpp/arrow/cpp.build/_deps/googletest-src/googletest/include -isystem /Users/kou/work/cpp/arrow/cpp.build/_deps/googletest-src/googletest -isystem /Users/kou/work/cpp/arrow/cpp.build/_deps/googletest-src/googlemock/include -isystem /Users/kou/work/cpp/arrow/cpp.build/_deps/googletest-src/googlemock -isystem /opt/homebrew/include -fno-aligned-new  -Qunused-arguments -fcolor-diagnostics  -Wall -Wextra -Wdocumentation -DARROW_WARN_DOCUMENTATION -Wshorten-64-to-32 -Wno-missing-braces -Wno-unused-parameter -Wno-constant-logical-operand -Wno-return-stack-address -Wdate-time -Wno-unknown-warning-option -Wno-pass-failed -march=armv8-a  -g -Werror -O0 -ggdb  -std=c++17 -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX14.0.sdk -fPIE -MD -MT src/gandiva/precompiled/CMakeFiles/gandiva-precompiled-test.dir/Unity/unity_0_cxx.cxx.o -MF src/gandiva/precompiled/CMakeFiles/gandiva-precompiled-test.dir/Unity/unity_0_cxx.cxx.o.d -o src/gandiva/precompiled/CMakeFiles/gandiva-precompiled-test.dir/Unity/unity_0_cxx.cxx.o -c /Users/kou/work/cpp/arrow/cpp.build/src/gandiva/precompiled/CMakeFiles/gandiva-precompiled-test.dir/Unity/unity_0_cxx.cxx
In file included from /Users/kou/work/cpp/arrow/cpp.build/src/gandiva/precompiled/CMakeFiles/gandiva-precompiled-test.dir/Unity/unity_0_cxx.cxx:7:
In file included from /Users/kou/work/cpp/arrow/cpp/src/gandiva/precompiled/bitmap_test.cc:19:
In file included from /Users/kou/work/cpp/arrow/cpp/src/gandiva/precompiled/types.h:22:
/Users/kou/work/cpp/arrow/cpp/src/gandiva/gdv_function_stubs.h:77:1: error: attribute declaration must precede definition [-Werror,-Wignored-attributes]
GANDIVA_EXPORT
^
/Users/kou/work/cpp/arrow/cpp/src/gandiva/visibility.h:39:39: note: expanded from macro 'GANDIVA_EXPORT'
#define GANDIVA_EXPORT __attribute__((visibility("default")))
                                      ^
/Users/kou/work/cpp/arrow/cpp/src/gandiva/context_helper.cc:63:6: note: previous definition is here
void gdv_fn_context_set_error_msg(int64_t context_ptr, char const* err_msg) {
     ^
In file included from /Users/kou/work/cpp/arrow/cpp.build/src/gandiva/precompiled/CMakeFiles/gandiva-precompiled-test.dir/Unity/unity_0_cxx.cxx:7:
In file included from /Users/kou/work/cpp/arrow/cpp/src/gandiva/precompiled/bitmap_test.cc:19:
In file included from /Users/kou/work/cpp/arrow/cpp/src/gandiva/precompiled/types.h:22:
/Users/kou/work/cpp/arrow/cpp/src/gandiva/gdv_function_stubs.h:80:1: error: attribute declaration must precede definition [-Werror,-Wignored-attributes]
GANDIVA_EXPORT
^
/Users/kou/work/cpp/arrow/cpp/src/gandiva/visibility.h:39:39: note: expanded from macro 'GANDIVA_EXPORT'
#define GANDIVA_EXPORT __attribute__((visibility("default")))
                                      ^
/Users/kou/work/cpp/arrow/cpp/src/gandiva/context_helper.cc:68:10: note: previous definition is here
uint8_t* gdv_fn_context_arena_malloc(int64_t context_ptr, int32_t size) {
         ^
2 errors generated.

src/gandiva/precompiled/CMakeFiles/gandiva-precompiled-test.dir/Unity/unity_0_cxx.cxx:

/* generated by CMake */

/* NOLINTNEXTLINE(bugprone-suspicious-include,misc-include-cleaner) */
#include "/Users/kou/work/cpp/arrow/cpp/src/gandiva/context_helper.cc"

/* NOLINTNEXTLINE(bugprone-suspicious-include,misc-include-cleaner) */
#include "/Users/kou/work/cpp/arrow/cpp/src/gandiva/precompiled/bitmap_test.cc"

/* NOLINTNEXTLINE(bugprone-suspicious-include,misc-include-cleaner) */
#include "/Users/kou/work/cpp/arrow/cpp/src/gandiva/precompiled/bitmap.cc"

/* NOLINTNEXTLINE(bugprone-suspicious-include,misc-include-cleaner) */
#include "/Users/kou/work/cpp/arrow/cpp/src/gandiva/precompiled/epoch_time_point_test.cc"

/* NOLINTNEXTLINE(bugprone-suspicious-include,misc-include-cleaner) */
#include "/Users/kou/work/cpp/arrow/cpp/src/gandiva/precompiled/time_test.cc"

/* NOLINTNEXTLINE(bugprone-suspicious-include,misc-include-cleaner) */
#include "/Users/kou/work/cpp/arrow/cpp/src/gandiva/precompiled/time.cc"

/* NOLINTNEXTLINE(bugprone-suspicious-include,misc-include-cleaner) */
#include "/Users/kou/work/cpp/arrow/cpp/src/gandiva/precompiled/timestamp_arithmetic.cc"

/* NOLINTNEXTLINE(bugprone-suspicious-include,misc-include-cleaner) */
#include "/Users/kou/work/cpp/arrow/cpp/src/gandiva/cast_time.cc"

Component(s)

C++ - Gandiva

@kou kou added the Type: bug label Jul 29, 2024
kou added a commit that referenced this issue Aug 10, 2024
…elper.cc (#43464)

### Rationale for this change

`gdv_function_stubs.h` has declarations of functions in `context_helper.cc`.

If we don't include `gdv_function_stubs.h`, it causes attribution mismatch error with unity build.

### What changes are included in this PR?

Always include `gdv_function_stubs.h` in `context_helper.cc`.

### Are these changes tested?

Yes.

### Are there any user-facing changes?

No.
* GitHub Issue: #43463

Authored-by: Sutou Kouhei <kou@clear-code.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
@kou kou added this to the 18.0.0 milestone Aug 10, 2024
@kou
Copy link
Member Author

kou commented Aug 10, 2024

Issue resolved by pull request 43464
#43464

@kou kou closed this as completed Aug 10, 2024
lriggs pushed a commit to lriggs/arrow that referenced this issue Sep 3, 2024
…text_helper.cc (apache#43464)

### Rationale for this change

`gdv_function_stubs.h` has declarations of functions in `context_helper.cc`.

If we don't include `gdv_function_stubs.h`, it causes attribution mismatch error with unity build.

### What changes are included in this PR?

Always include `gdv_function_stubs.h` in `context_helper.cc`.

### Are these changes tested?

Yes.

### Are there any user-facing changes?

No.
* GitHub Issue: apache#43463

Authored-by: Sutou Kouhei <kou@clear-code.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
lriggs added a commit to dremio/arrow that referenced this issue Sep 4, 2024
…ixes. (#81)

* apacheGH-30866: [Java] fix SplitAndTransfer throws for (0,0) if vector empty (apache#41066)

This is addresses https://issues.apache.org/jira/browse/ARROW-15382 and is reopening of apache#12250 (which I asked to be reopened).

I tried to address all the comments from the previous discussion, added some more tests and fixed an issue in the old commit.
* GitHub Issue: apache#30866

Authored-by: Finn Völkel <finn.volkel@gmail.com>
Signed-off-by: David Li <li.davidm96@gmail.com>

* apacheGH-43463: [C++][Gandiva] Always use gdv_function_stubs.h in context_helper.cc (apache#43464)

### Rationale for this change

`gdv_function_stubs.h` has declarations of functions in `context_helper.cc`.

If we don't include `gdv_function_stubs.h`, it causes attribution mismatch error with unity build.

### What changes are included in this PR?

Always include `gdv_function_stubs.h` in `context_helper.cc`.

### Are these changes tested?

Yes.

### Are there any user-facing changes?

No.
* GitHub Issue: apache#43463

Authored-by: Sutou Kouhei <kou@clear-code.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>

* apacheGH-43119: [CI][Packaging] Update manylinux 2014 CentOS repos that have been deprecated (apache#43121)

### Rationale for this change

Jobs are failing to find mirrorlist.centos.org

### What changes are included in this PR?

Updating repos based on solution from: apache#43119 (comment)

### Are these changes tested?

Via archery

### Are there any user-facing changes?
No
* GitHub Issue: apache#43119

Lead-authored-by: Raúl Cumplido <raulcumplido@gmail.com>
Co-authored-by: Sutou Kouhei <kou@clear-code.com>
Co-authored-by: Sutou Kouhei <kou@cozmixng.org>
Signed-off-by: Raúl Cumplido <raulcumplido@gmail.com>

* Update macos deployment target to 12 to match build machine.

* apacheGH-43400: [C++] Ensure using bundled GoogleTest when we use bundled GoogleTest (apache#43465)

### Rationale for this change

If we use bundled GoogleTest and system other dependencies such as Boost, our include path options may be:

* `-isystem /opt/homebrew/include` (for Boost)
* `-isystem build_dir/_deps/googletest-src/googletest` (for bundled GoogleTest)
* `-isystem build_dir/_deps/googletest-src/googlemock` (for bundled GoogleTest)

With this order, GoogleTest headers in `/opt/homebrew/include/` are used with bundled GoogleTest. It may cause link errors.

### What changes are included in this PR?

This change introduces a new CMake target
`arrow::GTest::gtest_headers` that has include paths for bundled GoogleTest. And it's always used as the first link library of all test program. With this change, our include path options are:

* `-isystem build_dir/_deps/googletest-src/googletest` (for bundled GoogleTest)
* `-isystem build_dir/_deps/googletest-src/googlemock` (for bundled GoogleTest)
* `-isystem /opt/homebrew/include` (for Boost)

With this order, we can always use our bundled GoogleTest.

`arrow::GTest::gtest_headers` is defined only when we use bundled GoogleTest. So this doesn't change the system GoogleTest case.

### Are these changes tested?

Yes.

### Are there any user-facing changes?

Yes.
* GitHub Issue: apache#43400

Authored-by: Sutou Kouhei <kou@clear-code.com>
Signed-off-by: Jacob Wujciak-Jens <jacob@wujciak.de>

---------

Signed-off-by: David Li <li.davidm96@gmail.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
Signed-off-by: Raúl Cumplido <raulcumplido@gmail.com>
Signed-off-by: Jacob Wujciak-Jens <jacob@wujciak.de>
Co-authored-by: Finn Völkel <FiV0@users.noreply.github.com>
Co-authored-by: Sutou Kouhei <kou@clear-code.com>
Co-authored-by: Raúl Cumplido <raulcumplido@gmail.com>
Co-authored-by: Sutou Kouhei <kou@cozmixng.org>
lriggs pushed a commit to lriggs/arrow that referenced this issue Sep 4, 2024
…text_helper.cc (apache#43464)

### Rationale for this change

`gdv_function_stubs.h` has declarations of functions in `context_helper.cc`.

If we don't include `gdv_function_stubs.h`, it causes attribution mismatch error with unity build.

### What changes are included in this PR?

Always include `gdv_function_stubs.h` in `context_helper.cc`.

### Are these changes tested?

Yes.

### Are there any user-facing changes?

No.
* GitHub Issue: apache#43463

Authored-by: Sutou Kouhei <kou@clear-code.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
lriggs pushed a commit to lriggs/arrow that referenced this issue Sep 5, 2024
…text_helper.cc (apache#43464)

### Rationale for this change

`gdv_function_stubs.h` has declarations of functions in `context_helper.cc`.

If we don't include `gdv_function_stubs.h`, it causes attribution mismatch error with unity build.

### What changes are included in this PR?

Always include `gdv_function_stubs.h` in `context_helper.cc`.

### Are these changes tested?

Yes.

### Are there any user-facing changes?

No.
* GitHub Issue: apache#43463

Authored-by: Sutou Kouhei <kou@clear-code.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
lriggs pushed a commit to lriggs/arrow that referenced this issue Sep 6, 2024
…text_helper.cc (apache#43464)

### Rationale for this change

`gdv_function_stubs.h` has declarations of functions in `context_helper.cc`.

If we don't include `gdv_function_stubs.h`, it causes attribution mismatch error with unity build.

### What changes are included in this PR?

Always include `gdv_function_stubs.h` in `context_helper.cc`.

### Are these changes tested?

Yes.

### Are there any user-facing changes?

No.
* GitHub Issue: apache#43463

Authored-by: Sutou Kouhei <kou@clear-code.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

No branches or pull requests

1 participant