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

[bug] CMAKE_SYSTEM_PROCESSOR isn't set #8025

Closed
SSE4 opened this issue Nov 7, 2020 · 7 comments
Closed

[bug] CMAKE_SYSTEM_PROCESSOR isn't set #8025

SSE4 opened this issue Nov 7, 2020 · 7 comments

Comments

@SSE4
Copy link
Contributor

SSE4 commented Nov 7, 2020

from conan-io/conan-center-index#3392
/cc @KristianJerpetjon

CMAKE_SYSTEM_PROCESSOR is not set by conan in CMake build helper.
as result, cross-compiling for armv8 fails for certain recipes (at least libpng and libjpeg-turbo)

if the variable is wrong then it selects sse instead of neon.. no need to explain that bit

you get a linker error when trying to link sse assembly into arm compiled code which is obvius

Environment Details (include every applicable attribute)

  • Operating System+version: macOS Catalina
  • Compiler+version: Apple clang version 11.0.3 (clang-1103.0.32.62)
  • Conan version: Conan version 1.31.0-dev
  • Python version: Python 3.8.0

Steps to reproduce (Include if Applicable)

I reproduced it by running:

conan create . libjpeg-turbo/2.0.5@ -k -pr ios

out:

CMake Warning at source_subfolder/simd/CMakeLists.txt:5 (message):
  SIMD extensions not available for this CPU ().  Performance will suffer.

profile:

Configuration for profile ios:

[settings]
os=iOS
os.version=9.0
arch=armv8
compiler=apple-clang
compiler.version=11.0
compiler.libcxx=libc++
build_type=Release
os_build=Macos
arch_build=x86_64
[options]
[build_requires]
[env]

Logs (Executed commands with output) (Include/Attach if Applicable)

cmake_minimum_required(VERSION 2.8.12)
project(cmake_wrapper)
message("CONAN_CMAKE_SYSTEM_PROCESSOR  $ENV{CONAN_CMAKE_SYSTEM_PROCESSOR} ")
message("CMAKE_SYSTEM_PROCESSOR ${CMAKE_SYSTEM_PROCESSOR}")
include(conanbuildinfo.cmake)
conan_basic_setup(NO_OUTPUT_DIRS)
add_subdirectory("source_subfolder")
Result when running conan create is.. 
CONAN_CMAKE_SYSTEM_PROCESSOR   
@theodelrieu
Copy link
Contributor

Don't know if that can help, but here is what I had to do to workaround CMake + iOS issues in darwin-toolchain: https://github.com/theodelrieu/conan-darwin-toolchain/blob/release/1.0.8/darwin-toolchain.cmake

Additionally, here is the related issue I opened on Kitware's GitLab:

@KristianJerpetjon
Copy link

I will retry this but i think its resolved in 1.30+ is that correct?

@memsharded
Copy link
Member

Hi @KristianJerpetjon

Nop, 1.30 added CMAKE_SYSTEM_NAME, but not CMAKE_SYSTEM_PROCESSOR, and this seems to be biting other users like #8081. Hopefully #8026 can fix this.

@KristianJerpetjon
Copy link

kristian@kristian-Zephyrus:~/git/conan-center-index/recipes/libjpeg-turbo/all$ conan create . libjpeg-turbo/2.0.5@ -pr:b x86_64 -pr:h aarch64 -tf None
Exporting package recipe
libjpeg-turbo/2.0.5 exports: File 'conandata.yml' found. Exporting it...
libjpeg-turbo/2.0.5 exports: Copied 1 '.yml' file: conandata.yml
libjpeg-turbo/2.0.5 exports_sources: Copied 1 '.txt' file: CMakeLists.txt
libjpeg-turbo/2.0.5: The stored package has not changed
libjpeg-turbo/2.0.5: Using the exported files summary hash as the recipe revision: bb34052609283182639d4cffaeb76dc2
libjpeg-turbo/2.0.5: Exported revision: bb34052609283182639d4cffaeb76dc2
Configuration (profile_host):
[settings]
arch=armv8
arch_build=x86_64
build_type=Release
compiler=gcc
compiler.libcxx=libstdc++11
compiler.version=9
os=Linux
os_build=Linux
[options]
[build_requires]
*: falcon-sdk/2019.08@huddly/latest
[env]
AR=aarch64-linux-ar
ARCH=arm64
CC=aarch64-linux-gcc
CFLAGS=-march=armv8-a+crc -mtune=cortex-a53 -O3 -pipe -mcpu=cortex-a53
CROSS_COMPILE=aarch64-buildroot-linux-musl-
CXX=aarch64-linux-g++
CXXFLAGS=-march=armv8-a+crc -mtune=cortex-a53 -O3 -pipe -mcpu=cortex-a53
LD=aarch64-linux-ld
OBJCOPY=aarch64-linux-objcopy
OBJDUMP=aarch64-linux-objdump
RANLIB=aarch64-linux-ranlib
STRIP=aarch64-linux-strip
Configuration (profile_build):
[settings]
arch=x86_64
arch_build=x86_64
build_type=Release
compiler=gcc
compiler.libcxx=libstdc++11
compiler.version=7
os=Linux
os_build=Linux
[options]
[build_requires]
[env]
CC=x86_64-linux-gnu-gcc-7
CXX=x86_64-linux-gnu-g++-7
libjpeg-turbo/2.0.5: Forced build from source
Installing package: libjpeg-turbo/2.0.5
Requirements
libjpeg-turbo/2.0.5 from local cache - Cache
Packages
libjpeg-turbo/2.0.5:d074f9bc7163c80f01b053a6e13679cc3772878e - Build
Build requirements
falcon-sdk/2019.08@huddly/latest from 'conan' - Cache
nasm/2.14 from 'conan-center' - Cache
Build requirements packages
falcon-sdk/2019.08@huddly/latest:44fcf6b9a7fb86b2586303e3db40189d3b511830 - Cache
nasm/2.14:44fcf6b9a7fb86b2586303e3db40189d3b511830 - Cache

Cross-build from 'Linux:x86_64' to 'Linux:armv8'
Installing (downloading, building) binaries...
falcon-sdk/2019.08@huddly/latest: Already installed!
nasm/2.14: Already installed!
nasm/2.14: Appending PATH environment variable: /home/kristian/.conan/data/nasm/2.14///package/44fcf6b9a7fb86b2586303e3db40189d3b511830/bin
libjpeg-turbo/2.0.5: Applying build-requirement: falcon-sdk/2019.08@huddly/latest
libjpeg-turbo/2.0.5: Applying build-requirement: nasm/2.14
libjpeg-turbo/2.0.5: WARN: Build folder is dirty, removing it: /home/kristian/.conan/data/libjpeg-turbo/2.0.5///build/d074f9bc7163c80f01b053a6e13679cc3772878e
libjpeg-turbo/2.0.5: Copying sources to build folder
libjpeg-turbo/2.0.5: Building your package in /home/kristian/.conan/data/libjpeg-turbo/2.0.5///build/d074f9bc7163c80f01b053a6e13679cc3772878e
libjpeg-turbo/2.0.5: Generator cmake created conanbuildinfo.cmake
libjpeg-turbo/2.0.5: Calling build()
-- The C compiler identification is GNU 9.1.0
-- The CXX compiler identification is GNU 9.1.0
-- Check for working C compiler: /home/kristian/.conan/data/falcon-sdk/2019.08/huddly/latest/package/44fcf6b9a7fb86b2586303e3db40189d3b511830/bin/aarch64-linux-gcc
-- Check for working C compiler: /home/kristian/.conan/data/falcon-sdk/2019.08/huddly/latest/package/44fcf6b9a7fb86b2586303e3db40189d3b511830/bin/aarch64-linux-gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /home/kristian/.conan/data/falcon-sdk/2019.08/huddly/latest/package/44fcf6b9a7fb86b2586303e3db40189d3b511830/bin/aarch64-linux-g++
-- Check for working CXX compiler: /home/kristian/.conan/data/falcon-sdk/2019.08/huddly/latest/package/44fcf6b9a7fb86b2586303e3db40189d3b511830/bin/aarch64-linux-g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Conan: called by CMake conan helper
-- Conan: called inside local cache
-- Conan: Using cmake global configuration
-- Conan: Adjusting default RPATHs Conan policies
-- Conan: Adjusting language standard
-- Conan: Adjusting fPIC flag (ON)
-- Conan: Compiler GCC>=5, checking major version 9
-- Conan: Checking correct version: 9
-- CMAKE_BUILD_TYPE = Release
-- VERSION = 2.0.5, BUILD = 20201119
CMake Error at source_subfolder/CMakeLists.txt:43 (string):
string no output variable specified

-- 64-bit build ()
-- CMAKE_INSTALL_PREFIX = /home/kristian/.conan/data/libjpeg-turbo/2.0.5///package/d074f9bc7163c80f01b053a6e13679cc3772878e
-- CMAKE_INSTALL_BINDIR = bin (/home/kristian/.conan/data/libjpeg-turbo/2.0.5///package/d074f9bc7163c80f01b053a6e13679cc3772878e/bin)
-- CMAKE_INSTALL_DATAROOTDIR = share (/home/kristian/.conan/data/libjpeg-turbo/2.0.5///package/d074f9bc7163c80f01b053a6e13679cc3772878e/share)
-- CMAKE_INSTALL_DOCDIR = share/doc/libjpeg-turbo (/home/kristian/.conan/data/libjpeg-turbo/2.0.5///package/d074f9bc7163c80f01b053a6e13679cc3772878e/share/doc/libjpeg-turbo)
-- CMAKE_INSTALL_INCLUDEDIR = include (/home/kristian/.conan/data/libjpeg-turbo/2.0.5///package/d074f9bc7163c80f01b053a6e13679cc3772878e/include)
-- CMAKE_INSTALL_LIBDIR = lib (/home/kristian/.conan/data/libjpeg-turbo/2.0.5///package/d074f9bc7163c80f01b053a6e13679cc3772878e/lib)
-- CMAKE_INSTALL_MANDIR = share/man (/home/kristian/.conan/data/libjpeg-turbo/2.0.5///package/d074f9bc7163c80f01b053a6e13679cc3772878e/share/man)
-- Shared libraries disabled (ENABLE_SHARED = 0)
-- Static libraries enabled (ENABLE_STATIC = 1)
-- 12-bit JPEG support disabled (WITH_12BIT = 0)
-- Arithmetic decoding support enabled (WITH_ARITH_DEC = 1)
-- Arithmetic encoding support enabled (WITH_ARITH_ENC = 1)
-- TurboJPEG API library enabled (WITH_TURBOJPEG = 1)
-- TurboJPEG Java wrapper disabled (WITH_JAVA = 0)
-- Emulating libjpeg API/ABI v8.0 (WITH_JPEG7 = 1, WITH_JPEG8 = 1)
-- libjpeg API shared library version = 8.2.2
-- Compiler flags = -march=armv8-a+crc -mtune=cortex-a53 -O3 -pipe -mcpu=cortex-a53 -O3 -DNDEBUG
-- Linker flags =
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of size_t
-- Check size of size_t - done
-- Check size of unsigned long
-- Check size of unsigned long - done
-- Performing Test HAVE_BUILTIN_CTZL
-- Performing Test HAVE_BUILTIN_CTZL - Success
-- Looking for include file locale.h
-- Looking for include file locale.h - found
-- Looking for include file stdlib.h
-- Looking for include file stdlib.h - found
-- Looking for include file sys/types.h
-- Looking for include file sys/types.h - found
-- Looking for memset
-- Looking for memset - found
-- Looking for memcpy
-- Looking for memcpy - found
-- Check size of unsigned char
-- Check size of unsigned char - done
-- Check size of unsigned short
-- Check size of unsigned short - done
-- Performing Test INCOMPLETE_TYPES
-- Performing Test INCOMPLETE_TYPES - Success
-- Compiler supports pointers to undefined structures.
-- Performing Test INLINE_WORKS
-- Performing Test INLINE_WORKS - Success
-- INLINE = inline attribute((always_inline)) (FORCE_INLINE = 1)
-- Performing Test HAVE_THREAD_LOCAL
-- Performing Test HAVE_THREAD_LOCAL - Success
-- THREAD_LOCAL = __thread
-- Performing Test HAVE_VERSION_SCRIPT
-- Performing Test HAVE_VERSION_SCRIPT - Success
-- Linker supports GNU-style version scripts
-- CMAKE_EXECUTABLE_SUFFIX =
CMake Warning at source_subfolder/simd/CMakeLists.txt:5 (message):
SIMD extensions not available for this CPU (). Performance will suffer.
Call Stack (most recent call first):
source_subfolder/simd/CMakeLists.txt:383 (simd_fail)

-- FLOATTEST = 64bit
-- RPM architecture = , DEB architecture =
-- Configuring incomplete, errors occurred!
See also "/home/kristian/.conan/data/libjpeg-turbo/2.0.5///build/d074f9bc7163c80f01b053a6e13679cc3772878e/CMakeFiles/CMakeOutput.log".
libjpeg-turbo/2.0.5:
libjpeg-turbo/2.0.5: ERROR: Package 'd074f9bc7163c80f01b053a6e13679cc3772878e' build failed
libjpeg-turbo/2.0.5: WARN: Build folder /home/kristian/.conan/data/libjpeg-turbo/2.0.5///build/d074f9bc7163c80f01b053a6e13679cc3772878e
ERROR: libjpeg-turbo/2.0.5: Error in build() method, line 125
cmake = self.configure_cmake()
while calling 'configure_cmake', line 110
self.cmake.configure()
ConanException: Error 1 while executing cd '/home/kristian/.conan/data/libjpeg-turbo/2.0.5/
/
/build/d074f9bc7163c80f01b053a6e13679cc3772878e' && cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE="Release" -DCMAKE_SYSTEM_NAME="Linux" -DCONAN_IN_LOCAL_CACHE="ON" -DCONAN_COMPILER="gcc" -DCONAN_COMPILER_VERSION="9" -DBUILD_SHARED_LIBS="OFF" -DCMAKE_INSTALL_PREFIX="/home/kristian/.conan/data/libjpeg-turbo/2.0.5/
//package/d074f9bc7163c80f01b053a6e13679cc3772878e" -DCMAKE_INSTALL_BINDIR="bin" -DCMAKE_INSTALL_SBINDIR="bin" -DCMAKE_INSTALL_LIBEXECDIR="bin" -DCMAKE_INSTALL_LIBDIR="lib" -DCMAKE_INSTALL_INCLUDEDIR="include" -DCMAKE_INSTALL_OLDINCLUDEDIR="include" -DCMAKE_INSTALL_DATAROOTDIR="share" -DCONAN_CMAKE_POSITION_INDEPENDENT_CODE="ON" -DCMAKE_EXPORT_NO_PACKAGE_REGISTRY="ON" -DCONAN_EXPORTED="1" -DENABLE_STATIC="True" -DENABLE_SHARED="False" -DWITH_SIMD="True" -DWITH_ARITH_ENC="True" -DWITH_ARITH_DEC="True" -DWITH_JPEG7="True" -DWITH_JPEG8="True" -DWITH_MEM_SRCDST="False" -DWITH_TURBOJPEG="True" -DWITH_JAVA="False" -DWITH_12BIT="False" -Wno-dev '/home/kristian/.conan/data/libjpeg-turbo/2.0.5//_/build/d074f9bc7163c80f01b053a6e13679cc3772878e'

Yea still an issue!

@memsharded
Copy link
Member

But for some reason, the output is not using CMAKE_SYSTEM_PROCESSOR. I am not sure, maybe @SSE4 can confirm, but the idea would be to run with the branch at #8026, to check if that PR fixes the issue?

@KristianJerpetjon
Copy link

I can try pulling #8026 in and see what happens

@memsharded
Copy link
Member

CMAKE_SYSTEM_PROCESSOR is defined by the new CMakeToolchain integration, long time ago.

Closing tickets as solved.

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 a pull request may close this issue.

4 participants