acbull / Unbiased_LambdaMart

Code for WWW'19 "Unbiased LambdaMART: An Unbiased Pairwise Learning-to-Rank Algorithm", which is based on LightGBM
MIT License
224 stars 50 forks source link

AppleClang not supported -- Setup on Mac. #12

Open nalin-mathur opened 4 years ago

nalin-mathur commented 4 years ago

I am trying to setup up this repo on Mac Mojave 10.14.4. When I make the build directory and run 'cmake ..' from it, it shows me the following error:

CMake Error at CMakeLists.txt:27 (message): AppleClang wasn't supported. Please see https://github.com/Microsoft/LightGBM/blob/master/docs/Installation-Guide.rst#macos

-- Configuring incomplete, errors occurred!

Went to the above link and installed cmake and libomp through brew. I copied the cmake command that is given in the above link and it still showed me the same error as before.

When I try to install LightGBM through the same process, it works seamlessly.

How do I solve this issue and setup this repo?

acbull commented 4 years ago

Sorry I haven't tried to compile this repo on MAC environment. But since the major part is based on original LightGBM, it seems that you can follow the same instruction by them to finish compilation. Could you please provide the log that you install original LightGBM and our version?

nalin-mathur commented 4 years ago

I did follow the same instructions as given by the original LightGBM repo and it lead to the same error when setting up this repo. However when I tried to setup LightGBM using the same instructions, it worked perfectly.

Thinking that its an issue with the Mac environment, I also tried to setup this repo on a linux aws ec2 instance. This led to a different error.

I am not entirely sure what you meant by 'provide the log that you install original LightGBM and our version'. I am hence sharing the build files for all the three different times (unbiasedLM on ec2 linux server & mac, and LGBM on Mac) I tried to set up these repos.

Please do let me know if there are some specific files that you want me to provide you.

unbiasedlgbm_build_ec2.zip unbiasedlgbm_build_mac.zip lightgbm_build_mac.zip

nalin-mathur commented 4 years ago

Hey! I have figured out the issue that was there and have successfully installed it on the AWS EC2 environment.

The Cmake version was 2.8 whereas the repo required a higher version. I installed a higher version of the Cmake : 3.15.

There was also no OpenMP support and hence I changed the following lines in Unbias_LightGBM/CMakeLists.txt file:

if(USE_OPENMP)
    find_package(OpenMP REQUIRED)
    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
else()
    # Ignore unknown #pragma warning
    if( (CMAKE_CXX_COMPILER_ID MATCHES "[cC][lL][aA][nN][gG]")
      OR (CMAKE_CXX_COMPILER_ID MATCHES "[gG][nN][uU]"))
        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unknown-pragmas")
    endif()
endif(USE_OPENMP)

Deleted the lines above and replaced it with the following:

IF(USE_OpenMP)
 FIND_PACKAGE(OpenMP)
 IF(OPENMP_FOUND)
   SET(CMAKE_C_FLAGS “${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}“)
   SET(CMAKE_CXX_FLAGS “${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}“)
 ENDIF()
else()
   # Ignore unknown #pragma warning
   if( (CMAKE_CXX_COMPILER_ID MATCHES “[cC][lL][aA][nN][gG]“)
     OR (CMAKE_CXX_COMPILER_ID MATCHES “[gG][nN][uU]“))
       set(CMAKE_CXX_FLAGS “${CMAKE_CXX_FLAGS} -Wno-unknown-pragmas”)
   endif()
endif(USE_OPenMP)

Will give an update when I try to set this up on Mac environment.