Skip to content

ARROW-14405: [C++] Fix build error from clang for windows - #11495

Closed
cyb70289 wants to merge 1 commit into
apache:masterfrom
cyb70289:fix-clang-win
Closed

cyb70289 wants to merge 1 commit into
apache:masterfrom
cyb70289:fix-clang-win

Conversation

@cyb70289

Copy link
Copy Markdown
Contributor

No description provided.

@github-actions

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown

⚠️ Ticket has not been started in JIRA, please click 'Start Progress'.

// Convert timestamps to a string representation with an arbitrary format

#ifndef _WIN32
Result<std::locale> GetLocale(const std::string& locale) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is only used ifndef win32. Cause unused function warning as error.

Comment thread cpp/src/arrow/io/slow.h

template <class StreamType>
class ARROW_EXPORT SlowInputStreamBase : public StreamType {
class SlowInputStreamBase : public StreamType {

@cyb70289 cyb70289 Oct 21, 2021 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This class is implemented completely in header. ARROW_EXPORT expands to dllimport in test file, looks clang for windows expects the implementation is at somewhere else and produces link error complaining constructor definition not found.

NIFESTFILE:release\arrow-io-memory-test.exe.manifest" failed (exit code 1) with the following output:
lld-link: error: undefined symbol: __declspec(dllimport) public: __cdecl arrow::io::SlowInputStreamBase<class arrow::io::InputStream>::SlowInputStreamBase<class arrow::io::InputStream>(class std::shared_ptr<class arrow::io::InputStream>, double)
>>> referenced by src\arrow\io\CMakeFiles\arrow-io-memory-test.dir\memory_test.cc.obj:(void __cdecl std::_Construct_in_place<class arrow::io::SlowInputStream, class std::shared_ptr<class arrow::io::BufferReader> &, double const &>(class arrow::io::SlowInputStream &, class std::shared_ptr<class arrow::io::BufferReader> &, double const &))
>>> referenced by src\arrow\io\CMakeFiles\arrow-io-memory-test.dir\memory_test.cc.obj:(void __cdecl std::_Construct_in_place<class arrow::io::SlowInputStream, class std::shared_ptr<class arrow::io::BufferReader> &, double const &>(class arrow::io::SlowInputStream &, class std::shared_ptr<class arrow::io::BufferReader> &, double const &))

@lidavidm lidavidm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, though I have a question about scalar.h.

Comment thread cpp/src/arrow/scalar.h
};

template <typename T>
struct ARROW_EXPORT IntervalScalar : public TemporalScalar<T> {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, why is it only these particular classes that can't be exported? For instance, why don't we need to remove ARROW_EXPORT from TimeScalar (which is also a base class like the rest of these)?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the reason is IntervalScalar contains some code (linker cannot find the constructor), but TimeScalar doesn't have code. Some scalars' implmentation code are in source files, they are also okay.
But it doesn't explain why Decimal128Scalar works.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose it could also be that some get inlined and so no references end up in the object file. Regardless, it appears to compile and work, so my only worry is that it may be brittle down the line.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not familiar with msvc dll export/import best practice. Find one similar issue on SO without satisfying answer.[1]
In my understanding, if a class is declared and defined in header only, it should not be marked dllimport or export. But what if some member functions are in header while some in source?

[1] https://stackoverflow.com/questions/64506244/how-do-i-export-class-that-fully-defined-in-header-file

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. I think this is OK as is. It looks like we may end up having to remove other instances of ARROW_EXPORT later, but things still build as is so removing these shouldn't hurt things.

@cyb70289

Copy link
Copy Markdown
Contributor Author

Can we trigger a nightly build of this PR? I don't remember the command.
@kou

@lidavidm

Copy link
Copy Markdown
Member

@github-actions crossbow submit -g nightly

@github-actions

Copy link
Copy Markdown

Revision: 29fa274

Submitted crossbow builds: ursacomputing/crossbow @ actions-1049

Task Status
almalinux-8-amd64 Github Actions
almalinux-8-arm64 TravisCI
amazon-linux-2-amd64 Github Actions
centos-7-amd64 Github Actions
centos-8-amd64 Github Actions
centos-8-arm64 TravisCI
conda-clean Azure
conda-linux-gcc-py36-arm64 Azure
conda-linux-gcc-py36-cpu-r40 Azure
conda-linux-gcc-py36-cuda Azure
conda-linux-gcc-py37-arm64 Azure
conda-linux-gcc-py37-cpu-r41 Azure
conda-linux-gcc-py37-cuda Azure
conda-linux-gcc-py38-arm64 Azure
conda-linux-gcc-py38-cpu Azure
conda-linux-gcc-py38-cuda Azure
conda-linux-gcc-py39-arm64 Azure
conda-linux-gcc-py39-cpu Azure
conda-linux-gcc-py39-cuda Azure
conda-osx-arm64-clang-py38 Azure
conda-osx-arm64-clang-py39 Azure
conda-osx-clang-py36-r40 Azure
conda-osx-clang-py37-r41 Azure
conda-osx-clang-py38 Azure
conda-osx-clang-py39 Azure
conda-win-vs2017-py36-r40 Azure
conda-win-vs2017-py37-r41 Azure
conda-win-vs2017-py38 Azure
conda-win-vs2017-py39 Azure
debian-bookworm-amd64 Github Actions
debian-bookworm-arm64 TravisCI
debian-bullseye-amd64 Github Actions
debian-bullseye-arm64 TravisCI
debian-buster-amd64 Github Actions
debian-buster-arm64 TravisCI
example-cpp-minimal-build-static Github Actions
example-cpp-minimal-build-static-system-dependency Github Actions
homebrew-cpp Github Actions
homebrew-r-autobrew Github Actions
java-jars Github Actions
nuget Github Actions
python-sdist Github Actions
test-build-vcpkg-win Github Actions
test-conda-cpp Github Actions
test-conda-cpp-valgrind Azure
test-conda-python-3.10 Github Actions
test-conda-python-3.6 Github Actions
test-conda-python-3.6-pandas-0.23 Github Actions
test-conda-python-3.7 Github Actions
test-conda-python-3.7-dask-latest Github Actions
test-conda-python-3.7-dask-master Github Actions
test-conda-python-3.7-hdfs-2.9.2 Github Actions
test-conda-python-3.7-hdfs-3.2.1 Github Actions
test-conda-python-3.7-kartothek-latest Github Actions
test-conda-python-3.7-kartothek-master Github Actions
test-conda-python-3.7-pandas-0.24 Github Actions
test-conda-python-3.7-pandas-latest Github Actions
test-conda-python-3.7-spark-v3.1.2 Github Actions
test-conda-python-3.8 Github Actions
test-conda-python-3.8-hypothesis Github Actions
test-conda-python-3.8-pandas-latest Github Actions
test-conda-python-3.8-pandas-nightly Github Actions
test-conda-python-3.8-spark-v3.2.0 Github Actions
test-conda-python-3.9 Github Actions
test-conda-python-3.9-pandas-master Github Actions
test-conda-python-3.9-spark-master Github Actions
test-debian-11-cpp Github Actions
test-debian-11-go-1.15 Azure
test-debian-11-python-3 Azure
test-debian-c-glib Github Actions
test-debian-ruby Github Actions
test-fedora-33-cpp Github Actions
test-fedora-33-python-3 Azure
test-r-arrow-backwards-compatibility Github Actions
test-r-depsource-auto Azure
test-r-depsource-system Github Actions
test-r-devdocs Github Actions
test-r-gcc-11 Github Actions
test-r-install-local Github Actions
test-r-linux-as-cran Github Actions
test-r-linux-rchk Github Actions
test-r-linux-valgrind Azure
test-r-minimal-build Azure
test-r-offline-maximal Github Actions
test-r-offline-minimal Azure
test-r-rhub-debian-gcc-devel-lto-latest Azure
test-r-rhub-ubuntu-gcc-release-latest Azure
test-r-rocker-r-base-latest Azure
test-r-rstudio-r-base-3.6-bionic Azure
test-r-rstudio-r-base-3.6-centos7-devtoolset-8 Azure
test-r-rstudio-r-base-3.6-centos8 Azure
test-r-rstudio-r-base-3.6-opensuse15 Azure
test-r-rstudio-r-base-3.6-opensuse42 Azure
test-r-ubuntu-21.04 Github Actions
test-r-versions Github Actions
test-ubuntu-18.04-cpp Github Actions
test-ubuntu-18.04-cpp-release Github Actions
test-ubuntu-18.04-cpp-static Github Actions
test-ubuntu-18.04-python-3 Azure
test-ubuntu-18.04-r-sanitizer Azure
test-ubuntu-20.04-cpp Github Actions
test-ubuntu-20.04-cpp-14 Github Actions
test-ubuntu-20.04-cpp-17 Github Actions
test-ubuntu-20.04-cpp-bundled Github Actions
test-ubuntu-20.04-cpp-thread-sanitizer Github Actions
test-ubuntu-20.10-docs Azure
test-ubuntu-c-glib Github Actions
test-ubuntu-default-docs Azure
test-ubuntu-ruby Github Actions
ubuntu-bionic-amd64 Github Actions
ubuntu-bionic-arm64 TravisCI
ubuntu-focal-amd64 Github Actions
ubuntu-focal-arm64 TravisCI
ubuntu-hirsute-amd64 Github Actions
ubuntu-hirsute-arm64 TravisCI
wheel-macos-big-sur-cp310-arm64 Github Actions
wheel-macos-big-sur-cp310-universal2 Github Actions
wheel-macos-big-sur-cp38-arm64 Github Actions
wheel-macos-big-sur-cp39-arm64 Github Actions
wheel-macos-big-sur-cp39-universal2 Github Actions
wheel-macos-high-sierra-cp310-amd64 Github Actions
wheel-macos-high-sierra-cp36-amd64 Github Actions
wheel-macos-high-sierra-cp37-amd64 Github Actions
wheel-macos-high-sierra-cp38-amd64 Github Actions
wheel-macos-high-sierra-cp39-amd64 Github Actions
wheel-macos-mavericks-cp310-amd64 Github Actions
wheel-macos-mavericks-cp36-amd64 Github Actions
wheel-macos-mavericks-cp37-amd64 Github Actions
wheel-macos-mavericks-cp38-amd64 Github Actions
wheel-macos-mavericks-cp39-amd64 Github Actions
wheel-manylinux2010-cp310-amd64 Github Actions
wheel-manylinux2010-cp36-amd64 Github Actions
wheel-manylinux2010-cp37-amd64 Github Actions
wheel-manylinux2010-cp38-amd64 Github Actions
wheel-manylinux2010-cp39-amd64 Github Actions
wheel-manylinux2014-cp310-amd64 Github Actions
wheel-manylinux2014-cp310-arm64 TravisCI
wheel-manylinux2014-cp36-amd64 Github Actions
wheel-manylinux2014-cp36-arm64 TravisCI
wheel-manylinux2014-cp37-amd64 Github Actions
wheel-manylinux2014-cp37-arm64 TravisCI
wheel-manylinux2014-cp38-amd64 Github Actions
wheel-manylinux2014-cp38-arm64 TravisCI
wheel-manylinux2014-cp39-amd64 Github Actions
wheel-manylinux2014-cp39-arm64 TravisCI
wheel-windows-cp310-amd64 Github Actions
wheel-windows-cp36-amd64 Github Actions
wheel-windows-cp37-amd64 Github Actions
wheel-windows-cp38-amd64 Github Actions
wheel-windows-cp39-amd64 Github Actions

@cyb70289

Copy link
Copy Markdown
Contributor Author

Hmm, nightly build is not very clean.
I believe all the errors are not related to this PR.

@lidavidm

Copy link
Copy Markdown
Member

Agreed, I don't think any of those errors are related. I think we can merge here.

@lidavidm lidavidm closed this in 112fde5 Oct 27, 2021
@ursabot

ursabot commented Oct 27, 2021 •

Copy link
Copy Markdown

Benchmark runs are scheduled for baseline = de11d49 and contender = 112fde5. 112fde5 is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
Conbench compare runs links:
[Finished ⬇️0.0% ⬆️0.0%] ec2-t3-xlarge-us-east-2
[Finished ⬇️2.05% ⬆️0.0%] ursa-i9-9960x
[Finished ⬇️0.89% ⬆️0.36%] ursa-thinkcentre-m75q
Supported benchmarks:
ursa-i9-9960x: langs = Python, R, JavaScript
ursa-thinkcentre-m75q: langs = C++, Java
ec2-t3-xlarge-us-east-2: cloud = True

@cyb70289
cyb70289 deleted the fix-clang-win branch October 28, 2021 00:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants