tesseract: Build fails with -mno-fma set in global CXXFLAGS if build through configure
Environment
- Tesseract Version: 4.1.1
- Platform: Linux asgard-hofud-chroot 5.3.6-gentoo-r1-x86_64 #1 SMP PREEMPT Tue Oct 15 11:34:29 BST 2019 x86_64 Intel® Core™ i7-2600 CPU @ 3.40GHz GenuineIntel GNU/Linux
Current Behavior:
$ export CFLAGS="-O2 -pipe -march=corei7-avx -mcx16 -msahf -mno-movbe -maes -mpclmul -mpopcnt -mno-abm -mno-lwp -mno-fma -mno-fma4 -mno-xop -mno-bmi -mno-tbm -mavx -msse4.2 -msse4.1 -mtune=corei7-avx -mindirect-branch=thunk"
$ export CXXFLAGS="$CFLAGS"
$ ./configure
[...]
$ make
[...]
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I../.. -O2 -DNDEBUG -I../../src/ccstruct -I../../src/ccutil -I../../src/viewer -I/usr/include/leptonica -I/usr/include/pango-1.0 -I/usr/include/fribidi -I/usr/lib64/libffi/include -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/cairo -I/usr/lib64/libffi/include -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libdrm -I/usr/include/libpng16 -mfma -O2 -pipe -march=corei7-avx -mcx16 -msahf -mno-movbe -maes -mpclmul -mpopcnt -mno-abm -mno-lwp -mno-fma -mno-fma4 -mno-xop -mno-bmi -mno-tbm -mavx -msse4.2 -msse4.1 -mtune=corei7-avx -mindirect-branch=thunk -std=c++17 -MT libtesseract_fma_la-dotproductfma.lo -MD -MP -MF .deps/libtesseract_fma_la-dotproductfma.Tpo -c dotproductfma.cpp -fPIC -DPIC -o .libs/libtesseract_fma_la-dotproductfma.o
dotproductfma.cpp:19:2: error: #error Implementation only for FMA capable architectures
#error Implementation only for FMA capable architectures
^~~~~
Expected Behavior:
Compile without an error.
Suggested Fix:
Stop touching architecture and instruction set related cflags, leave it to host system to set.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 16 (12 by maintainers)
Tesseract build works on the standard/default setting of supported OS/distribution. If the user decides to modify default settings - the user is responsible for solving the problem.
That’s the flags from march=native on the machine that I am compiling it for, but machine that I am compiling it on has fma. So I prefer to just take whatever cflags gcc is alreay using.