Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OSX build CMake error #98

Closed
AnastasiaSulyagina opened this issue Dec 5, 2017 · 8 comments
Closed

OSX build CMake error #98

AnastasiaSulyagina opened this issue Dec 5, 2017 · 8 comments

Comments

@AnastasiaSulyagina
Copy link

Have a problem on Mac OS 10.13.1
CMakeOutput.log

$ cmake ..
CMake Deprecation Warning at CMakeLists.txt:21 (CMAKE_POLICY):
The OLD behavior for policy CMP0005 will be removed from a future version
of CMake.

The cmake-policies(7) manual explains that the OLD behaviors of all
policies are deprecated and that a policy should be set to OLD only under
specific short-term circumstances. Projects should be ported to the NEW
behavior and not rely on setting a policy to OLD.

-- The C compiler identification is AppleClang 9.0.0.9000038
-- The CXX compiler identification is AppleClang 9.0.0.9000038
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/usr/bin/gcc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/usr/bin/g++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/usr/bin/g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:48 (MESSAGE):
Only the gcc compiler is supported at this time

Same if I add

$ export CC=/usr/bin/gcc
$ export CXX=/usr/bin/g++

before cmake

Gcc looks like this

$ gcc -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/c++/4.2.1
Apple LLVM version 9.0.0 (clang-900.0.38)
Target: x86_64-apple-darwin17.2.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Could you please tell me what can be done about it?
Thank you!

@linas
Copy link
Member

linas commented Dec 6, 2017

Short answer: comment out lines 47, 48, 49 of cmake and see how much farther you can get.

Clearly, on apple, clang is lying, trying to pretend its gcc, and cmake catches it in the lie. Is clang just as good as gcc? Maybe it is. Don't know, but if you comment out 47-49, you can find out.

@linas
Copy link
Member

linas commented Dec 6, 2017

You'd also have to comment out line 82 and line 125. Or just SET(CMAKE_COMPILER_IS_GNUCXX 1) before-hand

@AnastasiaSulyagina
Copy link
Author

@linas thanks, it worked but failed on "make"
Fixed with

  1. "brew install gcc --without-multilib"
  2. "export CXX=/usr/local/Cellar/gcc/7.2.0/bin/g++-7"

It seemed to install normal gcc

@maparent
Copy link
Contributor

I tried with (latest) clang, to see how far I would get; and cmake refuses to build, because BFD and IBERTY are absent, though they are listed as optional in the README. (on master, cmake 3.14.3)
(The error message is -- Configuring incomplete, errors occurred!, and the only errors in CMakeErrors.log are the attempts to build with libiberty and bfd.)
I also tried with env CXX=/usr/local/bin/g++-8 CC=/usr/local/bin/gcc-8 cmake .., same behaviour.

@linas
Copy link
Member

linas commented Apr 29, 2019

Configuring incomplete, errors occurred!

That has nothing to do with either iberty or bfd. There was some other error. If bfd is abesnt, you would see Binutils-dev missing: No pretty stack-trace printing. and if iberty is missing, you'd see Libiberty-dev missing: No pretty stack-trace printing. and cmake would complete, without errors. Something else is causing cmake to fail.

@maparent
Copy link
Contributor

I do indeed have those messages (sorry, I was trying to be terse.)
Full stdout log (gcc version): https://gist.github.com/maparent/137c2731137999947aad708403f536d4
error log: https://gist.github.com/maparent/23b64e13236c428b55a2bb3fa4f914bc
The last attempts in CMakeOutput.txt are all successes:
Detecting CXX [-std=c++98] compiler features compiled with the following output: ... Determining if the include file pthread.h exists passed with the following output: ... Determining if the pthread_create exist passed with the following output: ...
(I tried compiling and linking the code thereafter, using the commands, and it worked.)

@linas
Copy link
Member

linas commented Apr 30, 2019

@maparent it would be kind-of better if we had this conversation in some other, new github issue. But in the meanwhile:

  • The Configuring incomplete message seems to be printed by cmake. I don't know why. In my version of cmake (version 3.7.2), I don't get that printout, even if I don't have bfd/iberty installed. So this seems to be a weird cmake bug, and I don't understand why...

  • For clang instead of gcc, things "should work"; we're not doing anything fancy in opencog that would require gcc. However, ther might be a need for tomfoolery and hacks in cmake/OpenCogGccOptions.cmake -- the section marked "APPLE" was created a decade ago, and has not been updated since then.

@linas
Copy link
Member

linas commented Apr 30, 2019

To be clear, I get:

The following components will be built:
-----------------------------------------------
   Unit tests  - Unit tests.
   Util        - General utility library.

The following components WILL NOT be built:
-----------------------------------------------
   Doxygen     - Code documentation.
   StackPrint  - Pretty printing of stack traces.

-- Configuring done
-- Generating done
-- Build files have been written to: /home/linas/src/novamente/src/cogutils-git/build

which is the intended, expected output -- no errors, just some components are not built.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants