Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: New to SFML -- CMake Errors  (Read 7407 times)

0 Members and 1 Guest are viewing this topic.

MikeF

  • Newbie
  • *
  • Posts: 5
    • View Profile
    • Email
New to SFML -- CMake Errors
« on: March 20, 2013, 09:15:07 pm »
Hello,

I've recently decided to give SFML 2.0 a try. I'm following http://www.sfml-dev.org/tutorials/2.0/compile-with-cmake.php in order to compile the source code manually (I want to use C++11 features in my source code, otherwise I wouldn't bother with CMake).

I've got the source code in a folder on my desktop called SFML2 and a separate folder on my desktop called SFML2-Build that will store the results of the build.

After filling out these two directories at the top of the CMake GUI, I went into Configure, selected Unix Makefiles, and then Specify native compilers, as per the 2.0 c++11 build instructions. Then I went on to select clang for C and clang++ for the c++ compiler, subsequently pressing Done on that same window.

However, as soon as I click done, I get a bunch of errors, and the build is deemed unsuccessful. I've followed the tutorials to a T so I'm not seeing what could be going wrong here. The source code is the latest version from GitHub.

Here is the error output log:
Quote
CMake Error: Cannot open file for write: /Users/Mike/Desktop/SFML2-Build/CMakeCache.txt.tmp
CMake Error at /Applications/CMake 2.8-10.app/Contents/share/cmake-2.8/Modules/CMakeDetermineSystem.cmake:160 (file):
  file Internal CMake error when trying to open file:
  /Users/Mike/Desktop/SFML2-Build/CMakeFiles/CMakeOutput.log for writing.
Call Stack (most recent call first):
  CMakeLists.txt:17 (project)


CMake Error: Could not open file for write in copy operation /Users/Mike/Desktop/SFML2-Build/CMakeFiles/2.8.10.2/CMakeSystem.cmake.tmp
CMake Error: : System Error: No such file or directory
CMake Error at /Applications/CMake 2.8-10.app/Contents/share/cmake-2.8/Modules/CMakeDetermineSystem.cmake:172 (configure_file):
  configure_file Problem configuring file
Call Stack (most recent call first):
  CMakeLists.txt:17 (project)


CMake Error at /Applications/CMake 2.8-10.app/Contents/share/cmake-2.8/Modules/CMakeDetermineCompilerId.cmake:99 (file):
  file problem creating directory:
  /Users/Mike/Desktop/SFML2-Build/CMakeFiles/2.8.10.2/CompilerIdC
Call Stack (most recent call first):
  /Applications/CMake 2.8-10.app/Contents/share/cmake-2.8/Modules/CMakeDetermineCompilerId.cmake:39 (CMAKE_DETERMINE_COMPILER_ID_BUILD)
  /Applications/CMake 2.8-10.app/Contents/share/cmake-2.8/Modules/CMakeDetermineCCompiler.cmake:124 (CMAKE_DETERMINE_COMPILER_ID)
  CMakeLists.txt:17 (project)


CMake Error at /Applications/CMake 2.8-10.app/Contents/share/cmake-2.8/Modules/CMakeDetermineCompilerId.cmake:99 (file):
  file problem creating directory:
  /Users/Mike/Desktop/SFML2-Build/CMakeFiles/2.8.10.2/CompilerIdC
Call Stack (most recent call first):
  /Applications/CMake 2.8-10.app/Contents/share/cmake-2.8/Modules/CMakeDetermineCompilerId.cmake:39 (CMAKE_DETERMINE_COMPILER_ID_BUILD)
  /Applications/CMake 2.8-10.app/Contents/share/cmake-2.8/Modules/CMakeDetermineCCompiler.cmake:124 (CMAKE_DETERMINE_COMPILER_ID)
  CMakeLists.txt:17 (project)


CMake Error at /Applications/CMake 2.8-10.app/Contents/share/cmake-2.8/Modules/CMakeDetermineCompilerId.cmake:99 (file):
  file problem creating directory:
  /Users/Mike/Desktop/SFML2-Build/CMakeFiles/2.8.10.2/CompilerIdC
Call Stack (most recent call first):
  /Applications/CMake 2.8-10.app/Contents/share/cmake-2.8/Modules/CMakeDetermineCompilerId.cmake:39 (CMAKE_DETERMINE_COMPILER_ID_BUILD)
  /Applications/CMake 2.8-10.app/Contents/share/cmake-2.8/Modules/CMakeDetermineCCompiler.cmake:124 (CMAKE_DETERMINE_COMPILER_ID)
  CMakeLists.txt:17 (project)


The C compiler identification is unknown
CMake Error: Could not open file for write in copy operation /Users/Mike/Desktop/SFML2-Build/CMakeFiles/2.8.10.2/CMakeCCompiler.cmake.tmp
CMake Error: : System Error: No such file or directory
CMake Error at /Applications/CMake 2.8-10.app/Contents/share/cmake-2.8/Modules/CMakeDetermineCCompiler.cmake:171 (configure_file):
  configure_file Problem configuring file
Call Stack (most recent call first):
  CMakeLists.txt:17 (project)


CMake Error: Could not find cmake module file:/Users/Mike/Desktop/SFML2-Build/CMakeFiles/2.8.10.2/CMakeCCompiler.cmake
CMake Error at /Applications/CMake 2.8-10.app/Contents/share/cmake-2.8/Modules/CMakeDetermineCompilerId.cmake:99 (file):
  file problem creating directory:
  /Users/Mike/Desktop/SFML2-Build/CMakeFiles/2.8.10.2/CompilerIdCXX
Call Stack (most recent call first):
  /Applications/CMake 2.8-10.app/Contents/share/cmake-2.8/Modules/CMakeDetermineCompilerId.cmake:39 (CMAKE_DETERMINE_COMPILER_ID_BUILD)
  /Applications/CMake 2.8-10.app/Contents/share/cmake-2.8/Modules/CMakeDetermineCXXCompiler.cmake:120 (CMAKE_DETERMINE_COMPILER_ID)
  CMakeLists.txt:17 (project)


CMake Error at /Applications/CMake 2.8-10.app/Contents/share/cmake-2.8/Modules/CMakeDetermineCompilerId.cmake:99 (file):
  file problem creating directory:
  /Users/Mike/Desktop/SFML2-Build/CMakeFiles/2.8.10.2/CompilerIdCXX
Call Stack (most recent call first):
  /Applications/CMake 2.8-10.app/Contents/share/cmake-2.8/Modules/CMakeDetermineCompilerId.cmake:39 (CMAKE_DETERMINE_COMPILER_ID_BUILD)
  /Applications/CMake 2.8-10.app/Contents/share/cmake-2.8/Modules/CMakeDetermineCXXCompiler.cmake:120 (CMAKE_DETERMINE_COMPILER_ID)
  CMakeLists.txt:17 (project)


The CXX compiler identification is unknown
CMake Error: Could not open file for write in copy operation /Users/Mike/Desktop/SFML2-Build/CMakeFiles/2.8.10.2/CMakeCXXCompiler.cmake.tmp
CMake Error: : System Error: No such file or directory
CMake Error at /Applications/CMake 2.8-10.app/Contents/share/cmake-2.8/Modules/CMakeDetermineCXXCompiler.cmake:167 (configure_file):
  configure_file Problem configuring file
Call Stack (most recent call first):
  CMakeLists.txt:17 (project)


CMake Error: Could not find cmake module file:/Users/Mike/Desktop/SFML2-Build/CMakeFiles/2.8.10.2/CMakeCXXCompiler.cmake
Check for working C compiler: /usr/bin/cc
CMake Error at /Applications/CMake 2.8-10.app/Contents/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:35 (file):
  file Internal CMake error when trying to open file:
  /Users/Mike/Desktop/SFML2-Build/CMakeFiles/CMakeTmp/testCCompiler.c for
  writing.
Call Stack (most recent call first):
  CMakeLists.txt:17 (project)


CMake Error at /Applications/CMake 2.8-10.app/Contents/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:47 (try_compile):
  Failed to open

    /Users/Mike/Desktop/SFML2-Build/CMakeFiles/CMakeTmp/CMakeLists.txt

  No such file or directory
Call Stack (most recent call first):
  CMakeLists.txt:17 (project)


Check for working C compiler: /usr/bin/cc -- broken
CMake Error at /Applications/CMake 2.8-10.app/Contents/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:58 (file):
  file Internal CMake error when trying to open file:
  /Users/Mike/Desktop/SFML2-Build/CMakeFiles/CMakeError.log for writing.
Call Stack (most recent call first):
  CMakeLists.txt:17 (project)


CMake Error at /Applications/CMake 2.8-10.app/Contents/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:61 (message):
  The C compiler "/usr/bin/cc" is not able to compile a simple test program.

  It fails with the following output:

   

 

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:17 (project)


Configuring incomplete, errors occurred!
CMake Error: Cannot open file for write: /Users/Mike/Desktop/SFML2-Build/CMakeCache.txt.tmp
CMake Error: : System Error: Permission denied
CMake Error: Unable to open cache file for save. /Users/Mike/Desktop/SFML2-Build/CMakeCache.txt
CMake Error: : System Error: Permission denied
CMake Error: : System Error: No such file or directory
CMake Error: Unable to open cache file for save. /Users/Mike/Desktop/SFML2-Build/CMakeCache.txt
CMake Error: : System Error: No such file or directory

Thanks for any help with this, I can't wait to get this up and running!

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10837
    • View Profile
    • development blog
    • Email
Re: New to SFML -- CMake Errors
« Reply #1 on: March 20, 2013, 09:25:35 pm »
Are you using OS X?

If so you can find some binaries with C++11 support here.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

MikeF

  • Newbie
  • *
  • Posts: 5
    • View Profile
    • Email
Re: New to SFML -- CMake Errors
« Reply #2 on: March 20, 2013, 09:29:10 pm »
Yup, I'm using Mountain Lion. I'll try this out right now, thanks for the link, this looks perfect!

MikeF

  • Newbie
  • *
  • Posts: 5
    • View Profile
    • Email
Re: New to SFML -- CMake Errors
« Reply #3 on: March 20, 2013, 09:31:52 pm »
Hmmm, I actually think the problem was that I created the folders inside of the Developer folder, which was read-only, and those folders inheritied that read-only aspect so the tmp file wasn't being written, causing a chain-reaction of errors. CMake seems to be working now :)

MikeF

  • Newbie
  • *
  • Posts: 5
    • View Profile
    • Email
Re: New to SFML -- CMake Errors
« Reply #4 on: March 20, 2013, 10:31:21 pm »
So I was able to get the dylibs generated and the XCode template installed. I made a project with the following settings:



As I said before, I wish to use C++11 in this project and I figured if I want to launch in Debug, I'll need to use Dylibs, so I opted for those in CMake instead of a Framework (Release was checked off in CMake, so I'm assuming I'm correct in choosing Dylibs instead of Dylibs (Debug) from the dropdown menu).

However, when I try to build this example project, I receive linker errors:

Quote
Ld /Users/Mike/Library/Developer/Xcode/DerivedData/Testing-dnxusgjxjifbfngdlxqxipuaipzb/Build/Intermediates/Testing.build/Debug/Testing.build/Objects-normal/x86_64/Testing normal x86_64
    cd /Users/Mike/Documents/Testing
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch x86_64 -L/Users/Mike/Library/Developer/Xcode/DerivedData/Testing-dnxusgjxjifbfngdlxqxipuaipzb/Build/Products/Debug -L/usr/local/lib -F/Users/Mike/Library/Developer/Xcode/DerivedData/Testing-dnxusgjxjifbfngdlxqxipuaipzb/Build/Products/Debug -F/Library/Frameworks -filelist /Users/Mike/Library/Developer/Xcode/DerivedData/Testing-dnxusgjxjifbfngdlxqxipuaipzb/Build/Intermediates/Testing.build/Debug/Testing.build/Objects-normal/x86_64/Testing.LinkFileList -lsfml-system -lsfml-window -lsfml-graphics -lsfml-audio -stdlib=libc++ -fobjc-link-runtime -o /Users/Mike/Library/Developer/Xcode/DerivedData/Testing-dnxusgjxjifbfngdlxqxipuaipzb/Build/Intermediates/Testing.build/Debug/Testing.build/Objects-normal/x86_64/Testing

Undefined symbols for architecture x86_64:
  "sf::Font::loadFromFile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
      _main in main.o
  "sf::Image::loadFromFile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
      _main in main.o
  "sf::Music::openFromFile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
      _main in main.o
  "sf::String::String(char const*, std::__1::locale const&)", referenced from:
      _main in main.o
  "sf::Texture::loadFromFile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, sf::Rect<int> const&)", referenced from:
      _main in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Any ideas what I'm doing wrong here?
« Last Edit: March 20, 2013, 10:35:37 pm by MikeF »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: New to SFML -- CMake Errors
« Reply #5 on: March 20, 2013, 10:51:31 pm »
Did you set CMAKE_OSX_ARCHITECTURES to "i386;x86_64" when you compiled SFML?
Laurent Gomila - SFML developer

MikeF

  • Newbie
  • *
  • Posts: 5
    • View Profile
    • Email
Re: New to SFML -- CMake Errors
« Reply #6 on: March 20, 2013, 10:54:49 pm »
Nope, I must have missed that instruction. I actually ended up following this great tutorial: http://www.mjbshaw.com/2013/02/building-sfml-2-with-c11-on-os-x.html and it now works. My only question is about the frameworks vs. dylibs. In terms of development, does using a framework limit me in terms of debugging abilities? I'm kind of confused about the distinction.

Thanks :)

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: New to SFML -- CMake Errors
« Reply #7 on: March 21, 2013, 08:38:58 pm »
In terms of development, does using a framework limit me in terms of debugging abilities? I'm kind of confused about the distinction.
It doesn't matter much as you don't need to debug SFML code but your code only (theoretically, of course). I would recommend the Framework version simply because everything is self contained but dylibs works fine too.



The «Dylibs (Debug)» option for the template only tells Xcode to use SFML debug dylibs in debug. So you don't really need this option unless you're trying to add new features to SFML and need to debug SFML binaries.
SFML / OS X developer