jaime111
Posts: 3
Joined: Tue Nov 08, 2016 12:18 pm

CMakelist in raspberry pi 3

Tue Jul 31, 2018 12:51 am

Hi everyone

I've installed opencv in raspberry pi 3 b,

I have a project that works fine in windows and linux mint 19 but now I''m trying to compile it in raspberry pi 3 with Raspbian Stretch and I have some errors.

This is my CMakelist.txt

Code: Select all

project( ejemplo )						# Define the project
cmake_minimum_required(VERSION 2.8.9)	# Above line indicates to Cmake that minimum version 2.8.9 is required.
set ( CMAKE_BUILD_TYPE Release )		# Type of build

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -march=pentium4 -mtune=barcelona -msse3  -g -ggdb3 --std=c++11 -pedantic -Wextra -Wall") #32 bits
add_definitions ( -Wall )

SET(CMAKE_INCLUDE_CURRENT_DIR ON)
find_package( OpenCV REQUIRED )

set(C_Files
	main.cpp
)

add_executable(${PROJECT_NAME} ${C_Files})
target_link_libraries(${PROJECT_NAME} ${OpenCV_LIBS} )

This works fine in my computer but now that I've tried it in raspberry, I have these errors:

Code: Select all

c++: error: unrecognized argument in option ‘-march=pentium4’
c++: note: valid arguments to ‘-march=’ are: armv2 armv2a armv3 armv3m armv4 armv4t armv5 armv5e armv5t armv5te armv6 armv6-m armv6j armv6k armv6kz armv6s-m armv6t2 armv6z armv6zk armv7 armv7-a armv7-m armv7-r armv7e-m armv7ve armv8-a armv8-a+crc armv8.1-a armv8.1-a+crc iwmmxt iwmmxt2 native
c++: error: unrecognized argument in option ‘-mtune=barcelona’
c++: note: valid arguments to ‘-mtune=’ are: arm1020e arm1020t arm1022e arm1026ej-s arm10e arm10tdmi arm1136j-s arm1136jf-s arm1156t2-s arm1156t2f-s arm1176jz-s arm1176jzf-s arm2 arm250 arm3 arm6 arm60 arm600 arm610 arm620 arm7 arm70 arm700 arm700i arm710 arm7100 arm710c arm710t arm720 arm720t arm740t arm7500 arm7500fe arm7d arm7di arm7dm arm7dmi arm7m arm7tdmi arm7tdmi-s arm8 arm810 arm9 arm920 arm920t arm922t arm926ej-s arm940t arm946e-s arm966e-s arm968e-s arm9e arm9tdmi cortex-a12 cortex-a15 cortex-a15.cortex-a7 cortex-a17 cortex-a17.cortex-a7 cortex-a32 cortex-a35 cortex-a5 cortex-a53 cortex-a57 cortex-a57.cortex-a53 cortex-a7 cortex-a72 cortex-a72.cortex-a53 cortex-a8 cortex-a9 cortex-m0 cortex-m0.small-multiply cortex-m0plus cortex-m0plus.small-multiply cortex-m1 cortex-m1.small-multiply cortex-m3 cortex-m4 cortex-m7 cortex-r4 cortex-r4f cortex-r5 cortex-r7 cortex-r8 ep9312 exynos-m1 fa526 fa606te fa626 fa626te fa726te fmp626 generic-armv7-a iwmmxt iwmmxt2 marvell-pj4 mpcore mpcorenovfp native qdf24xx strongarm strongarm110 strongarm1100 strongarm1110 xgene1 xscale
c++: error: unrecognized command line option ‘-msse3’
CMakeFiles/ejemplo.dir/build.make:62: fallo en las instrucciones para el objetivo 'CMakeFiles/ejemplo.dir/main.cpp.o'
make[2]: *** [CMakeFiles/ejemplo.dir/main.cpp.o] Error 1
CMakeFiles/Makefile2:67: fallo en las instrucciones para el objetivo 'CMakeFiles/ejemplo.dir/all'
make[1]: *** [CMakeFiles/ejemplo.dir/all] Error 2
Makefile:83: fallo en las instrucciones para el objetivo 'all'
make: *** [all] Error 2
Could you help me figure out how to correct it? I guess It has to be something with the change to a ARM microprocessor, but I don't know what settings I have to use.

I would appreciate any help or recommendations,

Thanks in advance!

User avatar
topguy
Posts: 4930
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: CMakelist in raspberry pi 3

Tue Jul 31, 2018 1:55 pm

Start by removing the GXX_FLAGS that gives the error, they only work on Intel/AMD CPU.
You dont have to tell the compiler to compile for ARM, it will do that by default.

After you have verified that your program compiles and run, then you can add some questions about which flags to use to optimize for specific Pi model for example.. ( Or just use the search box viewtopic.php?t=144115 )

User avatar
PeterO
Posts: 4257
Joined: Sun Jul 22, 2012 4:14 pm

Re: CMakelist in raspberry pi 3

Tue Jul 31, 2018 2:23 pm

Déjà vu ? Didn't he just post that he's fixed this ?

Thought so , this is a dupe.... viewtopic.php?f=31&t=219405&p=1347362#p1347362

PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),Aeromodelling,1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

Return to “General programming discussion”