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

[abseil] Don't override cmake system processor #8577

Closed

Conversation

anton-danielsson
Copy link
Contributor

@anton-danielsson anton-danielsson commented Dec 29, 2021

Specify library name and version: abseil/all

Overriding CMAKE_SYSTEM_PROCESSOR breaks Android builds since
arch is note correctly translated from Conan format to Android format
(like armv8 -> aarch64).


  • I've read the guidelines for contributing.
  • I've followed the PEP8 style guides for Python code in the recipes.
  • I've used the latest Conan client version.
  • I've tried at least one configuration locally with the
    conan-center hook activated.

@ghost
Copy link

ghost commented Dec 29, 2021

I detected other pull requests that are modifying abseil/all recipe:

This message is automatically generated by https://github.com/ericLemanissier/conan-center-conflicting-prs so don't hesitate to report issues/improvements there.

@SpaceIm
Copy link
Contributor

SpaceIm commented Dec 29, 2021

I think another solution could be more robust:

In CMakeLists wrapper:

...
if(NOT DEFINED CMAKE_SYSTEM_PROCESSOR)
    set(CMAKE_SYSTEM_PROCESSOR ${CONAN_ABSEIL_SYSTEM_PROCESSOR})
endif()

add_subdirectory(source_subfolder)

In conanfile.py:

        if tools.cross_building(self):
            self._cmake.definitions["CONAN_ABSEIL_SYSTEM_PROCESSOR"] = str(self.settings.arch)

If a toolchain file has defined CMAKE_SYSTEM_PROCESSOR, conanfile won't override this value, so no more issue in Android toolchain, and if no toolchain has been passed, it will also work out of the box.

@anton-danielsson
Copy link
Contributor Author

I think another solution could be more robust:

In CMakeLists wrapper:

...
if(NOT DEFINED CMAKE_SYSTEM_PROCESSOR)
    set(CMAKE_SYSTEM_PROCESSOR ${CONAN_ABSEIL_SYSTEM_PROCESSOR}
endif()

add_subdirectory(source_subfolder)

In conanfile.py:

        if tools.cross_building(self):
            self._cmake.definitions["CONAN_ABSEIL_SYSTEM_PROCESSOR"] = str(self.settings.arch)

If a toolchain file has defined CMAKE_SYSTEM_PROCESSOR, conanfile won't override this value, so no more issue in Android toolchain, and if no toolchain has been passed, it will also work out of the box.

Yeah, maybe. But I'm not sure why? It's not like any other recipes does this..

@SpaceIm
Copy link
Contributor

SpaceIm commented Dec 29, 2021

Few other recipes do this (arrow, cpu_features, cpuinfo, libjpeg-turbo, libjxl, libpng, libx265, mozjpeg, opencv, opengv, tensorflow-lite, tesseract, xnnpack). It's required as soon as upstream CMakeLists has some logic based on CMAKE_SYSTEM_PROCESSOR (and CMAKE_SYSTEM_PROCESSOR is not defined by CMake when cross-building, and unfortunatly conan doesn't set this value automatically while it could since profile should be the truth).

https://github.com/abseil/abseil-cpp/blob/04610889a913d29037205ca72e9d7fd7acc925fe/absl/copts/AbseilConfigureCopts.cmake#L15-L32

@anton-danielsson
Copy link
Contributor Author

CMAKE_SYSTEM_PROCESSOR

Ah, OK. Didn't know that and I thought Conan set CMAKE_SYSTEM_PROCESSOR automagically.

I will add in your suggestion.

@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

@anton-danielsson
Copy link
Contributor Author

Don't understand how this change could cause this error:

In file included from /home/conan/w/BuildSingleReference/.conan/data/abseil/20200225.2/_/_/build/6557f18ca99c0b6a233f43db00e30efaa525e27e/source_subfolder/absl/types/bad_optional_access.cc:15:
/home/conan/w/BuildSingleReference/.conan/data/abseil/20200225.2/_/_/build/6557f18ca99c0b6a233f43db00e30efaa525e27e/source_subfolder/absl/types/bad_optional_access.h:34:12: error: 'bad_optional_access' has not been declared in 'std'
   34 | using std::bad_optional_access;
      |            ^~~~~~~~~~~~~~~~~~~

[required] abseil/20200225.2@ Linux, GCC

@SpaceIm
Copy link
Contributor

SpaceIm commented Dec 30, 2021

Don't understand how this change could cause this error:

In file included from /home/conan/w/BuildSingleReference/.conan/data/abseil/20200225.2/_/_/build/6557f18ca99c0b6a233f43db00e30efaa525e27e/source_subfolder/absl/types/bad_optional_access.cc:15:
/home/conan/w/BuildSingleReference/.conan/data/abseil/20200225.2/_/_/build/6557f18ca99c0b6a233f43db00e30efaa525e27e/source_subfolder/absl/types/bad_optional_access.h:34:12: error: 'bad_optional_access' has not been declared in 'std'
   34 | using std::bad_optional_access;
      |            ^~~~~~~~~~~~~~~~~~~

[required] abseil/20200225.2@ Linux, GCC

It's unrelated, CI of CCI now tests gcc-11, there is a missing include (<optional>) in bad_optional_access.h that's all. You have to patch it in 20200225.2 source code.
EDIT: actually I see the include but there are some preprocessor logic which might be broken for some reason.

Oh, probably something wrong with #7443

I guess it should be something like this instead:

    def _abseil_abi_config(self):
        """Determine the Abseil ABI for polyfills (absl::any, absl::optional, absl::string_view, and absl::variant)"""
        return "1" if tools.valid_min_cppstd(self, 17) else "0"

@conan-center-bot

This comment has been minimized.

Overriding CMAKE_SYSTEM_PROCESSOR breaks Android builds since
arch is note correctly translated from Conan format to Android format
(like armv8 -> aarch64).
@conan-center-bot

This comment has been minimized.

@anton-danielsson
Copy link
Contributor Author

Don't understand how this change could cause this error:

In file included from /home/conan/w/BuildSingleReference/.conan/data/abseil/20200225.2/_/_/build/6557f18ca99c0b6a233f43db00e30efaa525e27e/source_subfolder/absl/types/bad_optional_access.cc:15:
/home/conan/w/BuildSingleReference/.conan/data/abseil/20200225.2/_/_/build/6557f18ca99c0b6a233f43db00e30efaa525e27e/source_subfolder/absl/types/bad_optional_access.h:34:12: error: 'bad_optional_access' has not been declared in 'std'
   34 | using std::bad_optional_access;
      |            ^~~~~~~~~~~~~~~~~~~

[required] abseil/20200225.2@ Linux, GCC

It's unrelated, CI of CCI now tests gcc-11, there is a missing include (<optional>) in bad_optional_access.h that's all. You have to patch it in 20200225.2 source code. EDIT: actually I see the include but there are some preprocessor logic which might be broken for some reason.

Oh, probably something wrong with #7443

I guess it should be something like this instead:

    def _abseil_abi_config(self):
        """Determine the Abseil ABI for polyfills (absl::any, absl::optional, absl::string_view, and absl::variant)"""
        return "1" if tools.valid_min_cppstd(self, 17) else "0"

Didn't seem to work unfortunately :(

Co-authored-by: SpaceIm <30052553+SpaceIm@users.noreply.github.com>
@conan-center-bot
Copy link
Collaborator

Failure in build 6 (899d2374bfc670089eeab632cfaafdd59812071c):

  • abseil/20200923.2@:
    All packages built successfully! (All logs)

  • abseil/20211102.0@:
    All packages built successfully! (All logs)

  • abseil/20210324.2@:
    All packages built successfully! (All logs)

  • abseil/20210324.1@:
    All packages built successfully! (All logs)

  • abseil/20210324.0@:
    Didn't run or was cancelled before finishing

  • abseil/20200225.3@:
    CI failed to create some packages (All logs)

    Logs for packageID 6557f18ca99c0b6a233f43db00e30efaa525e27e:
    [settings]
    arch=x86_64
    build_type=Release
    compiler=gcc
    compiler.libcxx=libstdc++11
    compiler.version=11
    os=Linux
    
    [...]
    [ 26%] Linking CXX static library ../../../lib/libabsl_random_internal_randen.a
    [ 26%] Built target random_internal_randen
    Scanning dependencies of target base
    [ 27%] Building CXX object source_subfolder/absl/base/CMakeFiles/base.dir/internal/cycleclock.cc.o
    [ 28%] Linking CXX static library ../../../lib/libabsl_scoped_set_env.a
    [ 28%] Built target scoped_set_env
    [ 29%] Building CXX object source_subfolder/absl/base/CMakeFiles/base.dir/internal/spinlock.cc.o
    [ 29%] Building CXX object source_subfolder/absl/base/CMakeFiles/base.dir/internal/sysinfo.cc.o
    [ 30%] Linking CXX static library ../../../lib/libabsl_time_zone.a
    [ 30%] Built target time_zone
    [ 31%] Building CXX object source_subfolder/absl/base/CMakeFiles/base.dir/internal/thread_identity.cc.o
    [ 31%] Building CXX object source_subfolder/absl/base/CMakeFiles/base.dir/internal/unscaledcycleclock.cc.o
    Scanning dependencies of target throw_delegate
    [ 32%] Building CXX object source_subfolder/absl/base/CMakeFiles/throw_delegate.dir/internal/throw_delegate.cc.o
    Scanning dependencies of target bad_optional_access
    [ 32%] Building CXX object source_subfolder/absl/types/CMakeFiles/bad_optional_access.dir/bad_optional_access.cc.o
    [ 33%] Linking CXX static library ../../../lib/libabsl_base.a
    [ 33%] Built target base
    Scanning dependencies of target debugging_internal
    [ 34%] Building CXX object source_subfolder/absl/debugging/CMakeFiles/debugging_internal.dir/internal/address_is_readable.cc.o
    source_subfolder/absl/types/CMakeFiles/bad_optional_access.dir/build.make:62: recipe for target 'source_subfolder/absl/types/CMakeFiles/bad_optional_access.dir/bad_optional_access.cc.o' failed
    CMakeFiles/Makefile2:2689: recipe for target 'source_subfolder/absl/types/CMakeFiles/bad_optional_access.dir/all' failed
    [ 34%] Building CXX object source_subfolder/absl/debugging/CMakeFiles/debugging_internal.dir/internal/elf_mem_image.cc.o
    [ 34%] Linking CXX static library ../../../lib/libabsl_throw_delegate.a
    [ 34%] Built target throw_delegate
    [ 35%] Building CXX object source_subfolder/absl/debugging/CMakeFiles/debugging_internal.dir/internal/vdso_support.cc.o
    [ 35%] Linking CXX static library ../../../lib/libabsl_debugging_internal.a
    [ 35%] Built target debugging_internal
    Makefile:129: recipe for target 'all' failed
    abseil/20200225.3: 
    CMake Warning:
      Manually-specified variables were not used by the project:
    
        CMAKE_EXPORT_NO_PACKAGE_REGISTRY
    
    
    In file included from /home/conan/w/BuildSingleReference/.conan/data/abseil/20200225.3/_/_/build/6557f18ca99c0b6a233f43db00e30efaa525e27e/source_subfolder/absl/types/bad_optional_access.cc:15:
    /home/conan/w/BuildSingleReference/.conan/data/abseil/20200225.3/_/_/build/6557f18ca99c0b6a233f43db00e30efaa525e27e/source_subfolder/absl/types/bad_optional_access.h:34:12: error: 'bad_optional_access' has not been declared in 'std'
       34 | using std::bad_optional_access;
          |            ^~~~~~~~~~~~~~~~~~~
    make[2]: *** [source_subfolder/absl/types/CMakeFiles/bad_optional_access.dir/bad_optional_access.cc.o] Error 1
    make[1]: *** [source_subfolder/absl/types/CMakeFiles/bad_optional_access.dir/all] Error 2
    make[1]: *** Waiting for unfinished jobs....
    make: *** [all] Error 2
    abseil/20200225.3: WARN: Build folder is dirty, removing it: /home/conan/w/BuildSingleReference/.conan/data/abseil/20200225.3/_/_/build/6557f18ca99c0b6a233f43db00e30efaa525e27e
    abseil/20200225.3: ERROR: Package '6557f18ca99c0b6a233f43db00e30efaa525e27e' build failed
    abseil/20200225.3: WARN: Build folder /home/conan/w/BuildSingleReference/.conan/data/abseil/20200225.3/_/_/build/6557f18ca99c0b6a233f43db00e30efaa525e27e
    ERROR: abseil/20200225.3: Error in build() method, line 83
    	cmake.build()
    	ConanException: Error 2 while executing cmake --build '/home/conan/w/BuildSingleReference/.conan/data/abseil/20200225.3/_/_/build/6557f18ca99c0b6a233f43db00e30efaa525e27e' '--' '-j3'
    
  • abseil/20200923.1@:
    Didn't run or was cancelled before finishing

  • abseil/20200225.2@:
    Didn't run or was cancelled before finishing

  • abseil/20200205@:
    Didn't run or was cancelled before finishing

  • abseil/20200923.3@:
    Didn't run or was cancelled before finishing

  • abseil/20200923@:
    Didn't run or was cancelled before finishing


Note: To save resources, CI tries to finish as soon as an error is found. For this reason you might find that not all the references have been launched or not all the configurations for a given reference. Also, take into account that we cannot guarantee the order of execution as it depends on CI workload and workers availability.

@stale
Copy link

stale bot commented Feb 7, 2022

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Feb 7, 2022
@ghost ghost mentioned this pull request Mar 10, 2022
4 tasks
@SSE4
Copy link
Contributor

SSE4 commented Mar 13, 2022

@anton-danielsson there are conflicts, please rebase

@stale stale bot removed the stale label Mar 13, 2022
@SpaceIm
Copy link
Contributor

SpaceIm commented Mar 13, 2022

This PR can be closed, #6383 has fixed this issue.

@SSE4 SSE4 closed this Mar 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants