Skip to content

Conversation

@kou
Copy link
Member

@kou kou commented Feb 17, 2019

This is needed to build tests with MinGW.

@@ -53,7 +53,8 @@ CMAKE_COMMON_FLAGS="\
-DARROW_NO_DEPRECATED_API=ON \
-DARROW_EXTRA_ERROR_CONTEXT=ON"
CMAKE_LINUX_FLAGS=""
CMAKE_OSX_FLAGS=""
CMAKE_OSX_FLAGS="\
-DARROW_GFLAGS_USE_SHARED=OFF"
Copy link
Member Author

Choose a reason for hiding this comment

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

Because @rpath can't be resolved with GFlags installed by conda-forge.

https://travis-ci.org/kou/arrow/jobs/494364820#L1993

 2/111 Test   #1: plasma-serialization_tests ...................***Failed    1.36 sec
Running plasma-serialization_tests, redirecting output into /Users/travis/build/kou/arrow/cpp-build/build/test-logs/plasma-serialization_tests.txt (attempt 1/1)
dyld: Library not loaded: @rpath/libgflags.2.2.dylib
 Referenced from: /Users/travis/build/kou/arrow/cpp-install/lib/libarrow.13.dylib
 Reason: image not found

We will be able to resolve it by running each test with DYLD_LIBRARY_PATH environment variable:

DYLD_LIBRARY_PATH=${MINICONDA}/lib ${ARROW_BUILD_TYPE}/plasma-serialization_tests

Because DYLD_LIBRARY_PATH can affect only the child process.

It's not useful. So I use static library than shared library.

Copy link
Member

Choose a reason for hiding this comment

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

This is working for all other libraries? Then there must be something wrong with libgflags.

Copy link
Member Author

Choose a reason for hiding this comment

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

Other libraries are used as static library. So they work.

gflags-config.cmake provides @rpath/libgflags.2.2.dylib for IMPORTED_LOCATION. If gflags-config.cmake doesn't use @rpath, this will not be caused.

Generally, using @rpath isn't bad. GFlags installed from conda-forge can't assume where it's installed. So I think that using @rpath is reasonable for this case.

We will be able to resolve @rpath in our FindGFlags.cmake. This is another solution.

We can specify DYLD_LIBRARY_PATH to resolve @rpath in cpp/build-support/run-test.sh. This is also another solution.

@kou
Copy link
Member Author

kou commented Feb 17, 2019

A job on AppVeyor is failed:

https://ci.appveyor.com/project/ApacheSoftwareFoundation/arrow/builds/22428811/job/p36y88oj2ja8on1t#L1236

gflags_static.lib(gflags.cc.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0' in json-integration-test.cc.obj
gflags_static.lib(gflags.cc.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MTd_StaticDebug' doesn't match value 'MT_StaticRelease' in json-integration-test.cc.obj
gflags_static.lib(gflags_reporting.cc.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0' in json-integration-test.cc.obj
gflags_static.lib(gflags_reporting.cc.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MTd_StaticDebug' doesn't match value 'MT_StaticRelease' in json-integration-test.cc.obj
gflags_static.lib(gflags_completions.cc.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0' in json-integration-test.cc.obj
gflags_static.lib(gflags_completions.cc.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MTd_StaticDebug' doesn't match value 'MT_StaticRelease' in json-integration-test.cc.obj
libcpmtd.lib(stdthrow.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0' in json-integration-test.cc.obj
libcpmtd.lib(stdthrow.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MTd_StaticDebug' doesn't match value 'MT_StaticRelease' in json-integration-test.cc.obj
   Creating library release\arrow-json-integration-test.lib and object release\arrow-json-integration-test.exp
LINK : warning LNK4098: defaultlib 'LIBCMTD' conflicts with use of other libs; use /NODEFAULTLIB:library
gflags_static.lib(gflags.cc.obj) : error LNK2019: unresolved external symbol _calloc_dbg referenced in function "char * __cdecl std::_Maklocstr<char>(char const *,char *,struct _Cvtvec const &)" (??$_Maklocstr@D@std@@YAPEADPEBDPEADAEBU_Cvtvec@@@Z)
gflags_static.lib(gflags_completions.cc.obj) : error LNK2001: unresolved external symbol _calloc_dbg
gflags_static.lib(gflags.cc.obj) : error LNK2019: unresolved external symbol _free_dbg referenced in function "private: void __cdecl std::_Yarn<char>::_Tidy(void)" (?_Tidy@?$_Yarn@D@std@@AEAAXXZ)
gflags_static.lib(gflags_completions.cc.obj) : error LNK2001: unresolved external symbol _free_dbg
gflags_static.lib(gflags.cc.obj) : error LNK2019: unresolved external symbol _malloc_dbg referenced in function "public: static void * __cdecl std::_Crt_new_delete::operator new(unsigned __int64,struct std::nothrow_t const &)" (??2_Crt_new_delete@std@@SAPEAX_KAEBUnothrow_t@1@@Z)
gflags_static.lib(gflags_completions.cc.obj) : error LNK2001: unresolved external symbol _malloc_dbg
gflags_static.lib(gflags.cc.obj) : error LNK2019: unresolved external symbol _CrtDbgReportW referenced in function "public: bool __cdecl std::_Tree_const_iterator<class std::_Tree_val<struct std::_Tree_simple_types<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > > >::operator==(class std::_Tree_const_iterator<class std::_Tree_val<struct std::_Tree_simple_types<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > > > const &)const " (??8?$_Tree_const_iterator@V?$_Tree_val@U?$_Tree_simple_types@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V12@@std@@@std@@@std@@@std@@QEBA_NAEBV01@@Z)
gflags_static.lib(gflags_reporting.cc.obj) : error LNK2001: unresolved external symbol _CrtDbgReportW
gflags_static.lib(gflags_completions.cc.obj) : error LNK2001: unresolved external symbol _CrtDbgReportW
libcpmtd.lib(stdthrow.obj) : error LNK2001: unresolved external symbol _CrtDbgReportW
release\arrow-json-integration-test.exe : fatal error LNK1120: 4 unresolved externals

Using vendored version for this case is expected. Build type may be conflicted. I need to look into this.

@@ -44,6 +44,7 @@ if "%JOB%" == "Static_Crt_Build" (
cmake --build . --config Debug || exit /B
ctest --output-on-failure -j2 || exit /B
popd
rmdir /S /Q cpp\build-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.

Because find_package(gflags CONFIG) can find GFlags in cpp\build-debug\gflags_ep-prefix\.

@kou
Copy link
Member Author

kou commented Feb 18, 2019

CI is passed.
Now, this is ready to review.

kou and others added 6 commits February 18, 2019 19:02
@wesm wesm force-pushed the cpp-system-gflags branch from 7ce098c to 38f910f Compare February 19, 2019 01:03
Copy link
Member

@wesm wesm left a comment

Choose a reason for hiding this comment

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

+1. I rebased, will merge once the build passes

@kou
Copy link
Member Author

kou commented Feb 19, 2019

CI is green. I'll merge this.

@kou kou closed this in 24a98e4 Feb 19, 2019
@kou kou deleted the cpp-system-gflags branch February 20, 2019 00:26
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.

3 participants