Installed SFML on Mac OS according to tutorial http://www.sfml-dev.org/tutorials/2.0/start-osx.php (Xcode 6.1), it's kinda worked, so I can create SMFL app, but when i try to build that standart project it comes with the following error
Ld /Users/andreybondar/Library/Developer/Xcode/DerivedData/Test-draycgeyywzpqjgugruuudxcdqqj/Build/Intermediates/Test.build/Debug/Test.build/Objects-normal/x86_64/Test normal x86_64
cd /Users/andreybondar/Desktop/Test
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.10.sdk -L/Users/andreybondar/Library/Developer/Xcode/DerivedData/Test-draycgeyywzpqjgugruuudxcdqqj/Build/Products/Debug -L/usr/local/lib -F/Users/andreybondar/Library/Developer/Xcode/DerivedData/Test-draycgeyywzpqjgugruuudxcdqqj/Build/Products/Debug -F/Library/Frameworks -filelist /Users/andreybondar/Library/Developer/Xcode/DerivedData/Test-draycgeyywzpqjgugruuudxcdqqj/Build/Intermediates/Test.build/Debug/Test.build/Objects-normal/x86_64/Test.LinkFileList -mmacosx-version-min=10.10 -frameworksfml-system -frameworksfml-window -frameworksfml-graphics -frameworksfml-audio -frameworksfml-network -stdlib=libc++ -fobjc-link-runtime -Xlinker -dependency_info -Xlinker /Users/andreybondar/Library/Developer/Xcode/DerivedData/Test-draycgeyywzpqjgugruuudxcdqqj/Build/Intermediates/Test.build/Debug/Test.build/Objects-normal/x86_64/Test_dependency_info.dat -o /Users/andreybondar/Library/Developer/Xcode/DerivedData/Test-draycgeyywzpqjgugruuudxcdqqj/Build/Intermediates/Test.build/Debug/Test.build/Objects-normal/x86_64/Test
clang: error: unknown argument: '-frameworksfml-system'
clang: error: unknown argument: '-frameworksfml-window'
clang: error: unknown argument: '-frameworksfml-graphics'
clang: error: unknown argument: '-frameworksfml-audio'
clang: error: unknown argument: '-frameworksfml-network'
So, what I should do to make it work, cause i already tried to manually put all SFML files in their directories, and don't know what else I can do.
You are reading the old version of the tutorial. Read the ones for SFML 2.1 instead. One of the differences is this message:
If you have Xcode 5, you must use the new version of the templates.
which is available on the download page. Long story short, this update of the template fixes a regression introduced in Xcode 5 and later.
source
Related
Main question is: How do I get the clang error out of make?
I have been trying to follow these instructions to install GLEW. On second look I've seen that GLEW might not really be necessary on Mac OS X, but I'd still like to find out how to get the error from the problem I was having. (I am not very experienced with make and could not make any similar online solutions work).
Theoretically I should download GLEW, unzip, and run 'make' in the file. This is the output of make:
$ make
cc -dynamiclib -install_name /usr/local/lib/libGLEW.2.1.0.dylib -current_version 2.1.0 -compatibility_version 2.1 -o lib/libGLEW2.1.0.dylib tmp/darwin/default/shared/glew.o -framework OpenGL
ld: malformed file
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks//OpenGLframework/OpenGL.tbd:4:18: error: unknown enumerated scalar
platform: zippered
^~~~~~~~
file '/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Framework//OpenGL.framework/OpenGL.tbd'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [lib/libGLEW.2.1.0.dylib] Error 1
Make -n shows that this is just the first command and it pretty much immediately fails. I have tried make V=1, make VERBOSE=1, and make SHELL='sh -x', but they don't give me additional detail about the clang error. I've also tried running the cc command with -v:
$ cc -v -dynamiclib -install_name /usr/local/lib/libGLEW.2.1.0.dylib -current_version 2.1.0 -compatibility_version 2.1 -o lib/libGLEW2.1.0.dylib tmp/darwin/default/shared/glew.o -framework OpenGL
Apple LLVM version 9.1.0 (clang-902.0.39.1)
Target: x86_64-apple-darwin18.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
"Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -lto_library /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libLTO.dylib -dynamic -dylib -dylib_compatibility_version 2.1 -dylib_current_version 2.1.0 -arch x86_64 -dyib_install_name /usr/local/lib/libGLEW.2.1.0.dylib -macosx_version_min 10.14.0 -syslibroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -o lib/libGLEW.2.1.0.dylib tmp/darwin/default/shared/glew.o -framework OpenGL -L/usr/local/lib -lSystem / Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchains/usr/lib/clang/9.1.0/lib/darwin/libclang_rt.osx.a
ld: malformed file
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks//OpenGLframework/OpenGL.tbd:4:18: error: unknown enumerated scalar
platform: zippered
^~~~~~~~
file '/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Framework//OpenGL.framework/OpenGL.tbd'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [lib/libGLEW.2.1.0.dylib] Error 1
I don't think I am actually managing to get the real error out of clang. So how do I do that?
It is
Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld -demangle -lto_library /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libLTO.dylib -dynamic -dylib -dylib_compatibility_version 2.1 -dylib_current_version 2.1.0 -arch x86_64 -dyib_install_name /usr/local/lib/libGLEW.2.1.0.dylib -macosx_version_min 10.14.0 -syslibroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -o lib/libGLEW.2.1.0.dylib tmp/darwin/default/shared/glew.o -framework OpenGL -L/usr/local/lib -lSystem / Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchains/usr/lib/clang/9.1.0/lib/darwin/libclang_rt.osx.a
command that fails, which is ld, not clang. You can run this command separately to get the same error message.
And
ld: malformed file
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks//OpenGLframework/OpenGL.tbd:4:18: error: unknown enumerated scalar
platform: zippered
^~~~~~~~
file '/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Framework//OpenGL.framework/OpenGL.tbd'
is linker's error message. Unfortunately, I'm not familiar with compilation process on Mac, so can't advice how to fix it.
Trying to link a simple program using LLVM 4.0.0 release (Clang, LLD) on Mac OS Sierra.
Note, this is fully achievable in Linux.
My current path is prefixed with the LLVM's bin directory (i.e. /opt/LLVM/4.0.0/bin:$PATH.
The program (main.cpp) is the simplest possible C++ application:
int main()
{
return 0;
}
The shell command issued is: clang -fuse-ld=lld.
This fails with these errors:
/opt/llvm/4/bin/ld.lld: error: unknown argument: -no_deduplicate
/opt/llvm/4/bin/ld.lld: error: unknown argument: -dynamic
/opt/llvm/4/bin/ld.lld: error: unknown argument: -arch
/opt/llvm/4/bin/ld.lld: error: unknown emulation: acosx_version_min
/opt/llvm/4/bin/ld.lld: error: unable to find library -lto_library
/opt/llvm/4/bin/ld.lld: error: /opt/llvm/4/lib/libLTO.dylib: invalid data encoding
clang-4.0: error: linker command failed with exit code 1 (use -v to see invocation)
Using the -v switch, I see this linker command (formatted):
"/opt/llvm/4/bin/ld.lld" \
-demangle \
-lto_library /opt/llvm/4/lib/libLTO.dylib \
-no_deduplicate \
-dynamic \
-arch x86_64 \
-macosx_version_min 10.12.0 \
-o a.out \
main.o \
-lSystem /opt/llvm/4/bin/../lib/clang/4.0.0/lib/darwin/libclang_rt.osx.a
Does anyone know the proper switches for this platform?
After contacting the LLVM-dev mailing list, it appears that LLD for macOS (meaning, Mach-O object format linking) development is stale.
To use Clang on macOS, it's best to stick with the OS-provided ld64.
If the only reason to use LLVM-lld is speed, then try zld
https://github.com/michaeleisel/zld/
It's consistently cuts time to half (often to less than half) as compared to that taken by Apple-ld.
Add the following linker flag:
-fuse-ld=`which zld` -Wl,-zld_original_ld_path,ld
I'm trying to use OpenNI with my kinect but I have a problem during the build. I get this error :
ld: library not found for -lOpenNI
clang: error: linker command failed with exit code 1 (use -v to see invocation)
When I try "ld -lOpenNI" in terminal it finds it, and the path to the libOpenNI.dylib has been added to the library search paths (it's just /usr/lib). It has also been linked in "link binary With Libraries". I have tried to clean the build folder.
The whole compiler argument is :
Ld /Users/henrax/Library/Developer/Xcode/DerivedData/handtracker-dafbaeqppvdfnfhgffkyffwhskyl/Build/Products/Debug/handtracker normal x86_64
cd /Users/henrax/Documents/handtracker
export MACOSX_DEPLOYMENT_TARGET=10.11
/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/henrax/Library/Developer/Xcode/DerivedData/handtracker-dafbaeqppvdfnfhgffkyffwhskyl/Build/Products/Debug -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/lib -F/Users/henrax/Library/Developer/Xcode/DerivedData/handtracker-dafbaeqppvdfnfhgffkyffwhskyl/Build/Products/Debug -filelist /Users/henrax/Library/Developer/Xcode/DerivedData/handtracker-dafbaeqppvdfnfhgffkyffwhskyl/Build/Intermediates/handtracker.build/Debug/handtracker.build/Objects-normal/x86_64/handtracker.LinkFileList -mmacosx-version-min=10.9 -stdlib=libc++ -framework GLUT -framework OpenGL /Applications/Kinect/OpenNI-Bin-Dev-MacOSX-v1.5.7.10/Samples/NiHandTracker/x64-Release/NiHandTracker.o /Applications/Kinect/OpenNI-Bin-Dev-MacOSX-v1.5.7.10/Samples/NiHandTracker/x64-Release/NiHandViewer.o /Applications/Kinect/OpenNI-Bin-Dev-MacOSX-v1.5.7.10/Samples/NiHandTracker/x64-Release/NiSimpleViewer.o -lOpenNI -lOpenNI.jni /Applications/Kinect/OpenNI-Bin-Dev-MacOSX-v1.5.7.10/Samples/NiHandTracker/x64-Release/main.o -Xlinker -dependency_info -Xlinker /Users/henrax/Library/Developer/Xcode/DerivedData/handtracker-dafbaeqppvdfnfhgffkyffwhskyl/Build/Intermediates/handtracker.build/Debug/handtracker.build/Objects-normal/x86_64/handtracker_dependency_info.dat -o /Users/henrax/Library/Developer/Xcode/DerivedData/handtracker-dafbaeqppvdfnfhgffkyffwhskyl/Build/Products/Debug/handtracker
It seems like a pretty easy problem but I have searched and not found any solution. Any help would be very welcomed !
I am still having trouble building the Portaudio library on my system, which is OSX 10.7.5 with Xcode 4.3.2, having Command Line Tools installed and having SDK10.6 and SDK10.7 under
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/
I describe shortly (also for others that run into the same problem) what I have done so far (following different solutions I have found on the web).
1) I downloaded "Portaudio" / pa_stable_v19_20111121.tgz (last stable release) from:
www.portaudio.com/download.html
2) I read the instructions on building Portaudio here:
www.portaudio.com/docs/v19-doxydocs/compile_mac_coreaudio.html
and tried to compile from a Terminal window with the suggested command:
./configure && make
This resulted (not so surprisingly) in a lot of errors ending with:
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
lipo: can't open input file: /var/folders/1_/xkp08ky561jg02zjjrpsxg940000gn/T//ccPxCTrJ.out (No such file or directory)
make: * [src/hostapi/coreaudio/pa_mac_core.lo] Error 1
This happens because "ppc" is not supported anymore since OSX 10.5. Moreover the "Developer" folder doesn't exist on OSX 10.7 and everything that was in the Developer folder has moved to
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/
3) I downloaded a patch (mac_configure_patch.txt) to fix "configure" from:
https://www.assembla.com/spaces/portaudio/tickets/216#/activity/ticket:
and copied it to the portaudio directory and applied it by typing in Terminal:
$ patch < mac_configure_patch.txt
A confirmation message said:
patching file configure.in
So everything seems fine. But still Portaudio is trying to build for "ppc".
4) Now I set the ARCHFLAGS, CFLAGS, LDFLAGS to only build for architecture i386 as follows (disabling universal build):
$ MACOSX_DEPLOYMENT_TARGET="10.7" ARCHFLAGS="-arch i386" CFLAGS="-O2 -g -Wall -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk -arch i386 -mmacosx-version-min=10.7" LDFLAGS="-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sd -arch i386 -mmacosx-version-min=10.7" ./configure --disable-mac-universal
5) Further I found that:
A): "#include AudioToolbox.h" in ".include/pa_mac_core.h" should be UNCOMMENTED
B): that "-wError" from "Makefile" (not Makefile.in) should be removed.
accoding to:
http://www.fluxforge.com/blog/building-portaudio-under-os-x-107-lion
6) Now I try to build (using: "sudo make"), compilation starts but but fails with:
ld: framework not found CoreAudio
collect2: ld returned 1 exit status
make: * [lib/libportaudio.la] Error 1
7) So I try to point to the framework using "-F/System/Library/Frameworks -framework CoreAudio"
leading to the following Terminal command:
$ MACOSX_DEPLOYMENT_TARGET="10.7" ARCHFLAGS="-arch i386" CFLAGS="-O2 -g -Wall -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk -arch i386 -mmacosx-version-min=10.7" LDFLAGS="-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sd -arch i386 -mmacosx-version-min=10.7 -F/System/Library/Frameworks -framework CoreAudio" ./configure --disable-mac-universal
which seems to fix the CoreAudio framework issue but results in another error saying:
ld: library not found for -lSystem
collect2: ld returned 1 exit status
make: * [lib/libportaudio.la] Error 1
I am now stuck at this point. Did anyone experience the same problems when trying to build Portaudio on OSX 10.7 using SDK10.6 or SDK10.7. Did anyone find a solution to how to build Portaudio from Terminal?
I am very thankful for any hints!!!
Thanks in advance!
Try the latest svn. If that doesn't work right off the bat, you might need to muck with some of the flags.
eg, in configure.in:
change -Werror to -Wall
add -Wno-deprecated (you shouldn't need this, but just in case)
then run
./configure --disable-mac-universal
and make as usual.
OK, finally I solved the issue. Hope the solution will help others as well. I just forgot to also add the path to the CoreAudio framework to the CFLAGS. Here is the final configure/build command for building portaudio on OSX 10.7.5 using SDK10.7 for architecture i386 & x86_64:
Open a Terminal window in the portaudio directory and type:
MACOSX_DEPLOYMENT_TARGET="10.7" ARCHFLAGS="-arch i386" CFLAGS="-O2 -g -Wall -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk -arch i386 -mmacosx-version-min=10.7 -F/System/Library/Frameworks -framework CoreAudio" LDFLAGS="-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk -arch i386 -mmacosx-version-min=10.7 -F/System/Library/Frameworks -framework CoreAudio" ./configure --disable-mac-universal
If this has finished, you need to edit Makefile and change the mention of -Werror to -Wall.
Then:
make
Voila. There you have your "libportaudio.la" in the portaudio/lib directory. You can now type
sudo make install
(you'll be asked to confirm using your password)
to put the library in the system directory.
Finally you can mess around with Portaudio!
Have fun!
Tried your instructions on Mac OSX Mountain Lion (10.8), and it was progressing a lot in compilation but then was failing with:
In file included from ./test/patest_sine_channelmaps.c:53:
./include/pa_mac_core.h:100:1: error: unknown type name 'AudioDeviceID'
AudioDeviceID PaMacCore_GetStreamInputDevice( PaStream* s );
^
./include/pa_mac_core.h:109:1: error: unknown type name 'AudioDeviceID'
AudioDeviceID PaMacCore_GetStreamOutputDevice( PaStream* s );
^
2 errors generated.
make: *** [bin/patest_sine_channelmaps] Error 1
However, I figured out you can simply use Homebrew (apt-like packet manager for OSX) and it will do the dirty job like a charm. Find binaries and headers in the specified install directory :)
$ brew install portaudio
Warning: It appears you have MacPorts or Fink installed.
Software installed with other package managers causes known problems for
Homebrew. If a formula fails to build, uninstall MacPorts/Fink and try again.
==> Downloading http://www.portaudio.com/archives/pa_stable_v19_20111121.tgz
######################################################################## 100.0%
==> Downloading patches
######################################################################## 100.0%
==> Patching
patching file include/pa_mac_core.h
==> ./configure --prefix=/usr/local/Cellar/portaudio/19.20111121 --enable-mac-un
==> make install
/usr/local/Cellar/portaudio/19.20111121: 8 files, 316K, built in 20 seconds
I used the SFML 2 installer, it can be found here. http://www.sfml-dev.org/download.php
Ld /Users/pjquinn/Library/Developer/Xcode/DerivedData/gangnam_style-ayfrlelgnycrzpdbmwbkqgtkkryv/Build/Products/Debug/gangnam_style.app/Contents/MacOS/gangnam_style normal x86_64
cd /Users/pjquinn/Programming/C++/gangnam_style
setenv MACOSX_DEPLOYMENT_TARGET 10.7
/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.8.sdk
-L/Users/pjquinn/Library/Developer/Xcode/DerivedData/gangnam_style-ayfrlelgnycrzpdbmwbkqgtkkryv/Build/Products/Debug
-F/Users/pjquinn/Library/Developer/Xcode/DerivedData/gangnam_style-ayfrlelgnycrzpdbmwbkqgtkkryv/Build/Products/Debug
-filelist /Users/pjquinn/Library/Developer/Xcode/DerivedData/gangnam_style-ayfrlelgnycrzpdbmwbkqgtkkryv/Build/Intermediates/gangnam_style.build/Debug/gangnam_style.build/Objects-normal/x86_64/gangnam_style.LinkFileList
-mmacosx-version-min=10.7 -lsfml-system-d -lsfml-window-d -lsfml-graphics-d -lsfml-audio-d -lsfml-network-d -stdlib=libc++ -fobjc-link-runtime -framework Foundation -o /Users/pjquinn/Library/Developer/Xcode/DerivedData/gangnam_style-ayfrlelgnycrzpdbmwbkqgtkkryv/Build/Products/Debug/gangnam_style.app/Contents/MacOS/gangnam_style
ld: library not found for -lsfml-system-d clang: error: linker command failed with exit code 1 (use -v to see invocation)
When I'm creating a project should I select the Use Frameworks box?
Debug binaries are not shipped with the installer.
You should also have a look at the other issues
I used their template and checked the "Use Frameworks" box, but still had problems. What I ended up doing was adding the SFML frameworks files (which their installer script put in ~/Libraries/Frameworks) in the project myself (simple drag'n'drop). I double checked and made sure the added frameworks were then included in the Build Phases (which they were), and everything worked fine.