I am trying to run the http://iphonedevwiki.net/index.php/Theos/Setup tutorial but stuck on this step:
./make.sh
+ xcrun -sdk macosx g++ -mmacosx-version-min=10.4 -arch i386 -arch x86_64 -I. -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.4.sdk/usr/include/libxml2 -Ilibplist/include -Ilibplist/libcnary/include -c -std=c++11 -o out/ldid.o ldid.cpp
+ xcrun -sdk macosx g++ -mmacosx-version-min=10.4 -arch i386 -arch x86_64 -I. -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.4.sdk/usr/include/libxml2 -Ilibplist/include -Ilibplist/libcnary/include -o out/ldid out/ldid.o out/iterator.o out/list.o out/node.o out/node_iterator.o out/node_list.o out/base64.o out/bplist.o out/bytearray.o out/hashtable.o out/plist.o out/ptrarray.o out/xplist.o -x c lookup2.c -lxml2 -framework Security -lcrypto
clang: warning: libstdc++ is deprecated; move to libc++ with a minimum deployment target of OS X 10.9 [-Wdeprecated]
clang: warning: libstdc++ is deprecated; move to libc++ with a minimum deployment target of OS X 10.9 [-Wdeprecated]
ld: library not found for -lcrypto
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Could you please help?
Check if -lcrypto is installed on your system (on a Linux system, you could try calling ldconfig -p | grep libcrypto, but if you are using macOS, try to find some equivalent)
Make sure your g++ call contains proper path if this library is at some specific location that will not be searched by g++ by default.
You can read about including libraries and header files in this stack overflow topic: https://stackoverflow.com/a/6141166/4802475
Related
I am working on mac system.
g++ version is "Apple clang version 12.0.0 (clang-1200.0.32.2) Target: x86_64-apple-darwin20.6.0"(I typed g++ --version).
I need to install a c++ package with command - ' $(COMPILER) $(FLAGS) <file_name>.o output.o -lm -o <file_name> '
What should I write in the place of $(FLAGS)?
This link says there is no flag for g++-12. Then, should I update the version of g++?
P.S.
Thanks who commented.
After reading all those, I tried to reinstall the package.
I know now that g++ version is 11.
I typed - 'g++ -std=c++11 <file_name>.o -lm -o <file_name>'
It worked without any error. There is a file in that folder with the name '<file_name>.o'.
After the installation (without any error) I typed - 'g++ <file1_name>.cpp -o <file1_name>' I have got an error -
Undefined symbols for architecture x86_64:
...
...
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
So, what should I do now?
The following compile command with clang6.0:
LDFLAGS="-L/usr/local/opt/myllvm6.0rc1/lib -fuse-ld=lld"
CPPFLAGS="-I/usr/local/opt/myllvm6.0rc1/include -I/usr/local/opt/myllvm6.0rc1/include/c++/v1/";
clang++ -fsanitize=address $LDFLAGS $CPPFLAGS -g -v main.cpp
gives:
"/usr/local/opt/myllvm6.0rc1/bin/ld64.lld" -demangle -lto_library /usr/local/opt/myllvm6.0rc1/lib/libLTO.dylib -no_deduplicate -dynamic -arch x86_64 -macosx_version_min 10.11.0 -o a.out -L/usr/local/opt/myllvm6.0rc1/lib /var/folders/14/rc46ppds1ms2kj_mvdcxlc040000gn/T/main-113675.o -lc++ /usr/local/opt/myllvm6.0rc1/lib/clang/6.0.0/lib/darwin/libclang_rt.asan_osx_dynamic.dylib -rpath #executable_path -rpath /usr/local/opt/myllvm6.0rc1/lib/clang/6.0.0/lib/darwin -lSystem /usr/local/opt/myllvm6.0rc1/lib/clang/6.0.0/lib/darwin/libclang_rt.osx.a
warning: ignoring unknown argument: -no_deduplicate
warning: -sdk_version is required when emitting min version load command. Setting sdk version to match provided min version
Unable to find library for -lto_library
clang-6.0: error: linker command failed with exit code 1 (use -v to see invocation)
I dont understand why it cant load the /usr/local/opt/myllvm6.0rc1/lib/libLTO.dylib (it exists at this location!)
Any idea?
You are using -fuse-ld=lld which is what the LLD documentation says to do and as you can see ld64.lld is being run. However, the flag -no_deduplicate is not an lld flag; it is an OSX ld flag. The ld64.lld man page is here:
https://manpages.ubuntu.com/manpages/disco/man1/ld.lld.1.html
I follow the instruction and the ans to setup gtest for xcode. But
it still doesn't work and i got the error below:
Ld
/Users/xiaxin/Library/Developer/Xcode/DerivedData/Calculator-cchvzojufxzxgfdevhkifabakxpl/Build/Products/Debug/Tests
normal x86_64 cd /Users/xiaxin/Documents/xCode/Calculator export
MACOSX_DEPLOYMENT_TARGET=10.10
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++
-arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk
-L/Users/xiaxin/Library/Developer/Xcode/DerivedData/Calculator-cchvzojufxzxgfdevhkifabakxpl/Build/Products/Debug
-L/usr/local/lib -F/Users/xiaxin/Library/Developer/Xcode/DerivedData/Calculator-cchvzojufxzxgfdevhkifabakxpl/Build/Products/Debug
-filelist /Users/xiaxin/Library/Developer/Xcode/DerivedData/Calculator-cchvzojufxzxgfdevhkifabakxpl/Build/Intermediates/Calculator.build/Debug/Tests.build/Objects-normal/x86_64/Tests.LinkFileList
-mmacosx-version-min=10.10 -lgtest -stdlib=libc++ -framework gtest -Xlinker -dependency_info -Xlinker /Users/xiaxin/Library/Developer/Xcode/DerivedData/Calculator-cchvzojufxzxgfdevhkifabakxpl/Build/Intermediates/Calculator.build/Debug/Tests.build/Objects-normal/x86_64/Tests_dependency_info.dat
-o /Users/xiaxin/Library/Developer/Xcode/DerivedData/Calculator-cchvzojufxzxgfdevhkifabakxpl/Build/Products/Debug/Tests
ld: framework not found gtest clang: error: linker command failed with
exit code 1 (use -v to see invocation)
You need to add the GTest library to your library path. You can accomplish this on the commandline by setting -L/path/to/gtest
I have recently installed R 3.1.3. I am using a Mac with Yosemite system and my Xcode is of version 6.2.
After I source the CPP file using sourceCpp("try.cpp"), I get the following error. My try.cpp file has
#include <RcppArmadillo.h>
#include <math.h>
The error is below in R
ld: warning: directory not found for option '-L/usr/local/lib/gcc/x86_64-apple-darwin13.0.0/4.8.2'
ld: library not found for -lquadmath
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [sourceCpp_15736.so] Error 1
clang++ -arch x86_64 -ftemplate-depth-256 -I/Library/Frameworks/R.framework/Resources/include -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RcppArmadillo/include" -fPIC -mtune=core2 -O3 -c CAR.cpp -o CAR.o
clang++ -arch x86_64 -ftemplate-depth-256 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module - multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib - L/usr/local/lib -o sourceCpp_15736.so CAR.o -L/Library/Frameworks/R.framework/Resources/lib -lRlapack -L/Library/Frameworks/R.framework/Resources/lib -lRblas -L/usr/local/lib/gcc/x86_64-apple-darwin13.0.0/4.8.2 -lgfortran -lquadmath -lm -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
Error in sourceCpp("~/RA2015/Code/BYMCAR/CAR.cpp") :
Error 1 occurred building shared library.
WARNING: The tools required to build C++ code for R were not found.
Please install Command Line Tools for XCode (or equivalent).
I have installed the command line tools for Xcode, my gfortran version is 4.9.0
But when I type
gfortran --version
It has the following error:
gfortran: warning: couldn’t understand kern.osversion ‘14.1.0
When I use R 3.1.2, I did not encounter this problem before!
Any help is appreciated!
After some finding I find a solution online.
If you have same problem with me, just type
curl -O http://r.research.att.com/libs/gfortran-4.8.2-darwin13.tar.bz2
sudo tar fvxz gfortran-4.8.2-darwin13.tar.bz2 -C /
on the terminal and sourceCpp can run smoothly.
A detailed explanation can be found at [http://www.thecoatlessprofessor.com/programming/rcpp-rcpparmadillo-and-os-x-mavericks-lgfortran-and-lquadmath-error]
I used the method described in the answer of: https://stackoverflow.com/a/18922738/2197292
to build Assimp 3.0 on my Mac OS X 10.9. I use Xcode 5.0.2. Then I added libassimp.a to frameworks and added /usr/local/include/assimp to header search paths. Am I missing something? When I build my project I get this error:
Ld DerivedData/OpenGLGLSL5Assimp/Build/Products/Debug/OpenGLGLSL5Assimp.app/Contents/MacOS/OpenGLGLSL5Assimp normal x86_64
cd /Users/MATH/Documents/XCODE/OpenGLGLSL5Assimp
setenv MACOSX_DEPLOYMENT_TARGET 10.8
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -L/Users/MATH/Documents/XCODE/OpenGLGLSL5Assimp/DerivedData/OpenGLGLSL5Assimp/Build/Products/Debug -F/Users/MATH/Documents/XCODE/OpenGLGLSL5Assimp/DerivedData/OpenGLGLSL5Assimp/Build/Products/Debug -filelist /Users/MATH/Documents/XCODE/OpenGLGLSL5Assimp/DerivedData/OpenGLGLSL5Assimp/Build/Intermediates/OpenGLGLSL5Assimp.build/Debug/OpenGLGLSL5Assimp.build/Objects-normal/x86_64/OpenGLGLSL5Assimp.LinkFileList -mmacosx-version-min=10.8 -stdlib=libc++ -fobjc-arc -fobjc-link-runtime -lassimp -framework GLUT -framework OpenGL -framework Cocoa -Xlinker -dependency_info -Xlinker /Users/MATH/Documents/XCODE/OpenGLGLSL5Assimp/DerivedData/OpenGLGLSL5Assimp/Build/Intermediates/OpenGLGLSL5Assimp.build/Debug/OpenGLGLSL5Assimp.build/Objects-normal/x86_64/OpenGLGLSL5Assimp_dependency_info.dat -o /Users/MATH/Documents/XCODE/OpenGLGLSL5Assimp/DerivedData/OpenGLGLSL5Assimp/Build/Products/Debug/OpenGLGLSL5Assimp.app/Contents/MacOS/OpenGLGLSL5Assimp
ld: library not found for -lassimp
clang: error: linker command failed with exit code 1 (use -v to see invocation)