udoprog / c10t

A minecraft cartography tool
Other
226 stars 50 forks source link

Build instructions for OS-X (Lion) on wiki and in Readme/Install docs don't work. #275

Closed chum closed 11 years ago

chum commented 12 years ago

Using various combinations of the instructions at

https://github.com/udoprog/c10t/wiki/Building-on-Mac-OS-X

And also in the README.md file, I'm unable to build. I've also tried variations like replace the make command with dist/make.sh x86_64-linux, and similar.

I'm on OS-X Lion-latest (10.7.4 at the time of this writing.)

It'd be awesome if someone on Lion could double-check the wiki page and get the instructions all up to date. NOTE: I have latest XCode, latest libpng (1.5.12 as of this writing) and latest boost all built & installed. The problem is in the "build c10t" step.

using the dist/make.sh... command from above leaves make trying to use an invalid version of g++. The last few lines of output are:

res/example.html                         -> build/x86_64-linux/res/example.html
res/libc10t.js                           -> build/x86_64-linux/res/libc10t.js
cd build/x86_64-linux && make 
x86_64-pc-linux-gnu-g++ -Isrc -I/usr/include/freetype2 -Wall -fomit-frame-pointer -O2 -c src/algorithm.cpp -o src/algorithm.o
make: x86_64-pc-linux-gnu-g++: No such file or directory
make: *** [src/algorithm.o] Error 1

I've tried messing with the compiler-name, but that just leads to one error after another. Hence, I'm really just looking for a set of correct build instructions.

Thanks!

Ben0mega commented 12 years ago

if you have g++ (I assume you do b/c you have xcode), you can run "which g++" in Terminal.app and it will give a full path resolution that can be used in place of the compiler in the make file (and post further warnings/errors for me to debug pls).

chum commented 12 years ago

Thanks Ben. As I mentioned in the report, I have tried many-many variations, and they all lead to a long string of additional errors. It doesn't seem to be worthwhile to post "problem #1" then have someone comment "try this", then post "problem #2" then "try that", then #3, then "try the other thing" etc. for 40 problem iterations when the REAL problem is, as I stated, that the build instructions on the wiki don't work.

The solution, I would think, would be for someone who understands the build system and has Lion (OSX 10.7) and recent/latest XCode to verify that all of the necessary steps are on the wiki page referenced.

(It'd be handy, too, I think, if the README file mentioned the wiki page as the authoritative reference. Currently, there's a lot of text about "I haven't tried this" and "I don't know how it works", etc.)

I took a stab at fixing this myself (several months ago, I added an important hint for new builders), but was unable to come up with a working solution. My make & cmake fu are very weak. :\

aowi commented 12 years ago

The build instructions on the wiki page worked perfectly for me (OSX Lion 10.7.4).

$ g++ --version
i686-apple-darwin11-llvm-g++-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)

The dependencies listed are all installed through macports:

boost                          @1.50.0         devel/boost
freetype                       @2.4.10         print/freetype
libpng                         @1.4.12         graphics/libpng
zlib                           @1.2.7          archivers/zlib

And the build process went smoothly (mkdir build; cd build; ccmake ..; make).

Using dist/make.sh x86_64-linux on OSX is very likely to not work at all, and your checkout's buildsystem is probably pretty fubar'd. Make a clean checkout, or reset the one you have before you try again.

If you hit a problem once more, post the first error you get. The one you've posted above is just a symptom of you trying an incorrect solution (dist/make.sh x86_64-linux) so it doesn't really reveal what went wrong in the first place.

chum commented 12 years ago

aowl,

It seems that you're looking at a combination of the build instructions on the wiki page and the README.md file. The build instructions on the wiki page (the one I link in the original report) make no mention of freetype, mkdir build, etc.

So the build instructions on the wiki page do NOT work perfectly.

But that's ok -- I can mentally merge the two, also. (Although I still think the OS-X wiki should be brought up to date! Once I get the build working, I'll do that.)

REMEMBER: I was building just fine a few months ago. So something is new & different since April!

Olie-27:c10t olie$ mkdir build
Olie-27:c10t olie$ cd build/
Olie-27:build olie$ cmake ..
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Checking whether C compiler has -isysroot
-- Checking whether C compiler has -isysroot - yes
-- Checking whether C compiler supports OSX deployment target flag
-- Checking whether C compiler supports OSX deployment target flag - yes
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Checking whether CXX compiler has -isysroot
-- Checking whether CXX compiler has -isysroot - yes
-- Checking whether CXX compiler supports OSX deployment target flag
-- Checking whether CXX compiler supports OSX deployment target flag - yes
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Found ZLIB: /usr/include
-- Found PNG: /usr/local/lib/libpng.dylib
-- Looking for include files CMAKE_HAVE_PTHREAD_H
-- Looking for include files CMAKE_HAVE_PTHREAD_H - found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Boost version: 1.50.0
-- Found the following Boost libraries:
--   thread
--   filesystem
--   system
-- Configuring done
CMake Error in src/image/CMakeLists.txt:
  Cannot find source file "libpng.dylib".  Tried extensions .c .C .c++ .cc
  .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp .hxx .in .txx

-- Build files have been written to: /Volumes/TwoBig/AllYourBits-Olie/Desktop/MineCraft/maps/c10t/2012-08-29/c10t/build
Olie-27:build olie$ 
Olie-27:build olie$ port installed | grep png
  libpng @1.5.12_0 (active)
Olie-27:build olie$ make c10t
make: *** No rule to make target `c10t'.  Stop.
Olie-27:build olie$ ls
CMakeCache.txt  CMakeFiles  libs        src     test
Olie-27:build olie$ pwd
/Volumes/TwoBig/AllYourBits-Olie/Desktop/MineCraft/maps/c10t/2012-08-29/c10t/build
Olie-27:build olie$ 
chum commented 12 years ago

Also, in case it's helpful:

Olie-27:~ olie$ port installed  ### List trimmed of non-c10t items.
The following ports are currently installed:
  bash-completion @1.2_0 (active)
  boost @1.50.0_0+no_single+no_static (active)
  cmake @2.8.2_2 (active)
  freetype @2.4.10_0 (active)
  libpng @1.5.12_0 (active)
  zlib @1.2.7_0 (active)
Olie-27:~ olie$ 
aowi commented 12 years ago

It seems that you're looking at a combination of the build instructions on the wiki page and the README.md file. The build instructions on the wiki page (the one I link in the original report) make no mention of freetype, mkdir build, etc.

I am looking only at the README.md file in the root of the repository. It has a list of requirements (freetype et. al.) and standard build instructions (Building from Source (using cmake)).

(Although I still think the OS-X wiki should be brought up to date! Once I get the build working, I'll do that.)

Certainly :-)

Below are my initial errors:

Yep, that cmake error is fatal, even if it doesn't explicitly say so.

It might be because of libpng 1.5 (soname bump), or it might be an error either in the cmake setup (it might not be looking in the right place) or in the port (the dylib might have been moved somewhere nonstandard).

What does port contents libpng|grep dylib return? For me, with libpng 1.4, I get:

/opt/local/lib/libpng.dylib
/opt/local/lib/libpng14.14.dylib
/opt/local/lib/libpng14.dylib

Which is reasonable (you should have 15 instead of 14, but the location should be the same).

chum commented 12 years ago

Right -- it seems the README.md is closer to the correct build instructions than the wiki. This bug was about "wiki doesn't work." Anyway...

Olie-27:c10t olie$ port contents libpng|grep dylib
  /opt/local/lib/libpng.dylib
  /opt/local/lib/libpng15.15.dylib
  /opt/local/lib/libpng15.dylib
Olie-27:c10t olie$ 

Looks like I have 1.5, but I don't see why that would break things. Does c10t require libpng1.4? If so, what would be the steps to downgrade?

Btw, I'm on 10.7.4 (Lion-latest, as of this writing.)

Please keep in mind that my make and cmake fu are very-very weak. I can follow instructions, but really suck at making sense of the error codes or fixing things. I can barely modify my .bashrc to add my own aliases! :)

Thanks!

aowi commented 12 years ago

If I recall correctly, PNG 1.5 support was added to cmake with the 2.8.4 update. You're running 2.8.2, so I'd recommend you update it to the latest version. It is in macports.

chum commented 12 years ago

Same thing:

Olie-27:build olie$ cmake ..
-- The C compiler identification is GNU 4.2.1
-- The CXX compiler identification is GNU 4.2.1
-- Checking whether C compiler has -isysroot
-- Checking whether C compiler has -isysroot - yes
-- Checking whether C compiler supports OSX deployment target flag
-- Checking whether C compiler supports OSX deployment target flag - yes
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Checking whether CXX compiler has -isysroot
-- Checking whether CXX compiler has -isysroot - yes
-- Checking whether CXX compiler supports OSX deployment target flag
-- Checking whether CXX compiler supports OSX deployment target flag - yes
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Found ZLIB: /usr/lib/libz.dylib (found version "1.2.5") 
-- Found PNG: /usr/local/lib/libpng.dylib (found suitable version "1.5.12", required is "1.2") 
-- Looking for include file pthread.h
-- Looking for include file pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - found
-- Found Threads: TRUE  
-- Boost version: 1.50.0
-- Found the following Boost libraries:
--   thread
--   filesystem
--   system
-- Configuring done
CMake Error at src/image/CMakeLists.txt:1 (add_library):
  Cannot find source file:

    /usr/local/lib/libpng.dylib

  Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp
  .hxx .in .txx

-- Build files have been written to: /Volumes/TwoBig/AllYourBits-Olie/Desktop/MineCraft/maps/c10t/2012-09-13/c10t/build
Olie-27:build olie$ 

So, what I'm =REALLY= looking for is a wiki page (or README file, I'm not picky! ;) that contains complete, full build instructions from start to finish that explain all the things I need (including how to check for the right version of things and how to fix it if I've got the wrong one) so that I can build.

If you'd like, you can IM me at ClanLordChum, if you prefer that over "try this", "nope, that doesn't work" in the bug-report.

Thanks!