With the diff below, I have a working cmake-3.4.3 package for arm. One can say I lost the battle and gave up, but let's face reality: base libstdc++ on arm is FUBAR, there's not much we can do...
It is plagued by a plethora of bugs: It forced us to use '-O1 -fno-stack-protector'. It broke CMake's built-in ELF parser. And finally ifstream is bugged when linking with -lpthread. See my previous "std::ifstream is broken on arm" mail on bugs@. If you want to play, you can install my packages with: # export PKG_PATH=http://open.bsdgeek.it/arm/ # pkg_add cmake ninja It will save you some pain, since it took me ~1 day to build cmake on a BBB. I've already built some cmake-based ports for testing purposes, and all seems good so far. Comments? OKs? Index: Makefile =================================================================== RCS file: /cvs/ports/devel/cmake/Makefile,v retrieving revision 1.139 diff -u -p -u -p -r1.139 Makefile --- Makefile 26 Jan 2016 08:44:07 -0000 1.139 +++ Makefile 27 Jan 2016 13:10:03 -0000 @@ -2,12 +2,6 @@ DPB_PROPERTIES =parallel -# avoid segfaults from binaries compiled and then used during the build -.if ${MACHINE_ARCH} == "arm" -CFLAGS += -O1 -fno-stack-protector -CXXFLAGS += -O1 -fno-stack-protector -.endif - COMMENT = portable build system VER = 3.4.3 @@ -25,9 +19,14 @@ PERMIT_PACKAGE_CDROM = Yes WANTLIB += archive c curl expat form jsoncpp m ncurses pthread stdc++ z -# XXX: CMake's built-in ELF parser is broken on arm +# XXX: On arm libstdc++ from base (and especially iostream) seems +# to be broken, so use g++ from ports. +MODULES = gcc4 +MODGCC4_ARCHS = arm +MODGCC4_LANGS = c++ + # XXX: Ninja is broken on m88k -.if ${MACHINE_ARCH} != "arm" && ${MACHINE_ARCH} != "m88k" +.if ${MACHINE_ARCH} != "m88k" BUILD_DEPENDS = devel/ninja>=1.5.1 .endif @@ -72,9 +71,8 @@ pre-configure: ${WRKSRC}/Modules/FindSDL.cmake \ ${WRKSRC}/Modules/FindTCL.cmake -# XXX: CMake's built-in ELF parser is broken on arm # XXX: Ninja is broken on m88k -.if ${MACHINE_ARCH} != "arm" && ${MACHINE_ARCH} != "m88k" +.if ${MACHINE_ARCH} != "m88k" do-build: cd ${WRKBUILD} && exec ${SETENV} ${MAKE_ENV} ninja -v -j \ ${MAKE_JOBS} ${ALL_TARGET} Index: cmake.port.mk =================================================================== RCS file: /cvs/ports/devel/cmake/cmake.port.mk,v retrieving revision 1.52 diff -u -p -u -p -r1.52 cmake.port.mk --- cmake.port.mk 26 Jan 2016 08:44:07 -0000 1.52 +++ cmake.port.mk 27 Jan 2016 13:10:03 -0000 @@ -9,9 +9,8 @@ MAKE_ENV+=LIB${_n}_VERSION=${_v} USE_NINJA ?= Yes -# XXX: CMake's built-in ELF parser is broken on arm # XXX: Ninja is broken on m88k -.if ${MACHINE_ARCH} == "arm" || ${MACHINE_ARCH} == "m88k" +.if ${MACHINE_ARCH} == "m88k" USE_NINJA = No .endif Index: patches/patch-Source_CMakeLists_txt =================================================================== RCS file: patches/patch-Source_CMakeLists_txt diff -N patches/patch-Source_CMakeLists_txt --- patches/patch-Source_CMakeLists_txt 31 Dec 2014 11:06:02 -0000 1.6 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,15 +0,0 @@ -$OpenBSD: patch-Source_CMakeLists_txt,v 1.6 2014/12/31 11:06:02 dcoppa Exp $ - -XXX: CMake's built-in ELF parser is broken on arm - ---- Source/CMakeLists.txt.orig Mon Dec 15 14:07:43 2014 -+++ Source/CMakeLists.txt Thu Dec 18 05:37:12 2014 -@@ -16,7 +16,7 @@ if(CMAKE_CXX_PLATFORM_ID MATCHES "OpenBSD") - else() - CHECK_INCLUDE_FILE("elf.h" HAVE_ELF_H) - endif() --if(HAVE_ELF_H) -+if(HAVE_ELF_H AND NOT CMAKE_SYSTEM_PROCESSOR MATCHES "^arm") - set(CMAKE_USE_ELF_PARSER 1) - elseif(HAIKU) - # On Haiku, we need to include elf32.h from the private headers Index: patches/patch-bootstrap =================================================================== RCS file: /cvs/ports/devel/cmake/patches/patch-bootstrap,v retrieving revision 1.10 diff -u -p -u -p -r1.10 patch-bootstrap --- patches/patch-bootstrap 8 Dec 2015 17:18:59 -0000 1.10 +++ patches/patch-bootstrap 27 Jan 2016 13:10:03 -0000 @@ -1,7 +1,7 @@ $OpenBSD: patch-bootstrap,v 1.10 2015/12/08 17:18:59 dcoppa Exp $ Use Ninja to build CMake -XXX: broken on arm and m88k +XXX: broken on m88k --- bootstrap.orig Thu Nov 12 16:39:53 2015 +++ bootstrap Mon Nov 23 16:54:15 2015 @@ -10,7 +10,7 @@ XXX: broken on arm and m88k else # Bootstrapping from a standard UNIX prompt. - cmake_bootstrap_generator="Unix Makefiles" -+ if arch -s | egrep -q '^arm|^m88k'; then ++ if arch -s | grep -q '^m88k'; then + cmake_bootstrap_generator="Unix Makefiles" + else + cmake_bootstrap_generator="Ninja"