Skip to content

Conversation

@xhochy
Copy link
Member

@xhochy xhochy commented Feb 18, 2019

This changes refactors much of our CMake logic to make use of built-in CMake paths and remove custom logic. It also switches to the use of more modern dependency management via CMake targets instead of plain text variables.

This includes the following fixes:

@xhochy
Copy link
Member Author

xhochy commented Feb 18, 2019

This can be tested using docker-compose build cpp-fedora && docker-compose run cpp-fedora. The build passes beyond the problems reported at https://issues.apache.org/jira/browse/ARROW-4242 but arrow::int32() sadly returns a null pointer and I guess that this is still a compiler bug.

Copy link
Contributor

Choose a reason for hiding this comment

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

OR (OMPILER

I think you need to references variables with $ in here, not sure why cmake isn't complaining.

Copy link
Member Author

Choose a reason for hiding this comment

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

No need for $ for the variables here. VERSION_LESS works with variable names. Although I hoped that it would be complaining about OMPILER_VERSION.

Copy link
Member

Choose a reason for hiding this comment

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

nit: run these in a single layer

Copy link
Member

@kou kou left a comment

Choose a reason for hiding this comment

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

I leave some comments but I like this approach.

Copy link
Member

Choose a reason for hiding this comment

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

DOUBLE_CONVERSION_LIBRARIES will be better for consistency.

Copy link
Member Author

Choose a reason for hiding this comment

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

I used double-conversion_LIBRARIES as this is what double-conversion's CMake targets provides.

Copy link
Member

Choose a reason for hiding this comment

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

(Ah, *_LIBRARY is better than*_LIBRARIES.)
*_LIBRARY is our rule for specifying the correct target. So I think that we can use our naming rule (XXX_LIBRARY) instead of double-conversion's naming rule here.
But this is a trivial. I don't care with double-conversion_LIBRARY.

Copy link
Member

Choose a reason for hiding this comment

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

set_target_property(double-conversion::double-conversion INTERFACE_INCLUDE_DIRECTORIES "${DOUBLE_CONVERSION_PREFIX}/include") will be better than this and `include_directories(${double_conversion_INCLUDE_DIRS})".

Copy link
Member

Choose a reason for hiding this comment

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

+1 (if possible)

Copy link
Member

Choose a reason for hiding this comment

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

Do we set(double-convertion_ROOT $ENV{CONDA_PREFIX}) here?

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if (NOT ${double-conversion_FOUND})
if(${double-conversion_FOUND})
double_conversion_config()
else()
build_double_conversion()
endif()

will be more readable.

@kszucs
Copy link
Member

kszucs commented Feb 21, 2019

Please add an entry to the nightly tests too https://github.com/apache/arrow/blob/master/dev/tasks/tests.yml#L21

@xhochy xhochy changed the title [WIP] Add Dockerfile for fedora:29 ARROW-4611: [C++] Rework CMake logic Feb 24, 2019
@xhochy
Copy link
Member Author

xhochy commented Feb 24, 2019

@wesm This is currently badly red for me in Travis due to the simple fact that we install all our dependencies for GCC 5.4 into a conda environment but don't activate this conda environment then. I don't think this is the way we should use the packages. I'll have a look tomorrow and will probably add a conda activate to the CI job.

@xhochy xhochy force-pushed the build-on-fedora branch 2 times, most recently from 151a8d0 to 186ff04 Compare February 25, 2019 16:04
@xhochy xhochy force-pushed the build-on-fedora branch 12 times, most recently from e29d996 to e2ce187 Compare February 28, 2019 12:38
@pitrou
Copy link
Member

pitrou commented Feb 28, 2019

Since we are talking about redoing all the CMake dependency logic, here is a wild idea: one PITA with cmake is that find_package can't be used on a project built with ExternalProject, so you have to use a different mechanism, hardcode library paths, etc. So how about locating or building dependencies in a separate CMake project? Then the main CMake project can always use find_package, which would simplify the logic a lot.

@xhochy
Copy link
Member Author

xhochy commented Feb 28, 2019

Since we are talking about redoing all the CMake dependency logic, here is a wild idea: one PITA with cmake is that find_package can't be used on a project built with ExternalProject, so you have to use a different mechanism, hardcode library paths, etc. So how about locating or building dependencies in a separate CMake project? Then the main CMake project can always use find_package, which would simplify the logic a lot.

This would definitely simplify the logic a bit more but would also introduce some inconvenience to the user again to get a first running Arrow setup. After juggling around so much with the CMake code, I'd rather keep the logic with the external projects. If we were to separate this out into another project, we would also need to share logic what really needs to be built.

@xhochy xhochy force-pushed the build-on-fedora branch 2 times, most recently from ad5c1ba to 21e88e6 Compare March 1, 2019 17:46
@wesm
Copy link
Member

wesm commented Mar 6, 2019

On Windows, it looks like the wrong libraries are being linked in the toolchain build:

-- Found GTest: C:/Miniconda36-x64/envs/arrow/Library/lib/gtest-md.lib  
-- Performing Test GTEST_COMPILES_WITHOUT_MACRO
-- Performing Test GTEST_COMPILES_WITHOUT_MACRO - Failed
-- Setting GTEST_LINKED_AS_SHARED_LIBRARY=1 on GTest::GTest
-- RapidJSON found. Headers: C:/Miniconda36-x64/envs/arrow/Library/include
-- Found ZLIB: C:/Miniconda36-x64/envs/arrow/Library/lib/z.lib (found version "1.2.11") 

According to https://github.com/conda-forge/gtest-feedstock/blob/master/recipe/bld.bat#L88 it should be using gtest_dll-md.lib

@xhochy
Copy link
Member Author

xhochy commented Mar 6, 2019

@fsaintjacques Can you post the output of CMake? Please ensure that you have cleaned your build directory first.

@wesm Yes, the Windows issue would need some help. I'm still struggling with getting a basic Arrow build working on Windows. We also need to decide on what to do with the Valgrind errors. They look quite confusing to me and I suspect a bit that this due to clang-7 and not our code. My preference at the moment would be to move the Valgrind runs into the conda-forge toolchain job.,

@fsaintjacques
Copy link
Contributor

Attached cmake.log

@fsaintjacques
Copy link
Contributor

fsaintjacques commented Mar 6, 2019

@xhochy the second valgrind failure is due unrecognized AVX instruction: https://travis-ci.org/apache/arrow/jobs/502177486#L5353-L5356

This is a valgrind problem, not always reproducible because libc (and I suspect libstc++) will dispatch function implementation at runtime depending on the supported cpu features.

The first failure is a failed assertion. Either we upgrade valgrind (ugh), or ignore the 2 tests.

appveyor.yml Outdated
Copy link
Contributor

Choose a reason for hiding this comment

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

For debug?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, will remove before merge.

Copy link
Contributor

Choose a reason for hiding this comment

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

Should we just vendor it then, I don't think we expose any symbols?

Copy link
Contributor

Choose a reason for hiding this comment

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

This does not work locally when using dependency AUTO without conda. It seems that find_package(benchmark) "finds" it but

  • benchmark_FOUND=1
  • benchmark_INCLUDE_DIR=
  • benchmark_LIBRARY=

I'm not sure if this is an issue with libbenchmark-dev cmake's config definition.

Copy link
Member Author

Choose a reason for hiding this comment

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

On which system did you have this combination?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ubuntu 18.04, with libbenchmark-dev installed.

Copy link
Member Author

Choose a reason for hiding this comment

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

Will add a Dockerfile for this then.

Copy link
Member Author

Choose a reason for hiding this comment

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

Found the problem. Empty benchmark_INCLUDE_DIR and benchmark_LIBRARY are expected, we only need the targets benchmark::benchmark and benchmark::benchmark_main. The latter is just not yet available in the version of benchmark. So to support benchmarks on Ubuntu 18.04, we need to compile our own benchmark main.

Copy link
Contributor

Choose a reason for hiding this comment

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

Something odd is happening, it uses another build directory downloaded rapidjson:

-- RapidJSON found. Headers: /home/fsaintjacques/src/db/arrow/cpp/flight-build/rapidjson_ep/src/rapidjson_ep-install/include

@wesm
Copy link
Member

wesm commented Mar 14, 2019

Looking at this. Going to see if I can resolve the Windows issue

@wesm
Copy link
Member

wesm commented Mar 14, 2019

I don't know what's wrong with the conda-forge *-md.lib libraries. Removing the incorrect GTEST_BUILD_AS_SHARED_LIBRARY flag I get the following linking error

Link:
  C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64\link.exe /ERRORREPORT:QUEUE /OUT:"C:\Users\wesmc\code\arrow\cpp\build\relea
  se\Release\arrow-compute-util-internal-test.exe" /INCREMENTAL:NO /NOLOGO ..\..\..\..\release\Release\arrow_testing.lib ..\..\..\..\release\Relea
  se\arrow.lib "C:\Miniconda\envs\arrow-dev\Library\lib\double-conversion.lib" "C:\Miniconda\envs\arrow-dev\Library\lib\brotlienc.lib" "C:\Minicon
  da\envs\arrow-dev\Library\lib\brotlidec.lib" "C:\Miniconda\envs\arrow-dev\Library\lib\brotlicommon.lib" "C:\Miniconda\envs\arrow-dev\Library\lib
  \double-conversion.lib" "C:\Miniconda\envs\arrow-dev\Library\lib\boost_system.lib" "C:\Miniconda\envs\arrow-dev\Library\lib\boost_filesystem.lib
  " "C:\Miniconda\envs\arrow-dev\Library\lib\boost_regex.lib" "C:\Miniconda\envs\arrow-dev\Library\lib\gtest_main-md.lib" "C:\Miniconda\envs\arrow
  -dev\Library\lib\gtest-md.lib" "C:\Miniconda\envs\arrow-dev\Library\lib\gmock-md.lib" kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib
   ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /NODEFAULTLIB:LIBCMT /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /man
  ifest:embed /PDB:"C:/Users/wesmc/code/arrow/cpp/build/release/Release/arrow-compute-util-internal-test.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMIC
  BASE /NXCOMPAT /IMPLIB:"C:/Users/wesmc/code/arrow/cpp/build/release/Release/arrow-compute-util-internal-test.lib" /MACHINE:X64  /machine:x64 "ar
  row-compute-util-internal-test.dir\Release\util-internal-test.obj"
  gtest-md.lib(gtest-all.obj) : MSIL .netmodule or module compiled with /GL found; restarting link with /LTCG; add /LTCG to the link command line
  to improve linker performance
util-internal-test.obj : error LNK2001: unresolved external symbol "class testing::internal::Mutex testing::internal::g_gmock_mutex" (?g_gmock_mut ex@internal@testing@@3VMutex@12@A) [C:\Users\wesmc\code\arrow\cpp\build\src\arrow\compute\kernels\arrow-compute-util-internal-test.vcxproj]
util-internal-test.obj : error LNK2001: unresolved external symbol "class testing::internal::ThreadLocal<class testing::Sequence *> testing::inter nal::g_gmock_implicit_sequence" (?g_gmock_implicit_sequence@internal@testing@@3V?$ThreadLocal@PEAVSequence@testing@@@12@A) [C:\Users\wesmc\code\ar row\cpp\build\src\arrow\compute\kernels\arrow-compute-util-internal-test.vcxproj]
C:\Users\wesmc\code\arrow\cpp\build\release\Release\arrow-compute-util-internal-test.exe : fatal error LNK1120: 2 unresolved externals [C:\Users\w esmc\code\arrow\cpp\build\src\arrow\compute\kernels\arrow-compute-util-internal-test.vcxproj]
Done Building Project "C:\Users\wesmc\code\arrow\cpp\build\src\arrow\compute\kernels\arrow-compute-util-internal-test.vcxproj" (default targets) - - FAILED.


Build FAILED.

"C:\Users\wesmc\code\arrow\cpp\build\src\arrow\compute\kernels\arrow-compute-util-internal-test.vcxproj" (default target) (1) ->
(Link target) ->
  util-internal-test.obj : error LNK2001: unresolved external symbol "class testing::internal::Mutex testing::internal::g_gmock_mutex" (?g_gmock_m utex@internal@testing@@3VMutex@12@A) [C:\Users\wesmc\code\arrow\cpp\build\src\arrow\compute\kernels\arrow-compute-util-internal-test.vcxproj]
  util-internal-test.obj : error LNK2001: unresolved external symbol "class testing::internal::ThreadLocal<class testing::Sequence *> testing::int ernal::g_gmock_implicit_sequence" (?g_gmock_implicit_sequence@internal@testing@@3V?$ThreadLocal@PEAVSequence@testing@@@12@A) [C:\Users\wesmc\code\ arrow\cpp\build\src\arrow\compute\kernels\arrow-compute-util-internal-test.vcxproj]
  C:\Users\wesmc\code\arrow\cpp\build\release\Release\arrow-compute-util-internal-test.exe : fatal error LNK1120: 2 unresolved externals [C:\Users \wesmc\code\arrow\cpp\build\src\arrow\compute\kernels\arrow-compute-util-internal-test.vcxproj]

    0 Warning(s)
    3 Error(s)

Time Elapsed 00:00:01.46

It isn't reasonable to block the patch on this issue. Using -DGTest_SOURCE=BUNDLED seems to make the build run for me (I'm doing an ALL_BUILD to make sure). I'm going to push this change. Can we merge as soon as we get a green build?

@wesm wesm force-pushed the build-on-fedora branch from dcb1ce2 to 367ab24 Compare March 14, 2019 03:53
@wesm
Copy link
Member

wesm commented Mar 14, 2019

I just pushed my changes so you can look at the diff, I think you'll want to squash before merging to make sure you get "credit" (the merge script tie breaks based on the most recent commit for some reason)

@xhochy
Copy link
Member Author

xhochy commented Mar 14, 2019

@kou Can you have a look at this?

@xhochy
Copy link
Member Author

xhochy commented Mar 14, 2019

Windows failures are due to #3885, I'm taking care of Plasma on OSX now.

@wesm
Copy link
Member

wesm commented Mar 14, 2019

+1, bombs away. I'll look at the ZSTD issue shortly

@wesm wesm closed this in 5114be6 Mar 14, 2019
@wesm wesm deleted the build-on-fedora branch March 14, 2019 15:11
@kou
Copy link
Member

kou commented Mar 14, 2019

@xhochy Sorry for not having a look at this! I'll create a pull request when I find something as usual. Thanks for doing this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants