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

SSE is detected incorrectly on ARM cpu with Clang #1197

Closed
Karry opened this issue Jan 8, 2022 · 5 comments
Closed

SSE is detected incorrectly on ARM cpu with Clang #1197

Karry opened this issue Jan 8, 2022 · 5 comments
Labels
build For issues in the context of building the software help wanted Signal that help of other is appreciated

Comments

@Karry
Copy link
Collaborator

Karry commented Jan 8, 2022

On Czech OSM mailing list, I suggested to one user with Pinephone and Posh to try Osmin. But he replied that compilation fails (with Clang). Osmin setup OSMSCOUT_ENABLE_SSE to true when it is not compiling for Android. It should not be problem, build system should detect when SSE is available for current platform. It works fine with GCC, but Clang tries to compile SSE code on arm cpu!

I was able to reproduce it on my Raspberry:

CC=clang CXX=clang++ cmake -DCMAKE_BUILD_TYPE=Debug -DOSMSCOUT_ENABLE_SSE=ON .. 
...
-- Performing Test HAVE_ALTIVEC
-- Performing Test HAVE_ALTIVEC - Failed
-- Performing Test HAVE_AVX
-- Performing Test HAVE_AVX - Success
-- Performing Test HAVE_MMX
-- Performing Test HAVE_MMX - Success
-- Performing Test HAVE_SSE
-- Performing Test HAVE_SSE - Success
-- Performing Test HAVE_SSE2
-- Performing Test HAVE_SSE2 - Success
-- Performing Test HAVE_SSE3
-- Performing Test HAVE_SSE3 - Success
-- Performing Test HAVE_SSE4_1
-- Performing Test HAVE_SSE4_1 - Success
-- Performing Test HAVE_SSE4_2
-- Performing Test HAVE_SSE4_2 - Success
-- Performing Test HAVE_SSSE3
-- Performing Test HAVE_SSSE3 - Success
...

It is check by this cmake function: check_c_compiler_flag(-msse2 HAVE_SSE2). It seems that we should verify function availability by try_compile()

@Karry Karry added build For issues in the context of building the software help wanted Signal that help of other is appreciated labels Jan 8, 2022
@Karry
Copy link
Collaborator Author

Karry commented Jan 8, 2022

Or should be SSE disabled in Osmin? cc @janbar

@nesnera
Copy link

nesnera commented Jan 10, 2022

With Karry's suggested modifications (thanks for the support) and the following prerequisites I was able to complete the build on the PinePhone Manjaro/Phosh-dev (packages)
Additional prerequisites: cmake, clang, make, qt5-quickcontrols2, qt5-sensors, qt5-multimedia, openmp, make, openmp, qt5-graphicaleffects.
Launch fails with this output:

[manjaro@manjaro-arm build]$ ./osmin
Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
Signal handler is enabled.
User locale setting is C
using file ':/i18n/osmin_en.qm' for translations.
Checking installed assets...
Found assets version 1.7.0
Resource directory is /home/manjaro/osmin/resources
Found hillshade tile server file '/home/manjaro/osmin/resources/hillshade-tile-server.json'
Loading online tile providers from  "/home/manjaro/osmin/resources/online-tile-providers.json"
Loading providers from  "/home/manjaro/osmin/resources/map-providers.json"
Loading providers from  "/home/manjaro/osmin/resources/voice-providers.json"
MapManager ctor
Lookup databases
Basemap found and loaded from ' "/home/manjaro/osmin/resources/world" '...
Register sensor backend: builtin.compass
QQmlApplicationEngine failed to load component
qrc:/controls2/osmin.qml:467:5: Type MapPosition unavailable
qrc:/controls2/components/MapPosition.qml:19:1: module "QtPositioning" is not installed
Failed to load QML
Signal handler is destroyed.
onFlushRecording
~TrackerModule
~Tracker

I assume the missing QtPositioning indicates a missing positioning package. However, I can only find it in the gt6 version. 🥴

@nesnera
Copy link

nesnera commented Jan 10, 2022

The last missing package was qt5-location. @Karry, thank you for your help 🍺
image

Karry added a commit to Karry/libosmscout that referenced this issue Jan 11, 2022
Clang allows -msse* compiler flags even with arm cpu target,
so cmake check check_c_compiler_flag return success.
But sse instructions are not supported on arm, so build fails later.
Because of that, we should try to compile simple sse program
to verify that sse really works.

Should solve Framstag#1197
@Karry
Copy link
Collaborator Author

Karry commented Jan 11, 2022

Great to hear that Osmin, libosmscout-based application may run on another platform... Ok, it is just another Linux distribution, but mobile distribution :-)

Closing this issue as SSE detection should work properly now.

@Karry Karry closed this as completed Jan 11, 2022
@janbar
Copy link
Contributor

janbar commented Feb 14, 2022

Very late, but better later than never. Yes SSE is disabled when cmake build on ANDROID. I didn't think the app could be build for a Linux distribution on ARM cpu. @Karry thanks for adding the check on configure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build For issues in the context of building the software help wanted Signal that help of other is appreciated
Projects
None yet
Development

No branches or pull requests

3 participants