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

CMake: builds always use -march=native #4030

Closed
bmwiedemann opened this issue Mar 18, 2023 · 12 comments
Closed

CMake: builds always use -march=native #4030

bmwiedemann opened this issue Mar 18, 2023 · 12 comments

Comments

@bmwiedemann
Copy link

Current Behavior

While working on reproducible builds for openSUSE, I found that
when building packages, machine code depends on which build worker is selected from our build pool.

Expected Behavior

It should be possible to build without -march=native to get reproducible binaries.

Suggested Fix

There is a fix in #3864

tesseract -v

5.3.0

Operating System

No response

Other Operating System

openSUSE-Tumbleweed 20230315

uname -a

6.2.4

Compiler

gcc-12

CPU

various

Virtualization / Containers

No response

Other Information

No response

@stweil
Copy link
Contributor

stweil commented Mar 18, 2023

Linux distributions should use the automake build which fixed that in commit 5884036. Does openSUSE use the cmake build? Why?

@bmwiedemann
Copy link
Author

@amitdo
Copy link
Collaborator

amitdo commented Mar 18, 2023

Does openSUSE use the cmake build? Why?

People see that we support both Autotools and CMake, and they choose the tool they prefer.

@stweil
Copy link
Contributor

stweil commented Mar 18, 2023

That's okay for individual users and for those who have special needs like using IDEs for Windows or macOS. But for Linux distributions I suggest to move back to automake. That minimized their risk and makes it easier for us.

@bmwiedemann
Copy link
Author

Even outside of Linux, #3864 would be useful, because not everyone runs their binaries on the same type of machine as their build machine.

@amitdo amitdo changed the title builds always use -march=native CMake: builds always use -march=native Mar 18, 2023
@mimi1vx
Copy link

mimi1vx commented Mar 20, 2023

@stweil .. usually is cmake faster, you can use different builder than make like ninja, and it can be pretty easy debug and modified in comparsion with autotools ?

@zdenop
Copy link
Contributor

zdenop commented Mar 23, 2023

Please check current code. Now the default setting should be the same as at autotools.

@bmwiedemann
Copy link
Author

commit f779c43 looks good, except that it does not mention this issue.
Test passed with it, too.

@stweil
Copy link
Contributor

stweil commented Mar 23, 2023

@stweil .. usually is cmake faster

Autotools by default builds shared and static libraries and builds executables which use the shared tesseract library.

CMake by default seems to build only the static library, so the executables don't use a shared tesseract library and are much larger. @bmwiedemann, Linux distributions typically prefer shared linking. Do you use special flags when running CMake?

A single threaded build with CMake takes around 1:46 on my MacBook and uses 99 % cpu.
A single threaded build with Autotools and --disable-shared takes around 2:26 and uses 91 % cpu. So yes, it is a bit slower because it obviously does not use the full cpu power.

@amitdo
Copy link
Collaborator

amitdo commented Mar 23, 2023

Autotools by default builds shared and static libraries

I don't think it's a good default. what do you think?

@stweil
Copy link
Contributor

stweil commented Mar 23, 2023

As far as I know that's the normal default for autotools. And typically a distribution requires both, shared libraries for the binaries and additional static libraries for development packages. So for distributions that default is fine.

@zdenop
Copy link
Contributor

zdenop commented Mar 24, 2023

@stweil : with -DBUILD_SHARED_LIBS=ON you can build shared libs with cmake

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants