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

Raspberry Pi 32bit build failure - OpenCV #805

Open
peardox opened this issue Oct 15, 2019 · 8 comments
Open

Raspberry Pi 32bit build failure - OpenCV #805

peardox opened this issue Oct 15, 2019 · 8 comments

Comments

@peardox
Copy link

peardox commented Oct 15, 2019

Compilation test using Oracle JDK 8

debug.opencv.log.gz

This appears to be the error in question...

opencv/target/native/org/bytedeco/opencv/linux-armhf/jniopencv_core.cpp:124812:1: internal compiler error: Segmentation fault

A nice specific error this time with -X -e

@saudet
Copy link
Member

saudet commented Oct 16, 2019

That just looks like it's running out of memory. Make sure that's not happening by monitoring memory usage with top.

@peardox
Copy link
Author

peardox commented Oct 16, 2019

Yep - tried it again while running a free -m every second

For Tensorflow a native Pi build you have to alter a build script to limit Java's memory use with -J-Xmx500M or similar. Can I try something like that with Maven + if so add what switches + where

      date     time           total        used        free      shared  buff/cache   available
2019-10-16 17:37:17            3906         203        1359          60        2343        3494
2019-10-16 17:37:18            3906         203        1359          60        2343        3494
...
2019-10-16 18:08:06            3906        1468          96          60        2341        2229
2019-10-16 18:08:07            3906        1492          71          60        2341        2205
2019-10-16 18:08:08            3906        1497          66          60        2341        2200
2019-10-16 18:08:09            3906        1502          61          60        2341        2194
2019-10-16 18:08:10            3906        1508          56          60        2341        2189
2019-10-16 18:08:11            3906        1515          84          60        2305        2181

Lots of usage too

18:08:00 up 7 days, 23:15,  4 users,  load average: 1.92, 1.61, 1.27

@saudet
Copy link
Member

saudet commented Oct 17, 2019

GCC is the issue, not Maven. I'm not aware of any such switch for GCC. Try to add more swap space.

@peardox
Copy link
Author

peardox commented Oct 17, 2019

I'm using 8G Swap on a 4G 32 bit Pi.

A potential problem is the 4G address space on 32 but OSes as it gets much further on my 64 bit Nano.

I'll mess around a bit and see what I can come up with...

@saudet
Copy link
Member

saudet commented Oct 17, 2019

Right, it won't be able to get much higher than 2 or 3 GB... Disabling things like compiler optimizations usually reduces memory usage.

@peardox
Copy link
Author

peardox commented Oct 17, 2019

I just gave it another do with swappiness set to 90 - still failed

Next idea - try compiling it on 64 bit with a -m32 switch - it compiles fine on arm64, If this works then all the cppbuild.sh scripts are going to need thee -32 - worry about that if test works

While it's not an ideal solution it's an acceptable one IMHO as it only requires a 64 bit OS to build (I hope)

@peardox
Copy link
Author

peardox commented Oct 17, 2019

Something nice - gcc-multilib-arm-linux-gnueabihf includes arm-linux-gnueabihf-gcc on 64-bit so no changes required to cppbuild.sh, it appears

JavaCPP compiled correctly

@peardox
Copy link
Author

peardox commented Oct 17, 2019

Oh well - too much to hope for I guess. It's trying to compile some 64 bit ASM

This is openblas...

Invoked with

mvn install -Djavacpp.platform=linux-armhf -Dmaven.javadoc.skip=true -DVERBOSE=1

make[1]: warning: -jN forced in submake: disabling jobserver mode. make[1]: *** No rule to make target '../kernel/arm64/amin.S', needed by 'samin_k.o'. Stop. make[1]: *** Waiting for unfinished jobs.... ../kernel/arm64/amax.S: Assembler messages: ../kernel/arm64/amax.S:162: Error: ARM register expected -- cmp x0,xzr'
../kernel/arm64/amax.S:164: Error: ARM register expected -- cmp x2,xzr' ../kernel/arm64/amax.S:167: Error: ARM register expected -- cmp x2,#1'
../kernel/arm64/amax.S:172: Error: ARM register expected -- asr x5,x0,#2' ../kernel/arm64/amax.S:173: Error: ARM register expected -- cmp x5,xzr'
../kernel/arm64/amax.S:176: Error: bad instruction ld1 {v0.4s},[x1],#16' ../kernel/arm64/amax.S:176: Error: bad instruction fabs v0.4s,v0.4s'
../kernel/arm64/amax.S:176: Error: bad instruction fmaxv s0,v0.4s' ../kernel/arm64/amax.S:177: Error: ARM register expected -- subs x5,x5,#1'
../kernel/arm64/amax.S:182: Error: bad instruction ld1 {v1.4s},[x1],#16' ../kernel/arm64/amax.S:182: Error: bad instruction fabs v1.4s,v1.4s'
../kernel/arm64/amax.S:182: Error: bad instruction fmaxv s1,v1.4s' ../kernel/arm64/amax.S:182: Error: bad instruction fcmp s0,s1'
../kernel/arm64/amax.S:182: Error: bad instruction fcsel s0,s0,s1,ge' ../kernel/arm64/amax.S:184: Error: ARM register expected -- subs x5,x5,#1'
../kernel/arm64/amax.S:189: Error: ARM register expected -- ands x5,x0,#3' ../kernel/arm64/amax.S:194: Error: ARM register expected -- ldr s1,[x1],#4'
../kernel/arm64/amax.S:194: Error: bad instruction fabs s1,s1' ../kernel/arm64/amax.S:194: Error: bad instruction fcmp s0,s1'
../kernel/arm64/amax.S:194: Error: bad instruction fcsel s0,s0,s1,ge' ../kernel/arm64/amax.S:196: Error: ARM register expected -- subs x5,x5,#1'
../kernel/arm64/amax.S:199: Error: bad instruction ret' ../kernel/arm64/amax.S:203: Error: ARM register expected -- ldr s0,[x1],#4'
../kernel/arm64/amax.S:203: Error: bad instruction fabs s0,s0' ../kernel/arm64/amax.S:204: Error: ARM register expected -- subs x0,x0,#1'
../kernel/arm64/amax.S:209: Error: ARM register expected -- lsl x2,x2,#2' ../kernel/arm64/amax.S:209: Error: bad instruction ld1 {v0.s}[0],[x1],x2'
../kernel/arm64/amax.S:209: Error: bad instruction fabs s0,s0' ../kernel/arm64/amax.S:211: Error: ARM register expected -- subs x0,x0,#1'
../kernel/arm64/amax.S:214: Error: ARM register expected -- asr x5,x0,#2' ../kernel/arm64/amax.S:215: Error: ARM register expected -- cmp x5,xzr'
../kernel/arm64/amax.S:220: Error: bad instruction ld1 {v1.s}[0],[x1],x2' ../kernel/arm64/amax.S:220: Error: bad instruction fabs s1,s1'
../kernel/arm64/amax.S:220: Error: bad instruction fcmp s0,s1' ../kernel/arm64/amax.S:220: Error: bad instruction fcsel s0,s0,s1,ge'
../kernel/arm64/amax.S:221: Error: bad instruction ld1 {v1.s}[0],[x1],x2' ../kernel/arm64/amax.S:221: Error: bad instruction fabs s1,s1'
../kernel/arm64/amax.S:221: Error: bad instruction fcmp s0,s1' ../kernel/arm64/amax.S:221: Error: bad instruction fcsel s0,s0,s1,ge'
../kernel/arm64/amax.S:222: Error: bad instruction ld1 {v1.s}[0],[x1],x2' ../kernel/arm64/amax.S:222: Error: bad instruction fabs s1,s1'
../kernel/arm64/amax.S:222: Error: bad instruction fcmp s0,s1' ../kernel/arm64/amax.S:222: Error: bad instruction fcsel s0,s0,s1,ge'
../kernel/arm64/amax.S:223: Error: bad instruction ld1 {v1.s}[0],[x1],x2' ../kernel/arm64/amax.S:223: Error: bad instruction fabs s1,s1'
../kernel/arm64/amax.S:223: Error: bad instruction fcmp s0,s1' ../kernel/arm64/amax.S:223: Error: bad instruction fcsel s0,s0,s1,ge'
../kernel/arm64/amax.S:225: Error: ARM register expected -- subs x5,x5,#1' ../kernel/arm64/amax.S:230: Error: ARM register expected -- ands x5,x0,#3'
../kernel/arm64/amax.S:235: Error: bad instruction ld1 {v1.s}[0],[x1],x2' ../kernel/arm64/amax.S:235: Error: bad instruction fabs s1,s1'
../kernel/arm64/amax.S:235: Error: bad instruction fcmp s0,s1' ../kernel/arm64/amax.S:235: Error: bad instruction fcsel s0,s0,s1,ge'
../kernel/arm64/amax.S:237: Error: ARM register expected -- subs x5,x5,#1' ../kernel/arm64/amax.S:242: Error: bad instruction ret'
../kernel/arm64/amax.S:246: Error: bad instruction fmov s0,wzr' ../kernel/arm64/amax.S:247: Error: bad instruction ret'
Makefile.L1:525: recipe for target 'samax_k.o' failed
make[1]: *** [samax_k.o] Error 1
Makefile:149: recipe for target 'libs' failed
make: *** [libs] Error 1
`

@saudet saudet changed the title Raspberry Pi 32bit Segfault - OpenCV Raspberry Pi 32bit build failure - OpenCV Oct 24, 2019
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

2 participants