I follow this instructions to compile presets for my Raspberry Pi 3 with Raspbian Stretch.
https://github.com/bytedeco/javacpp-presets/wiki/Build-Environments
When I execute:
sudo ./cppbuild.sh -platform linux-armhf install
I get the following output:
`Detected platform "linux-arm"
Building for platform "linux-armhf"
Installing "opencv"
/home/pi/javacpp-presets/opencv/cppbuild /home/pi/javacpp-presets
Decompressing archives...
Total bytes read: 168857600 (162MiB, 3.5MiB/s)
Total bytes read: 96839680 (93MiB, 400KiB/s)
patching file modules/dnn_modern/CMakeLists.txt
patching file CMakeLists.txt
patching file modules/core/include/opencv2/core/utility.hpp
patching file modules/core/src/system.cpp
patching file modules/dnn/include/opencv2/dnn/all_layers.hpp
patching file modules/dnn/include/opencv2/dnn/dnn.hpp
patching file modules/dnn/src/dnn.cpp
-- The C compiler identification is unknown
-- Check for working C compiler: /usr/bin/arm-linux-gnueabihf-gcc
-- Check for working C compiler: /usr/bin/arm-linux-gnueabihf-gcc -- broken
CMake Error at /usr/share/cmake-3.7/Modules/CMakeTestCCompiler.cmake:51 (message):
The C compiler "/usr/bin/arm-linux-gnueabihf-gcc" is not able to compile a
simple test program.
It fails with the following output:
Change Dir: /home/pi/javacpp-presets/opencv/cppbuild/linux-armhf/opencv-3.3.0/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_c5570/fast"
/usr/bin/make -f CMakeFiles/cmTC_c5570.dir/build.make
CMakeFiles/cmTC_c5570.dir/build
make[1]: Entering directory
'/home/pi/javacpp-presets/opencv/cppbuild/linux-armhf/opencv-3.3.0/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_c5570.dir/testCCompiler.c.o
/usr/bin/arm-linux-gnueabihf-gcc -march=armv6 -mfpu=vfp -mfloat-abi=hard -o
CMakeFiles/cmTC_c5570.dir/testCCompiler.c.o -c
/home/pi/javacpp-presets/opencv/cppbuild/linux-armhf/opencv-3.3.0/CMakeFiles/CMakeTmp/testCCompiler.c
/usr/bin/arm-linux-gnueabihf-gcc: 1: /usr/bin/arm-linux-gnueabihf-gcc:
Syntax error: word unexpected (expecting ")")
CMakeFiles/cmTC_c5570.dir/build.make:65: recipe for target
'CMakeFiles/cmTC_c5570.dir/testCCompiler.c.o' failed
make[1]: * [CMakeFiles/cmTC_c5570.dir/testCCompiler.c.o] Error 2
make[1]: Leaving directory
'/home/pi/javacpp-presets/opencv/cppbuild/linux-armhf/opencv-3.3.0/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_c5570/fast' failed
make: * [cmTC_c5570/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:127 (project)
-- Configuring incomplete, errors occurred!
See also "/home/pi/javacpp-presets/opencv/cppbuild/linux-armhf/opencv-3.3.0/CMakeFiles/CMakeOutput.log".
See also "/home/pi/javacpp-presets/opencv/cppbuild/linux-armhf/opencv-3.3.0/CMakeFiles/CMakeError.log".
`
Can someone help me overcome the issue?
Aso, the /home/pi/javacpp-presets/opencv/cppbuild/linux-armhf/opencv-3.3.0/CMakeFiles/CMakeError.log
Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
Compiler: /usr/bin/arm-linux-gnueabihf-gcc
Build flags: -march=armv6;-mfpu=vfp;-mfloat-abi=hard
Id flags:
The output was:
2
/usr/bin/arm-linux-gnueabihf-gcc: 1: /usr/bin/arm-linux-gnueabihf-gcc: Syntax error: word unexpected (expecting ")")
Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
Compiler: /usr/bin/arm-linux-gnueabihf-gcc
Build flags: -march=armv6;-mfpu=vfp;-mfloat-abi=hard
Id flags: -c
The output was:
2
/usr/bin/arm-linux-gnueabihf-gcc: 1: /usr/bin/arm-linux-gnueabihf-gcc: Syntax error: word unexpected (expecting ")")
Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
Compiler: /usr/bin/arm-linux-gnueabihf-gcc
Build flags: -march=armv6;-mfpu=vfp;-mfloat-abi=hard
Id flags: -Aa
The output was:
2
/usr/bin/arm-linux-gnueabihf-gcc: 1: /usr/bin/arm-linux-gnueabihf-gcc: Syntax error: word unexpected (expecting ")")
Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
Compiler: /usr/bin/arm-linux-gnueabihf-gcc
Build flags: -march=armv6;-mfpu=vfp;-mfloat-abi=hard
Id flags: -D__CLASSIC_C__
The output was:
2
/usr/bin/arm-linux-gnueabihf-gcc: 1: /usr/bin/arm-linux-gnueabihf-gcc: Syntax error: word unexpected (expecting ")")
Checking whether the C compiler is IAR using "" did not match "IAR .+ Compiler":
/usr/bin/arm-linux-gnueabihf-gcc: 1: /usr/bin/arm-linux-gnueabihf-gcc: Syntax error: word unexpected (expecting ")")
Determining if the C compiler works failed with the following output:
Change Dir: /home/pi/javacpp-presets/opencv/cppbuild/linux-armhf/opencv-3.3.0/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_c7ac1/fast"
/usr/bin/make -f CMakeFiles/cmTC_c7ac1.dir/build.make CMakeFiles/cmTC_c7ac1.dir/build
make[1]: Entering directory '/home/pi/javacpp-presets/opencv/cppbuild/linux-armhf/opencv-3.3.0/CMakeFiles/CMakeTmp'
It's looking for the cross compiler, but it should work natively on Raspberry Pi as well, @vb216 ?
Sure will take a look, I need to update those instructions with native build steps and check it's picking up to use native compiler. Looks like it's incorrectly trying to cross compile.
Shouldn't take too long to fix, hopefully get a chance in next day or so
Thanks a lot. I've already run out of solutions and I need to compile the libraries for a project which ends this month. I look forward for your solution.
Can you do this:
cd /usr/bin
ls -ltra gcc
And send back the output?
For me, I have a symlink arm-linux-gnueabihf-gcc-4.9 which points to gcc-4.9, and a symlink gcc which also points to gcc 4.9. So seems that the Pi is being a bit smart, if you try to call a cross compiler, its pointing it back to its native compiler. I think long term, I should update the build to use gcc without the prefix for native builds, but that'll take longer to think/write/test.
It could be some changes in a new distro - you mention raspbian stretch, could you tell me which version? Most recent looks like 2017-09-07. Or it could be that I've added some extra gcc stuff to this Pi at some point. Will download the latest raspbian and check too.
I suspect quickest solution in meantime will be to create some alias on your Pi, I just want to reproduce/understand the problem first
Hi,
My Raspbian version is: Linux raspberrypi 4.9.41-v7+ #1023 SMP Tue Aug 8 16:00:15 BST 2017 armv7l
downloaded from raspberrypi.org.
The output of the commands you wrote is:
lrwxrwxrwx 1 root root 5 Apr 8 2017 gcc -> gcc-6
I cannot let you in my Pi, because I have sources of a project there, which I can't allow unauthorized people to access.
OK that explains why it built on the Pi I tested with here, and is failing on yours. I'll try from scratch on more recent distro.
I didn't mean needing access to your Pi, I meant once I can reproduce the error here, I'll just reply back with the extra commands you need to run (it might be that some packages need installing too).
So, I think the build should be changed to use gcc for native pi builds, and leave it up to the OS/user for what gcc is or links to.
But, in the meantime, I can't actually reproduce your problem. Did you download the minimal image maybe?
From here https://www.raspberrypi.org/downloads/raspbian/ I downloaded "Raspbian Stretch with desktop". I've then run
sudo apt-get install clang maven python swig git file wget unzip tar bzip2 gzip patch automake make cmake libtool perl nasm yasm
Then
git clone https://github.com/bytedeco/javacpp-presets.git
Finally
cd ./javacpp-presets
./cppbuild.sh -platform linux-armhf install
and the opencv stage is about 40% into the compilation now.
So the good news is, you should be able to get up and running without having to wait for any new code.
I didn't make a clean raspbian again, but on the one I have already I did the apt-get. And then I ran the script. It still returns me this:
sudo ./cppbuild.sh -platform linux-armhf install
Detected platform "linux-arm"
Building for platform "linux-armhf"
Installing "opencv"
/home/pi/javacpp-presets/opencv/cppbuild /home/pi/javacpp-presets
Decompressing archives...
Total bytes read: 168857600 (162MiB, 428KiB/s)
Total bytes read: 96839680 (93MiB, 770KiB/s)
patching file modules/dnn_modern/CMakeLists.txt
patching file CMakeLists.txt
patching file modules/core/include/opencv2/core/utility.hpp
patching file modules/core/src/system.cpp
patching file modules/dnn/include/opencv2/dnn/all_layers.hpp
patching file modules/dnn/include/opencv2/dnn/dnn.hpp
patching file modules/dnn/src/dnn.cpp
-- The C compiler identification is unknown
-- Check for working C compiler: /usr/bin/arm-linux-gnueabihf-gcc
-- Check for working C compiler: /usr/bin/arm-linux-gnueabihf-gcc -- broken
CMake Error at /usr/share/cmake-3.7/Modules/CMakeTestCCompiler.cmake:51 (message):
The C compiler "/usr/bin/arm-linux-gnueabihf-gcc" is not able to compile a
simple test program.
It fails with the following output:
Change Dir: /home/pi/javacpp-presets/opencv/cppbuild/linux-armhf/opencv-3.3.0/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_7319d/fast"
/usr/bin/make -f CMakeFiles/cmTC_7319d.dir/build.make
CMakeFiles/cmTC_7319d.dir/build
make[1]: Entering directory
'/home/pi/javacpp-presets/opencv/cppbuild/linux-armhf/opencv-3.3.0/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_7319d.dir/testCCompiler.c.o
/usr/bin/arm-linux-gnueabihf-gcc -march=armv6 -mfpu=vfp -mfloat-abi=hard -o
CMakeFiles/cmTC_7319d.dir/testCCompiler.c.o -c
/home/pi/javacpp-presets/opencv/cppbuild/linux-armhf/opencv-3.3.0/CMakeFiles/CMakeTmp/testCCompiler.c
/usr/bin/arm-linux-gnueabihf-gcc: 1: /usr/bin/arm-linux-gnueabihf-gcc:
Syntax error: word unexpected (expecting ")")
CMakeFiles/cmTC_7319d.dir/build.make:65: recipe for target
'CMakeFiles/cmTC_7319d.dir/testCCompiler.c.o' failed
make[1]: * [CMakeFiles/cmTC_7319d.dir/testCCompiler.c.o] Error 2
make[1]: Leaving directory
'/home/pi/javacpp-presets/opencv/cppbuild/linux-armhf/opencv-3.3.0/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_7319d/fast' failed
make: * [cmTC_7319d/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:127 (project)
-- Configuring incomplete, errors occurred!
See also "/home/pi/javacpp-presets/opencv/cppbuild/linux-armhf/opencv-3.3.0/CMakeFiles/CMakeOutput.log".
See also "/home/pi/javacpp-presets/opencv/cppbuild/linux-armhf/opencv-3.3.0/CMakeFiles/CMakeError.log".
I guess the lines with update-alternatives from the instructions messed up something in my Pi. But I have no idea how to fix it.
Ah I see. I need to break out the wiki instructions for sure then, a section for native install which doesn't need any of that stuff. So it sounds like you're right, the update-alternatives will have moved the links away from what we'd like. Could you send me the output from this:
ls -tlra armgcc
I guess it has entries like this?
arm-linux-gnueabihf-gcc -> /etc/alternatives/arm-linux-gnueabihf-gcc
Unfortunately, I don't use update-alternatives so much, so I'm not sure quickly how to clean it up. To me, I think easier option would be to remove this symlink to /etc/alternatives/arm-linux-gnueabihf-gcc, and create a new one pointing to gcc. In theory, you could always put the old symlink back. If you have time, it might not be a bad idea to take the SD card out and make a quick backup.
But, I recreated the steps on a Pi here, and this seems to fix it for me:
Before test:
cd /usr/bin
./arm-linux-gnueabihf-gcc
-bash: ./arm-linux-gnueabihf-gcc: cannot execute binary file: Exec format error
(because its trying a x86 build of the compiler so can't execute it)
Fix:
sudo rm arm-linux-gnueabihf-gcc
sudo ln -s gcc arm-linux-gnueabihf-gcc
After fix:
./arm-linux-gnueabihf-gcc
arm-linux-gnueabihf-gcc: fatal error: no input files
You'll need to do the same for arm-linux-gnueabihf-g++ and arm-linux-gnueabihf-cpp
Tahnks, I've figured it out just a moment before you posted and did exactly the same with removing links and creating new ones pointing to native compilers.
Still it doesn't work, but fortunatelly it's showing something new now:
pi@raspberrypi:~/javacpp-presets $ sudo ./cppbuild.sh -platform linux-armhf install
Detected platform "linux-arm"
Building for platform "linux-armhf"
Installing "opencv"
/home/pi/javacpp-presets/opencv/cppbuild /home/pi/javacpp-presets
Decompressing archives...
Total bytes read: 168857600 (162MiB, 1.6MiB/s)
Total bytes read: 96839680 (93MiB, 458KiB/s)
patching file modules/dnn_modern/CMakeLists.txt
patching file CMakeLists.txt
patching file modules/core/include/opencv2/core/utility.hpp
patching file modules/core/src/system.cpp
patching file modules/dnn/include/opencv2/dnn/all_layers.hpp
patching file modules/dnn/include/opencv2/dnn/dnn.hpp
patching file modules/dnn/src/dnn.cpp
-- Detected version of GNU GCC: 63 (603)
-- Looking for ccache - not found
-- VFPV3 is not supported by C++ compiler
-- NEON is not supported by C++ compiler
-- FP16 is not supported by C++ compiler
CMake Error at cmake/OpenCVCompilerOptimizations.cmake:446 (message):
Compiler doesn't support baseline optimization flags:
Call Stack (most recent call first):
cmake/OpenCVCompilerOptions.cmake:263 (ocv_compiler_optimization_options)
CMakeLists.txt:529 (include)
-- Configuring incomplete, errors occurred!
See also "/home/pi/javacpp-presets/opencv/cppbuild/linux-armhf/opencv-3.3.0/CMakeFiles/CMakeOutput.log".
See also "/home/pi/javacpp-presets/opencv/cppbuild/linux-armhf/opencv-3.3.0/CMakeFiles/CMakeError.log".
I guess I'm missing some packages?
Hmm.. try a 'clean' instead of install? It might be picking up wrong
settings from first time it tried to run?
On 26 Nov 2017 10:22 am, "Patryk Wierzchoń" notifications@github.com
wrote:
Tahnks, I've figured it out just a moment before you posted and did
exactly the same with removing links and creating new ones pointing to
native compilers.
Still it doesn't work, but fortunatelly it's showing something new now:pi@raspberrypi:~/javacpp-presets $ sudo ./cppbuild.sh -platform
linux-armhf install
Detected platform "linux-arm"
Building for platform "linux-armhf"
Installing "opencv"
/home/pi/javacpp-presets/opencv/cppbuild /home/pi/javacpp-presets
Decompressing archives...
Total bytes read: 168857600 (162MiB, 1.6MiB/s)
Total bytes read: 96839680 (93MiB, 458KiB/s)
patching file modules/dnn_modern/CMakeLists.txt
patching file CMakeLists.txt
patching file modules/core/include/opencv2/core/utility.hpp
patching file modules/core/src/system.cpp
patching file modules/dnn/include/opencv2/dnn/all_layers.hpp
patching file modules/dnn/include/opencv2/dnn/dnn.hpp
patching file modules/dnn/src/dnn.cpp
-- Detected version of GNU GCC: 63 (603)
-- Looking for ccache - not found
-- VFPV3 is not supported by C++ compiler
-- NEON is not supported by C++ compiler
-- FP16 is not supported by C++ compiler
CMake Error at cmake/OpenCVCompilerOptimizations.cmake:446 (message):
Compiler doesn't support baseline optimization flags:
Call Stack (most recent call first):
cmake/OpenCVCompilerOptions.cmake:263 (ocv_compiler_optimization_options)
CMakeLists.txt:529 (include)-- Configuring incomplete, errors occurred!
See also "/home/pi/javacpp-presets/opencv/cppbuild/linux-armhf/
opencv-3.3.0/CMakeFiles/CMakeOutput.log".
See also "/home/pi/javacpp-presets/opencv/cppbuild/linux-armhf/
opencv-3.3.0/CMakeFiles/CMakeError.log".I guess I'm missing some packages?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/bytedeco/javacpp-presets/issues/486#issuecomment-346997825,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AMYRJ0GVTVCiRgOV0UzLDXqVYjWEUZyoks5s6TvzgaJpZM4Qpuw8
.
Great. It's compiling after clean. I hope it'll work now. Thanks!
Everything works fine. Thanks a lot!
Wiki updated to provide steps for cross compiling or native compiling
Most helpful comment
Sure will take a look, I need to update those instructions with native build steps and check it's picking up to use native compiler. Looks like it's incorrectly trying to cross compile.
Shouldn't take too long to fix, hopefully get a chance in next day or so