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

Remove CMAKE_CXX_COMPILER and CMAKE_C_COMPILER for OSX #719

Merged
merged 3 commits into from
Jul 22, 2017

Conversation

henry0312
Copy link
Contributor

@henry0312
Copy link
Contributor Author

we need to update Installation Guide like this:

git clone --recursive https://github.com/Microsoft/LightGBM ; cd LightGBM
mkdir build ; cd build
cmake -DCMAKE_CXX_COMPILER=/usr/local/bin/g++- -DCMAKE_C_COMPILER=/usr/local/bin/gcc ..
make -j4 

@guolinke
Copy link
Collaborator

This may broke the installation of python/R package, since it is hard to specific -DCMAKE_CXX_COMPILER=/usr/local/bin/g++- -DCMAKE_C_COMPILER=/usr/local/bin/gcc in their nested cmake command.

@guolinke
Copy link
Collaborator

guolinke commented Jul 22, 2017

BTW, can this cmake -DCMAKE_CXX_COMPILER=/usr/local/bin/g++- DCMAKE_C_COMPILER=/usr/local/bin/gcc
simplify to cmake -DCMAKE_CXX_COMPILER=g++7 -DCMAKE_C_COMPILER=gcc7 ?

@henry0312
Copy link
Contributor Author

Currently, brew install gcc installs gcc-7, so -DCMAKE_CXX_COMPILER=g++-7 - -DCMAKE_C_COMPILER=gcc-7 is also ok until release of gcc-8.

@guolinke
Copy link
Collaborator

guolinke commented Jul 22, 2017

@henry0312
It that okay if just using cmake -DCMAKE_CXX_COMPILER=g++ -DCMAKE_C_COMPILER=gcc ?

@chivee
Copy link
Collaborator

chivee commented Jul 22, 2017

I agreed that we should remove the line that specific the g++ in the cmake for Apple. but that means that we should also alter the travis test script as well. I have branched a branch for testing

@henry0312
Copy link
Contributor Author

-DCMAKE_CXX_COMPILER=g++ and -DCMAKE_C_COMPILER=gcc may be not okay, because gcc and g++ are Clang, not GNU GCC in OSX.

~/.ghq/github.com/henry0312/LightGBM remove_apple_compiler*
❯ type gcc
gcc is /usr/bin/gcc

~/.ghq/github.com/henry0312/LightGBM remove_apple_compiler*
❯ gcc -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 8.1.0 (clang-802.0.42)
Target: x86_64-apple-darwin16.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

~/.ghq/github.com/henry0312/LightGBM remove_apple_compiler*
❯ type g++
g++ is /usr/bin/g++

~/.ghq/github.com/henry0312/LightGBM remove_apple_compiler*
❯ g++ -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 8.1.0 (clang-802.0.42)
Target: x86_64-apple-darwin16.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

@chivee
Copy link
Collaborator

chivee commented Jul 22, 2017

@henry0312, @guolinke ,the problem that we are faced is that the apple linked the gcc and g++ to AppleClang, I have added the test for the mac, but which means that Apple users should manually specify their compiler.

@guolinke
Copy link
Collaborator

guolinke commented Jul 22, 2017

can following works ?

export CXX=g++-7
export CC=gcc-7
cmake  ..

if this can work, we can use it for the python/R build .

@chivee
Copy link
Collaborator

chivee commented Jul 22, 2017

actually /usr/local/bin/g++ didn't exist if you are only install gcc using brew

@henry0312
Copy link
Contributor Author

henry0312 commented Jul 22, 2017

@guolinke This may work fine, I guess.

@chivee you're right. So we specify gcc-7, gcc-6 and so on.

@chivee
Copy link
Collaborator

chivee commented Jul 22, 2017

I have checked that the minimum version that we need is gcc 4.8.3 and clang 3.8

@henry0312
Copy link
Contributor Author

henry0312 commented Jul 22, 2017

I don't know much about Travis.
Which gcc (GNU) are available in osx of Travis?

@chivee
Copy link
Collaborator

chivee commented Jul 22, 2017

We have fully control of which version should be use in Travis.

@henry0312
Copy link
Contributor Author

henry0312 commented Jul 22, 2017

Then, I think exporting CXX and CC before tests in osx is fine for Travis.

@guolinke
Copy link
Collaborator

guolinke commented Jul 22, 2017

you can try to add following at this line:https://github.com/Microsoft/LightGBM/blob/master/.travis/test.sh#L16
updated:

if [[ $TRAVIS_OS_NAME == "osx" ]]; then
  export CXX=g++-7
  export CC=gcc-7
fi

@henry0312
Copy link
Contributor Author

it this osx's tests script?

@guolinke
Copy link
Collaborator

@henry0312 it is the test for all systems.

@chivee
Copy link
Collaborator

chivee commented Jul 22, 2017

@guolinke, we don't need to specific version in the travis, because that the osX version travis used didn't link gcc to AppleClang

@henry0312 henry0312 force-pushed the remove_apple_compiler branch from 6608468 to 3f2b4c4 Compare July 22, 2017 08:58
@henry0312 henry0312 force-pushed the remove_apple_compiler branch from 3f2b4c4 to 070aab3 Compare July 22, 2017 09:01
@henry0312
Copy link
Contributor Author

@chivee Is gcc and g++ GNU GCC in osx of Travis?

@chivee
Copy link
Collaborator

chivee commented Jul 22, 2017

@henry0312 , Refer to a previous blog, I guess no, gcc still link to AppleClang

@henry0312
Copy link
Contributor Author

GCC 4.8 (available as gcc-4.8, gcc is still Apple’s LLVM-gcc) (GitHub issue #2423)

This means gcc is LLVM-gcc....🤔

@chivee
Copy link
Collaborator

chivee commented Jul 22, 2017

Yes, let's stay using 'g++-7'

@henry0312
Copy link
Contributor Author

sorry, I don't understand #719 (comment).

Does "version" in your comment mean os type?

@henry0312
Copy link
Contributor Author

Anyway, all tests in Travis are passed 🎉

@chivee chivee merged commit 6828461 into microsoft:master Jul 22, 2017
@henry0312 henry0312 deleted the remove_apple_compiler branch July 22, 2017 09:26
guolinke pushed a commit that referenced this pull request Oct 9, 2017
* Remove CMAKE_CXX_COMPILER and CMAKE_C_COMPILER for OSX

* update .travis/test.sh

* update again
@lock lock bot locked as resolved and limited conversation to collaborators Mar 12, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants