[CMake] can't build translated makefile on snow leopard 10.6.5 w/ g++ 4.2.1 (complaint: g++: No such file or directory, although g++ is there!!)

Ryan Pavlik rpavlik at iastate.edu
Mon Dec 20 17:54:07 EST 2010


It seems you might be "over-analyzing" the conversion: makefiles are much
lower-level than well-written cmake build systems.  I would suggest you
start with the CMake tutorial [1], then start from scratch on the build
system for this code.  Think at a high level, about what files turn into
what executables and libraries - my experience has been that the most
time-consuming task of creating a cmake-based build system is creating the
modules to find dependencies, not the actual creation of the basic build
itself.  ls *.cpp *.h | sort | pbcopy is a handy command on the mac - you
can then just "paste" and have a list of the c++ source files from a
directory.  (I'll stop you ahead of time: don't use file(GLOB) - it is not
the right solution.)  Also, don't put anything in your cmakelists.txt files
that is system-specific: the purpose of these files is to handle configuring
and building on a number of different machines, with the idea that the
user/developer configures the system-specific settings in the cmake gui.

If you do this and still have issues, we'll need to see more of the build
system files (cmakelists.txt files) to be able to help.

Ryan

[1] http://www.cmake.org/cmake/help/cmake_tutorial.html

On Mon, Dec 20, 2010 at 4:34 PM, ny <nikos.yiotis at gmail.com> wrote:

> greetings!
>
> I am trying to build research code written in (templated) c++, size
> is approximately ~15K lines.
>
> The code was never been tested on a mac, not to mention snow leopard.
> I have the guarantee that it compiles + builds for win + linux.
> Project was a collaborative effort and unfortunately I am stuck without a
> makefile =P and with the ugly *.vcproj file. Note that I did not use an
> automated  ruby script I found for
> the translation of *.vcproj to makefile, since the script only
> handled the basics -> no pre/post-build steps or file-specific flags are
> included;
> instead, I translated from scratch to CMakelists and then converted to
> makefile. not that tricky as it sounds..
>
> So, assuming the problem is w/ the makefile, why do I have a clean
> makefile during the configuration/generation steps?
> Note that I choose to generate Unix makefile, not an xcode project.
>
> I 've successfully translated the *.vcproj file into a makefile,
> fixed a few issues, linked to external libs, but the build w/ make fails
> and
> I get
>
> *i686-apple-darwin10-g++-4.2.1: g++: No such file or directory
> make[2]: *** [CMakeFiles/.../.../...cpp.o] Error 1
> make[1]: *** [CMakeFiles/.../.../all] Error 2
> make: *** [all] Error 2
> *
> which, honestly, I don't remember seeing before -> complaining about
> g++ I mean and not missing file or dir. Note that g++ *is* in place, I can
> successfully compile other programs.
>
> Assuming that /usr/bin was somehow not in the path during the cmake
> invocation,
> I used
> *
> *
> *set(CMAKE_C_COMPILER /usr/bin/gcc)*
> *set(CMAKE_CXX_COMPILER /usr/bin/g++)*
>
> in the beginning of my CMakeList.txt without any luck.
> It complained temporarily for a conflict, i.e. had to reset the cache,
> but no progress so far. I
>
>
> I am stuck a few hours now and I suspect  (or better hope) that the
> problem is sth similar to the typical 32-bit/64-bit problem in mac
> ports. I tried w/ -arch i386 -m32  flags without any luck, so I 'd love to
> hear any thoughts, ideas..
> I guess there are parts of the code need to be re-written especially
> for OS X SL, but I cannot figure out the problem since the failing error is
> not
> descriptive enough.
>
> When I build a xcodeproj (with g++ flag -arch i386), I get:
>
> *lipo: can't figure out the architecture type of: /var/folders/9b/
> 9b2CWG5gHvCi5hawjO4o5E+++TI/-Tmp-//ccXHDX6t.out
> Command /Developer/usr/bin/gcc-4.2 failed with exit code 1
> *
> When I build a xcodeproj (with g++ flag -arch x86_64), I get:
>
> *setenv LANG en_US.US-ASCII
> /Developer/usr/bin/gcc-4.2 -x c++ -arch x86_64 -fmessage-length=0 -
> pipe -Wno-trigraphs -fpascal-strings -fasm-blocks -O0 -mdynamic-no-
> pic -DCMAKE_INTDIR="Debug" -isysroot /Developer/SDKs/MacOSX10.6.sdk -
> mmacosx-version-min=10.6 -gdwarf-2 -Wmost -Wno-four-char-constants -
> Wno-unknown-pragmas //... ...
> i686-apple-darwin10-gcc-4.2.1: g++: No such file or directory
> Command /Developer/usr/bin/gcc-4.2 failed with exit code 1*
>
> all cryptic..
>
> Finally, although developing on a mac, I do not use Cocoa(/xcode)
> that uses otool to find any required shared libraries. So from the
> command line I don't have to care about otool and instead I use the ldd.
>
> thanks for any help!
>
> ps. note that I am building from command line without xcode
> and the -pedantic flag I use is not the reason of the failure
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>



-- 
Ryan Pavlik
HCI Graduate Student
Virtual Reality Applications Center
Iowa State University

rpavlik at iastate.edu
http://academic.cleardefinition.com
Internal VRAC/HCI Site: http://tinyurl.com/rpavlik
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20101220/921230ea/attachment-0001.htm>


More information about the CMake mailing list