[GNC-dev] Unable to run test on mac os.

John Ralls jralls at ceridwen.us
Tue Mar 24 13:05:09 EDT 2020


I've figured out what's going wrong with the three gncmodule tests but I don't know what to do about it. Those tests depend on some test modules and their fake implementation libraries that are built in libgnucash/gnc-module/test/(foo|bar|baz|misc-mods). The CMakeLists.txt in those directories include a statement (this one from misc-mods)
  set_target_properties(gncmod-agedver gncmod-futuremodsys gncmod-incompatdep PROPERTIES
  LIBRARY_OUTPUT_DIRECTORY ${LIBDIR_BUILD}/gnucash/test
  ARCHIVE_OUTPUT_DIRECTORY ${LIBDIR_BUILD}/gnucash/test
  RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

The Xcode generator seems to be ignoring that because it's putting all of them in lib/gnucash instead of lib/gnucash/test. One can almost work around that by moving the files to lib/gnucash/test and adding that to the rpath (install_name_tool -add_rpath `pwd`/lib/gnucash/test bin/test-agedver`, etc.) of the affected binaries. Interestingly that breaks other tests. The C ones, test-modsysver, test-incompatdep, and test-dynload, can all be made to pass by also adding lib/gnucash/test to their rpaths. Four others, test-gnc-module-swigged-c, test-gnc-module-load-deps, test-gnc-module-scm-module, and test-gnc-module-scm-multi) also fail after the move. 

Regards,
John Ralls



> On Mar 24, 2020, at 8:34 AM, John Ralls <jralls at ceridwen.us> wrote:
> 
> I pushed to maint and haven't yet merged up.
> 
> Regards,
> John Ralls
> 
>> On Mar 23, 2020, at 9:33 PM, jean <ripngo at gmail.com> wrote:
>> 
>> Did you push to master? Or does this live outside of git? I don't see any change.
>> 
>> On 3/23/20 6:02 PM, John Ralls wrote:
>>> For that solution it should have been CMAKE_CURRENT_BINARY_DIR instead of CMAKE_BINARY_DIR, but I decided instead to add a generator statement so that it would put libgtest.a and libgmock.a where Xcode expects them. I also added CONFIGURATIONS statements to the add_test specs so that all of the tests get run. That's pushed.
>>> The three tests that failed for you fail for me on Xcode too. The problem is that they're gncmodule-loading tests and they can't find the modules they're supposed to load. It's not a dependency problem, the modules are built. I haven't figured out what's wrong yet.
>>> Regards,
>>> John Ralls
>>>> On Mar 23, 2020, at 9:44 AM, Jean Laroche <ripngo at gmail.com> wrote:
>>>> 
>>>> Yes, I wiped everything out, changed common/test-core/CMakeLists.txt and reran the cmake command that creates the xcode project. LMK if I can provide more testing. I'm definitely not familiar with cmake (only started using it at work in the past couple months).
>>>> J.
>>>> 
>>>> On 3/23/20 9:34 AM, John Ralls wrote:
>>>>> Jean,
>>>>> At this point the build messages from libgtest.a are more interesting because that's what we're trying to coerce Xcode into putting somewhere different.
>>>>> I trust that you started fresh from an empty build dir after changing common/test-core/CMakeLists.txt.
>>>>> Regards,
>>>>> John Ralls
>>>>>> On Mar 22, 2020, at 4:04 PM, jean <ripngo at gmail.com> wrote:
>>>>>> 
>>>>>> I tried your suggestion, modified common/test-core/CMakeLists.txt (in the src directory I assume). But I'm still getting the same issue trying to build check.
>>>>>> 
>>>>>> 
>>>>>> Showing Recent Messages
>>>>>> Ld /Users/Shari/gnucash-stable/build_xcode/bin/test-gnc-rational normal x86_64
>>>>>>   cd /Users/Shari/gnucash-stable/src/gnucash-git
>>>>>>   export MACOSX_DEPLOYMENT_TARGET=10.14
>>>>>> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -L/Users/Shari/gnucash-stable/build_xcode/bin -F/Users/Shari/gnucash-stable/build_xcode/bin -filelist /Users/Shari/gnucash-stable/build_xcode/libgnucash/engine/test/gnucash.build/Debug/test-gnc-rational.build/Objects-normal/x86_64/test-gnc-rational.LinkFileList -mmacosx-version-min=10.14 -Xlinker -object_path_lto -Xlinker /Users/Shari/gnucash-stable/build_xcode/libgnucash/engine/test/gnucash.build/Debug/test-gnc-rational.build/Objects-normal/x86_64/test-gnc-rational_lto.o -Xlinker -no_deduplicate -L/usr/local/opt/openblas/lib -Wl,-search_paths_first -Wl,-headerpad_max_install_names -L/Users/Shari/gnucash-stable/lib -lintl -lglib-2.0 -L/Users/Shari/gnucash-stable/lib -lgobject-2.0 -lintl -lglib-2.0 -L/Users/Shari/gnucash-stable/lib -lgmodule-2.0 -lintl -lglib-2.0 -
> L/Users/Shari/gnucash-stable/lib -lgthread-2.0 -lintl -lglib-2.0 -L/Users/Shari/gnucash-stable/lib -licui18n -licuuc -licudata /Users/Shari/gnucash-stable/lib/libboost_date_time.dylib /Users/Shari/gnucash-stable/lib/libboost_regex.dylib /Users/Shari/gnucash-stable/lib/libboost_locale.dylib /Users/Shari/gnucash-stable/lib/libboost_filesystem.dylib /Users/Shari/gnucash-stable/lib/libboost_system.dylib /Users/Shari/gnucash-stable/build_xcode/common/test-core/libgtest.a -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -licui18n -licuuc -licudata /Users/Shari/gnucash-stable/lib/libboost_date_time.dylib /Users/Shari/gnucash-stable/lib/libboost_regex.dylib /Users/Shari/gnucash-stable/lib/libboost_locale.dylib /Users/Shari/gnucash-stable/lib/libboost_filesystem.dylib /Users/Shari/gnucash-stable/lib/libboost_system.dylib /Users/Shari/gnucash-stable/build_xcode/common/test-core/libgtest.a -Xlinker -dependency_info -Xlinker /Users/Shari/gnucash-stable/build_xcode/libgnucash/engine/test/gnucash.build/
> Debug/test-gnc-rational.build/Objects-normal/x86_64/test-gnc-rational_dependency_info.dat -o /Users/Shari/gnucash-stable/build_xcode/bin/test-gnc-rational
>>>>>> 
>>>>>> clang: error: no such file or directory: '/Users/Shari/gnucash-stable/build_xcode/common/test-core/libgtest.a'
>>>>>> clang: error: no such file or directory: '/Users/Shari/gnucash-stable/build_xcode/common/test-core/libgtest.a'
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> On 3/22/20 3:25 PM, John Ralls wrote:
>>>>>>>> On Mar 22, 2020, at 2:48 PM, jean <ripngo at gmail.com> wrote:
>>>>>>>> 
>>>>>>>> clang: error: no such file or directory: '/Users/Shari/gnucash-stable/build_xcode/common/test-core/libgtest.a'
>>>>>>>> clang: error: no such file or directory: '/Users/Shari/gnucash-stable/build_xcode/common/test-core/libgtest.a'
>>>>>>>> 
>>>>>>>> The missing .a files are here:
>>>>>>>> ./common/test-core/Debug/libgtest.a
>>>>>>>> 
>>>>>>>> I.e. xcode expects common/test-core/libgtest.a but instead I have ./common/test-core/Debug/libgtest.a
>>>>>>> That's because Xcode lets you select the build type from the GUI and of course Cmake doesn't know about that at configure time so it can't adjust the locations. I'm actually a bit surprised that this is the only thing that broke.
>>>>>>> This stackoverflow seems to address the problem: https://stackoverflow.com/questions/18393813/how-do-i-suppress-xcode-from-generating-a-folder-named-after-the-build-configura
>>>>>>> Since it's just ligbtest maybe just tweaking that one target will work. Try adding to common/test-core/CMakeLists.txt at line 80
>>>>>>>    if (CMAKE_GENERATOR STREQUAL Xcode)
>>>>>>>       set_target_properties(gtest PROPERTIES
>>>>>>>                             ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}
>>>>>>>                             ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}
>>>>>>>                             )
>>>>>>>    endif()
>>>>>>> and re-run cmake.
>>>>>>> Regards,
>>>>>>> John Ralls
> 
> _______________________________________________
> gnucash-devel mailing list
> gnucash-devel at gnucash.org
> https://lists.gnucash.org/mailman/listinfo/gnucash-devel



More information about the gnucash-devel mailing list