build x264 failed on apple M1, No working C compiler found - apple-m1

Apple M1, clang
Apple clang version 13.0.0 (clang-1300.0.29.3)
Target: arm64-apple-darwin21.1.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
x264 version x264-snapshot-20191217-2245
configure
./configure --prefix=/tmp/ --enable-static
config.log
checking for -Werror=unknown-warning-option... yes
checking for -mdynamic-no-pic... yes
x264 configure script
Command line options: "--prefix=/tmp/" "--enable-static"
checking whether gcc works... no
Failed commandline was:
--------------------------------------------------
gcc conftest.c -Wall -I. -I$(SRCPATH) -mdynamic-no-pic -arch armv7 -Werror=unknown-warning-option -lm -arch armv7 -o conftest
ld: warning: ignoring file /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/13.0.0/lib/darwin/libclang_rt.osx.a, missing required architecture armv7 in file /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/13.0.0/lib/darwin/libclang_rt.osx.a (5 slices)
ld: warning: ignoring file /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/libm.tbd, missing required architecture armv7 in file /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/libm.tbd (3 slices)
ld: warning: ignoring file /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/libSystem.tbd, missing required architecture armv7 in file /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/libSystem.tbd (3 slices)
ld: dynamic main executables must link with libSystem.dylib for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
--------------------------------------------------
Failed program was:
--------------------------------------------------
int main (void) { return 0; }
--------------------------------------------------
DIED: No working C compiler found.

x264 source snapshot tarballs have not been updated for a long time. You need to update x264 sources to a newer version: https://code.videolan.org/videolan/x264/
Apple Silicon support in x264 was added at the end of 2020.

Related

Mingw32-make Error 1 & 2 while compiling a Libary

I tried everything I could think of already to fix it but after several Hours I just give up. I want to compile a Lib with qmake to include a parse for csv files. Sadly when I use mingw32-make I get this Error:
C:\Users\Deto24\Downloads\qtcsv-1.5\build>qmake ..\qtcsv.pro CONFIG+=[release] DESTDIR=%cd%
Info: creating stash file C:\Users\Deto24\Downloads\qtcsv-1.5\build\.qmake.stash
Project MESSAGE: === Configuration of qtcsv ===
Project MESSAGE: Qt version: 6.0.2
Project MESSAGE: Library version: 1.5.0
Project MESSAGE: Library files will be created in folder: C:/Users/Deto24/Downloads/qtcsv-1.5/build
Project MESSAGE: === Configuration of qtcsv ===
Project MESSAGE: Qt version: 6.0.2
Project MESSAGE: Library version: 1.5.0
Project MESSAGE: Library files will be created in folder: C:/Users/Deto24/Downloads/qtcsv-1.5/build
Project MESSAGE: === Configuration of qtcsv ===
Project MESSAGE: Qt version: 6.0.2
Project MESSAGE: Library version: 1.5.0
Project MESSAGE: Library files will be created in folder: C:/Users/Deto24/Downloads/qtcsv-1.5/build
C:\Users\Deto24\Downloads\qtcsv-1.5\build>mingw32-make
mingw32-make -f Makefile.Release
mingw32-make[1]: Entering directory 'C:/Users/Deto24/Downloads/qtcsv-1.5/build'
g++ -c -fno-keep-inline-dllexport -O2 -std=gnu++1z -Wall -Wextra -Wextra -Werror -Wformat=2 -Wuninitialized -Winit-self -Wswitch-enum -Wundef -Wpointer-arith -Wdisabled-optimization -Wcast-align -Wcast-qual -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQTCSV_LIBRARY -DQT_NO_DEBUG -DQT_CORE_LIB -I../../qtcsv-1.5 -I. -I../include -IC:/Qt/6.0.2/mingw81_64/include -IC:/Qt/6.0.2/mingw81_64/include/QtCore -Irelease -IC:/Qt/6.0.2/mingw81_64/mkspecs/win32-g++ -o release\writer.o ..\sources\writer.cpp
In file included from ..\sources\writer.cpp:1:
../../qtcsv-1.5/include/qtcsv/writer.h:6:10: fatal error: QTextCodec: No such file or directory
#include <QTextCodec>
^~~~~~~~~~~~
compilation terminated.
mingw32-make[1]: *** [Makefile.Release:248: release/writer.o] Error 1
mingw32-make[1]: Leaving directory 'C:/Users/Deto24/Downloads/qtcsv-1.5/build'
mingw32-make: *** [Makefile:45: release] Error 2
I'm fairly new to adding Lib's to QT and while there seems no real explains for how to compile those lib's step by step I could gather some Informations by myself. I created the PATH as you can see on the Picture, so I hope that is alright.
Any Ideas what I did wrong?

Package building in R with Rcpp -- failure to build a package

I am very new to building packages in R, but I am trying to build a package of already written cpp code to use it in a foreach code, as I am running my code on a Windows machine and I can't pass the cpp code to the nodes.
The cpp code I am trying to wrap in an R package comes from:
https://github.com/darinchristensen/conley-se
I am following the instructions from this website to build the package:
http://web.mit.edu/insong/www/pdf/rpackage_instructions.pdf
Here is the code I am using:
setwd("C:/Users/Tim/Documents/code/")
library(Rcpp)
library(RcppArmadillo)
RcppArmadillo.package.skeleton("itirun")
Then, I try
setwd("C:/Users/Tim/Documents/code/itirun/")
compileAttributes(verbose=TRUE)
And then in terminal I go to the directory, and run the following command which gives me the following error message. I am a newbie at building packages, and I fail to understand what I am doing wrong. I also tried adding compiler flags, but wasn't successful which is probably due to my lack of understanding:
C:\Users\Tim\Documents\code> R CMD build itirun
* checking for file 'itirun/DESCRIPTION' ... OK
* preparing 'itirun':
* checking DESCRIPTION meta-information ... OK
* cleaning src
installing the package to process help pages
Warning: running command '"C:/PROGRA~1/MICROS~2/ROPEN~1/R-
34~1.2/bin/x64/Rcmd.ex
e" INSTALL -l "C:\Users\Tim\AppData\Local\Temp\RtmpA39cZK\Rinst2c0631ac5b" -
-no
-multiarch "C:/Users/Tim/AppData/Local/Temp/RtmpA39cZK/Rbuild2c02fc3722a/itirun
"' had status 1
-----------------------------------
* installing *source* package 'itirun' ...
** libs
c:/Rtools/mingw_64/bin/g++ -m64 -I"C:/PROGRA~1/MICROS~2/ROPEN~1/R-34~1.2/include
" -DNDEBUG -I"C:/Users/Tim/Documents/R/win-library/3.4/Rcpp/include" -I"C:/Use
rs/Tim/Documents/R/win-library/3.4/RcppArmadillo/include" -I"C:/swarm/workspa
ce/External-R-3.4.2/vendor/extsoft/include" -fopenmp -O2 -Wall -mtune=core2
-c RcppExports.cpp -o RcppExports.o
In file included from C:/Users/Tim/Documents/R/win-library/3.4/RcppArmadillo/in
clude/armadillo:53:0,
from C:/Users/Tim/Documents/R/win-library/3.4/RcppArmadillo/in
clude/RcppArmadilloForward.h:46,
from C:/Users/Tim/Documents/R/win-library/3.4/RcppArmadillo/in
clude/RcppArmadillo.h:31,
from RcppExports.cpp:4:
C:/Users/Tim/Documents/R/win-library/3.4/RcppArmadillo/include/armadillo_bits/c
ompiler_setup.hpp:487:118: note: #pragma message: WARNING: support for OpenMP re
quires C++11/C++14; add -std=c++11 or -std=c++14 to compiler flags
#pragma message ("WARNING: support for OpenMP requires C++11/C++14; add -std=
c++11 or -std=c++14 to compiler flags")
^
c:/Rtools/mingw_64/bin/g++ -m64 -I"C:/PROGRA~1/MICROS~2/ROPEN~1/R-34~1.2/include
" -DNDEBUG -I"C:/Users/Tim/Documents/R/win-library/3.4/Rcpp/include" -I"C:/Use
rs/Tim/Documents/R/win-library/3.4/RcppArmadillo/include" -I"C:/swarm/workspa
ce/External-R-3.4.2/vendor/extsoft/include" -fopenmp -O2 -Wall -mtune=core2
-c cpp-functions.cpp -o cpp-functions.o
In file included from C:/Users/Tim/Documents/R/win-library/3.4/RcppArmadillo/in
clude/armadillo:53:0,
from C:/Users/Tim/Documents/R/win-library/3.4/RcppArmadillo/in
clude/RcppArmadilloForward.h:46,
from C:/Users/Tim/Documents/R/win-library/3.4/RcppArmadillo/in
clude/RcppArmadillo.h:31,
from cpp-functions.cpp:4:
C:/Users/Tim/Documents/R/win-library/3.4/RcppArmadillo/include/armadillo_bits/c
ompiler_setup.hpp:487:118: note: #pragma message: WARNING: support for OpenMP re
quires C++11/C++14; add -std=c++11 or -std=c++14 to compiler flags
#pragma message ("WARNING: support for OpenMP requires C++11/C++14; add -std=
c++11 or -std=c++14 to compiler flags")
^
In file included from C:/Users/Tim/Documents/R/win-library/3.4/RcppArmadillo/in
clude/RcppArmadillo.h:38:0,
from cpp-functions.cpp:4:
C:/Users/Tim/Documents/R/win-library/3.4/RcppArmadillo/include/RcppArmadilloAs.
h: In instantiation of 'Rcpp::traits::Exporter<arma::Cube<eT> >::cube_t Rcpp::tr
aits::Exporter<arma::Cube<eT> >::get() [with T = long long int; Rcpp::traits::Ex
porter<arma::Cube<eT> >::cube_t = arma::Cube<long long int>]':
C:/Users/Tim/Documents/R/win-library/3.4/RcppArmadillo/include/RcppArmadilloAs.
h:549:48: required from here
C:/Users/Tim/Documents/R/win-library/3.4/RcppArmadillo/include/RcppArmadilloAs.
h:514:49: error: invalid cast from type 'Rcpp::Vector<19>::iterator {aka Rcpp::i
nternal::Proxy_Iterator<Rcpp::internal::generic_proxy<19> >}' to type 'long long
int*'
dims[0], dims[1], dims[2], false);
^
make: *** [cpp-functions.o] Error 1
Warning: running command 'make -f "Makevars.win" -f "C:/PROGRA~1/MICROS~2/ROPEN~
1/R-34~1.2/etc/x64/Makeconf" -f "C:/PROGRA~1/MICROS~2/ROPEN~1/R-34~1.2/share/mak
e/winshlib.mk" SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)' SHL
IB="itirun.dll" WIN=64 TCLBIN=64 OBJECTS="RcppExports.o cpp-functions.o rcpparma
_hello_world.o"' had status 2
ERROR: compilation failed for package 'itirun'
* removing 'C:/Users/Tim/AppData/Local/Temp/RtmpA39cZK/Rinst2c0631ac5b/itirun'
-----------------------------------
ERROR: package installation failed

XCode 4 Unimotion

I use Xcode 4, and I currently dont have any iDevice right now to be able to test accelerometer in my application, so I googled for a while and find util named "unimotion". read me file for Unimotion says: "A Makefile is included so all you have to do is cd to the 'unimotion' directory and type 'make'." So I tried, but terminal give me a message
ls: /Developer/SDKs: No such file or directory cc -Wall -Os -g
-isysroot /Developer/SDKs/ -arch i386 -arch ppc -fconstant-cfstrings -c -o unimotion.o unimotion.c clang: warning: not using the clang compiler for the 'powerpc' architecture unimotion.c:72:10: fatal
error: 'IOKit/IOKitLib.h' file not found
include IOKit/IOKitLib.h>
1 error generated. make[1]: * [unimotion.o] Error 1 make: * [sub-unimotion] Error 2
again and again.
So, what am I doing wrong?
Thanks.
Rewrite all occurrences of /Developer/SDKs/ in the 3 Makefiles (calibrate/Makefile, motion/Makefile and unimotion/Makefile) with
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/
that should help you. If you're using Xcode 4, you'll probably get further error also
llvm-gcc-4.2: error trying to exec '/usr/bin/../llvm-gcc-4.2/bin/powerpc-apple-darwin11-llvm-gcc-4.2': execvp: No such file or directory
as the -arch ppc is not supported there anymore. Just delete every single occurrence of -arch ppc in Makefiles, and it will work.

Rcpp install fails on Mac 10.8

Rcpp is failing to install for me. When I run the following within the R console (R 2.15.1 on Mac 10.8):
install.packages("Rcpp")
I get the following error:
/usr/bin/clang++ -I/usr/local/Cellar/r/2.15.1/R.framework/Resources/include \
-DNDEBUG -I../inst/include/ -I/usr/local/Cellar/readline/6.2.4/include \
-isystem /usr/local/include -I/opt/X11/include -fPIC -Os -w -pipe - \
march=native -Qunused-arguments -mmacosx-version-min=10.8 \
-c exceptions.cpp -o exceptions.o
exceptions.cpp:82:14: fatal error: 'bits/exception_defines.h' file not found
#include <bits/exception_defines.h>
^
1 error generated.
make: *** [exceptions.o] Error 1
ERROR: compilation failed for package ‘Rcpp’
What am I doing wrong?
Which version of Rcpp? This is fixed in SVN:
2012-07-06 Dirk Eddelbuettel <edd#debian.org>
* inst/include/Rcpp/config.h: In order to not attempt to include
exception_defines.h if on OS X (as the clang runtime may not have
predictable access to g+++ headers providing these), do not define
RCPP_HAS_DEMANGLING which is used in src/exceptions.cpp
and was discussed on the rcpp-devel list.
I tried to accomodate OS X and clang >= 3.0, but the interaction of clang and g++ is a little tricky. Try to fetch the file from SVN or just edit the section in it to yield
#ifdef __GNUC__
// from http://sourceforge.net/apps/mediawiki/predef/index.php?\
// title=Operating_Systems#MacOS
#ifndef __APPLE__
#ifndef __MACH__
#define RCPP_HAS_DEMANGLING
#endif
#endif
#endif
which turns this off for all OS X instances.

"Apple Mach-O (id) linker" error when adding external libraries to project

I added FMDB to my project then added the frameworks libsqlite3.dylib and libsqlite3.0.dylib, but I still get the build error. If I remove the FMDB classes from my project then it builds just fine. What other things should I check?
Detailed info on the error:
Ld /Users/gmi/Library/Developer/Xcode/DerivedData/iNROMockUp5->gjmgpakyszrgwbbxnkdxehexacxm/Build/Products/Debug->iphonesimulator/iNROMockUp5.app/iNROMockUp5 normal i386
cd /iOSDev/Testing/iNROMockUp5
setenv MACOSX_DEPLOYMENT_TARGET 10.6
setenv PATH >"/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bi>n:/bin:/usr/sbin:/sbin"
/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-gcc-4.2 -arch i386 >-isysroot >/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk ->L/Users/gmi/Library/Developer/Xcode/DerivedData/iNROMockUp5->gjmgpakyszrgwbbxnkdxehexacxm/Build/Products/Debug-iphonesimulator ->F/Users/gmi/Library/Developer/Xcode/DerivedData/iNROMockUp5->gjmgpakyszrgwbbxnkdxehexacxm/Build/Products/Debug-iphonesimulator -filelist >/Users/gmi/Library/Developer/Xcode/DerivedData/iNROMockUp5->gjmgpakyszrgwbbxnkdxehexacxm/Build/Intermediates/iNROMockUp5.build/Debug->iphonesimulator/iNROMockUp5.build/Objects-normal/i386/iNROMockUp5.LinkFileList -mmacosx->version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -lsqlite3 -lsqlite3.0 -framework >MapKit -framework UIKit -framework Foundation -framework CoreGraphics -o >/Users/gmi/Library/Developer/Xcode/DerivedData/iNROMockUp5->gjmgpakyszrgwbbxnkdxehexacxm/Build/Products/Debug->iphonesimulator/iNROMockUp5.app/iNROMockUp5
ld: duplicate symbol _main in /Users/gmi/Library/Developer/Xcode/DerivedData/iNROMockUp5->gjmgpakyszrgwbbxnkdxehexacxm/Build/Intermediates/iNROMockUp5.build/Debug->iphonesimulator/iNROMockUp5.build/Objects-normal/i386/fmdb.o and >/Users/gmi/Library/Developer/Xcode/DerivedData/iNROMockUp5->gjmgpakyszrgwbbxnkdxehexacxm/Build/Intermediates/iNROMockUp5.build/Debug->iphonesimulator/iNROMockUp5.build/Objects-normal/i386/main.o for architecture i386
collect2: ld returned 1 exit status
Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-gcc-4.2 failed >with exit code 1
ld: duplicate symbol _main in /Users/gmi/Library/Developer/Xcode/DerivedData/iNROMockUp5->gjmgpakyszrgwbbxnkdxehexacxm/Build/Intermediates/iNROMockUp5.build/Debug->iphonesimulator/iNROMockUp5.build/Objects-normal/i386/fmdb.o and >/Users/gmi/Library/Developer/Xcode/DerivedData/iNROMockUp5->gjmgpakyszrgwbbxnkdxehexacxm/Build/Intermediates/iNROMockUp5.build/Debug->iphonesimulator/iNROMockUp5.build/Objects-normal/i386/main.o for architecture i386
Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-gcc-4.2 failed with exit code 1
Remove fmdb.m from your project and you will be fine.
Remove main.m from your project and you will be fine.

Resources