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

[libjpeg-turbo] Fixes cross compilation for armv8 #3392

Closed

Conversation

KristianJerpetjon
Copy link
Contributor

@KristianJerpetjon KristianJerpetjon commented Nov 3, 2020

Specify library name and version: libjpeg-turbo/all

  • 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.

@conan-center-bot
Copy link
Collaborator

All green in build 1 (bd2cf3f0d0348f15c6263b52441409a402611b4e)! 😊

Comment on lines +96 to +97
if tools.cross_building(self.settings):
tools.replace_in_file(os.path.join(self._source_subfolder,"CMakeLists.txt"),"CMAKE_SYSTEM_PROCESSOR","CMAKE_SYSTEM_PROCESSOR_TARGET")
Copy link
Contributor

@SpaceIm SpaceIm Nov 3, 2020

Choose a reason for hiding this comment

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

patch in build() instead of source() please.
What is CMAKE_SYSTEM_PROCESSOR_TARGET? CMAKE_SYSTEM_PROCESSOR is already the target architecture.

Comment on lines +146 to +149
if not self.options.keep_binaries:
for pattern_to_remove in ["cjpeg*", "djpeg*", "jpegtran*", "tjbench*", "wrjpgcom*", "rdjpgcom*", "*.pdb"]:
for bin_file in glob.glob(os.path.join(self.package_folder, "bin", pattern_to_remove)):
os.remove(bin_file)
Copy link
Contributor

Choose a reason for hiding this comment

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

don't keep pdb files.

Copy link
Contributor

@SSE4 SSE4 Nov 3, 2020

Choose a reason for hiding this comment

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

yes, this is unrelated change

Copy link
Contributor

Choose a reason for hiding this comment

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

If the executables are already generated, why removing them from the package? I would say that storage is not an issue nowadays (at least, it isn't for us in ConanCenter). I would remove keep_binaries option and keep these binaries in the package.

Copy link
Contributor

Choose a reason for hiding this comment

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

@KristianJerpetjon
We have an issue for discussing including pdbs: #1982
#1982 (comment) seems to suggest a conan feature will be added for handling pdb's.

@Croydon
Copy link
Contributor

Croydon commented Nov 3, 2020

Doesn't this sound like something that Conan cross-building features should be able to handle? It is certainly impracticable adding a keep_binaries to every recipe

@SSE4 SSE4 requested review from danimtb and uilianries November 3, 2020 14:13

def _configure_cmake(self):
if self._cmake:
return self._cmake
self._cmake = CMake(self, set_cmake_flags=True)
if tools.cross_building(self.settings):
if self.settings.arch == "armv8":
self._cmake.definitions["CMAKE_SYSTEM_PROCESSOR_TARGET"] = "aarch64"
Copy link
Contributor

Choose a reason for hiding this comment

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

not sure why the only armv8 is affected? maybe there is a wider conan issue? /cc @jgsogo

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm with @SpaceIm , I don't know what is CMAKE_SYSTEM_PROCESSOR_TARGET, I cannot find it in CMake docs.

Copy link
Contributor

@prince-chrismc prince-chrismc Nov 4, 2020

Choose a reason for hiding this comment

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

maybe it was supposed to be https://cmake.org/cmake/help/v3.1/variable/CMAKE_SYSTEM_PROCESSOR.html ?

The OP is replacing the standard variable with a custom one for the recipe

@madebr
Copy link
Contributor

madebr commented Nov 4, 2020

I don't fully understand what you're trying to fix.
Has it something to do with this? https://github.com/libjpeg-turbo/libjpeg-turbo/blob/c3bfbde21d81438b731aeefa69011024e8ae08c2/CMakeLists.txt#L57-L64

What is the value of CMAKE_SYSTEM_PROCESSOR that cmake detects when using arm architecture?

Conan has a way to overload some cmake defaults: see https://docs.conan.io/en/latest/reference/build_helpers/cmake.html#definitions
You can add libjpeg-turbo:CONAN_CMAKE_SYSTEM_PROCESSOR=aarch64 to your profile.
But better would be to create a proper cmake toolchain file and add it to the CONAN_CMAKE_TOOLCHAIN environment variable.
See https://docs.conan.io/en/latest/reference/env_vars.html#cmake-related-variables

@SSE4
Copy link
Contributor

SSE4 commented Nov 4, 2020

@KristianJerpetjon I don't think it's a right place to have a fix in the recipe(s). I also don't think it's correct to have it exclusively for amrv8.
reading docs I see:

CMAKE_SYSTEM_PROCESSOR : optional, processor (or hardware) of the
target system. This variable is not used very much except for one
purpose, it is used to load a
CMAKE_SYSTEM_NAME-compiler-CMAKE_SYSTEM_PROCESSOR.cmake file,
which can be used to modify settings like compiler flags etc. for
the target. You probably only have to set this one if you are using
a cross compiler where every target hardware needs special build
settings.

so it gives me the impression that CMAKE_SYSTEM_PROCESSOR is optional and shouldn't be vital.
we also don't set this variable by default at all: https://github.com/conan-io/conan/blob/6287050a4ca74f47bdcccbb82a66eb749046fa8b/conans/client/build/cmake_flags.py#L224

I'd recommend:

  1. open conan issue https://github.com/conan-io/conan/issues/new/choose
  2. attach logs so we can understand what exactly fails in your case

I believe the correct fix may require setting CMAKE_SYSTEM_PROCESSOR and CMAKE_HOST_SYSTEM_PROCESSOR in conan, and having a mapping for all the supported architectures (not just armv8).

@SSE4 SSE4 changed the title Fixes cross compilation for armv8 [libjpeg-turbo] Fixes cross compilation for armv8 Nov 7, 2020
@conan-center-bot
Copy link
Collaborator

All green in build 2 (bd2cf3f0d0348f15c6263b52441409a402611b4e)! 😊

@SSE4
Copy link
Contributor

SSE4 commented Nov 7, 2020

created conan-io/conan#8025

@ghost
Copy link

ghost commented Nov 22, 2020

I detected other pull requests that are modifying libjpeg-turbo recipe:

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

@ghost ghost mentioned this pull request Nov 22, 2020
4 tasks
@stale
Copy link

stale bot commented Dec 22, 2020

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 Dec 22, 2020
@ghost ghost mentioned this pull request Jan 7, 2021
4 tasks
@stale
Copy link

stale bot commented Jan 21, 2021

This pull request has been automatically closed because it has not had recent activity. Thank you for your contributions.

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.

8 participants