puzzlepaint / cide

A fast, lightweight C/C++ IDE for Linux and Windows
BSD 3-Clause "New" or "Revised" License
50 stars 12 forks source link

Possible Mac Support #1

Closed Petross404 closed 4 years ago

Petross404 commented 4 years ago

Hi, I found out about this project from a mail at kdevelop-devel mail list and I think it's very nice. I am using Mac OS Catalina and I though to try about compiling cide for this OS but I got this error:

cmake -GNinja -DCMAKE_BUILD_TYPE=Release ..
-- The C compiler identification is AppleClang 11.0.0.11000033
-- The CXX compiler identification is AppleClang 11.0.0.11000033
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc -- 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: /Library/Developer/CommandLineTools/usr/bin/c++
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Could not find LLVM: Could NOT find 'llvm-config' executable
-- Could not find LLVM: Could NOT find 'llvm-config' executable
-- Could not find LLVM: Could NOT find 'llvm-config' executable
-- Could not find LLVM: Could NOT find 'llvm-config' executable
-- Could not find LLVM: Could NOT find 'llvm-config' executable
-- Could not find LLVM: Could NOT find 'llvm-config' executable
-- Could not find LLVM: Could NOT find 'llvm-config' executable
-- Could not find any Clang libraries in 
CMake Error at cmake/FindClang.cmake:156 (message):
  Could NOT find Clang
Call Stack (most recent call first):
  CMakeLists.txt:26 (find_package)

-- Configuring incomplete, errors occurred!
See also "/Users/petros/cide.git/build/CMakeFiles/CMakeOutput.log".

Running : export LLVM_DIR=/usr/local/Cellar/llvm/9.0.1/lib/cmake/llvm/didn't help either. Can you test this?

puzzlepaint commented 4 years ago

I don't own a Mac, so I cannot test on Mac OS. Since the application runs on Windows and Linux, I would hope that it would require only few changes to port it to Mac, but I don't know.

Regarding the issue of finding LLVM/clang, I had a similar problem on Windows where the clang installer did not install any llvm-config executable. The way I worked around it was by passing the required information to CMake manually:

cmake <other options...> \
  -DLLVM_ROOT="C:\Program Files\LLVM" \
  -DLLVM_INCLUDE_DIRS="C:\Program Files\LLVM\include" \
  -DLLVM_LIBRARY_DIRS="C:\Program Files\LLVM\lib" \
  -DLLVM_VERSION="9.0.1"

Perhaps something similar might work on Mac OS too?

Petross404 commented 4 years ago

Perhaps something similar might work on Mac OS too?

I think that there is a hacky workwaround like this. If I find something useful we could nest some code inside an if-else and cmake would act based on the platform.

Petross404 commented 4 years ago

cmake -DCMAKE_PREFIX_PATH="/usr/local/opt/llvm" -GNinja -DCMAKE_BUILD_TYPE=Release .. helped and produced this output:

cmake -DCMAKE_PREFIX_PATH="/usr/local/opt/llvm" -GNinja -DCMAKE_BUILD_TYPE=Release ..
-- The C compiler identification is AppleClang 11.0.0.11000033
-- The CXX compiler identification is AppleClang 11.0.0.11000033
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc -- 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: /Library/Developer/CommandLineTools/usr/bin/c++
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Found LLVM (version: 9.0.1): (using /usr/local/opt/llvm/bin/llvm-config)
--   Include dirs:   /usr/local/Cellar/llvm/9.0.1/include
--   LLVM libraries: /usr/local/Cellar/llvm/9.0.1/lib/libLLVMXRay.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMWindowsManifest.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMTextAPI.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMTableGen.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMSymbolize.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMDebugInfoPDB.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMOrcJIT.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMJITLink.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMObjectYAML.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMMCA.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMLTO.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMPasses.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMObjCARCOpts.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMLineEditor.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMLibDriver.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMInterpreter.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMFuzzMutate.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMMCJIT.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMExecutionEngine.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMRuntimeDyld.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMDlltoolDriver.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMOption.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMDebugInfoGSYM.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMCoverage.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMCoroutines.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMXCoreDisassembler.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMXCoreCodeGen.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMXCoreDesc.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMXCoreInfo.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMX86Disassembler.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMX86AsmParser.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMX86CodeGen.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMX86Desc.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMX86Utils.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMX86Info.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMWebAssemblyDisassembler.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMWebAssemblyCodeGen.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMWebAssemblyDesc.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMWebAssemblyAsmParser.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMWebAssemblyInfo.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMSystemZDisassembler.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMSystemZCodeGen.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMSystemZAsmParser.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMSystemZDesc.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMSystemZInfo.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMSparcDisassembler.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMSparcCodeGen.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMSparcAsmParser.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMSparcDesc.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMSparcInfo.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMRISCVDisassembler.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMRISCVCodeGen.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMRISCVAsmParser.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMRISCVDesc.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMRISCVUtils.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMRISCVInfo.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMPowerPCDisassembler.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMPowerPCCodeGen.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMPowerPCAsmParser.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMPowerPCDesc.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMPowerPCInfo.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMNVPTXCodeGen.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMNVPTXDesc.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMNVPTXInfo.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMMSP430Disassembler.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMMSP430CodeGen.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMMSP430AsmParser.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMMSP430Desc.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMMSP430Info.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMMipsDisassembler.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMMipsCodeGen.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMMipsAsmParser.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMMipsDesc.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMMipsInfo.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMLanaiDisassembler.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMLanaiCodeGen.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMLanaiAsmParser.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMLanaiDesc.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMLanaiInfo.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMHexagonDisassembler.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMHexagonCodeGen.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMHexagonAsmParser.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMHexagonDesc.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMHexagonInfo.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMBPFDisassembler.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMBPFCodeGen.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMBPFAsmParser.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMBPFDesc.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMBPFInfo.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMARMDisassembler.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMARMCodeGen.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMARMAsmParser.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMARMDesc.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMARMUtils.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMARMInfo.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMAMDGPUDisassembler.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMAMDGPUCodeGen.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMMIRParser.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMipo.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMInstrumentation.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMVectorize.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMLinker.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMIRReader.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMAsmParser.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMAMDGPUAsmParser.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMAMDGPUDesc.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMAMDGPUUtils.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMAMDGPUInfo.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMAArch64Disassembler.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMMCDisassembler.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMAArch64CodeGen.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMGlobalISel.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMSelectionDAG.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMAsmPrinter.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMDebugInfoDWARF.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMCodeGen.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMTarget.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMScalarOpts.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMInstCombine.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMAggressiveInstCombine.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMTransformUtils.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMBitWriter.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMAnalysis.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMProfileData.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMObject.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMBitReader.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMBitstreamReader.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMCore.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMRemarks.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMAArch64AsmParser.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMMCParser.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMAArch64Desc.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMMC.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMDebugInfoCodeView.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMDebugInfoMSF.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMBinaryFormat.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMAArch64Utils.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMAArch64Info.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMSupport.a /usr/local/Cellar/llvm/9.0.1/lib/libLLVMDemangle.a
-- Found Clang (LLVM version: 9.0.1)
--   Include dirs:        /usr/local/Cellar/llvm/9.0.1/include
--   Clang libraries:     /usr/local/Cellar/llvm/9.0.1/lib/libclangFrontend.a;/usr/local/Cellar/llvm/9.0.1/lib/libclang.dylib;/usr/local/Cellar/llvm/9.0.1/lib/libclangDriver.a;/usr/local/Cellar/llvm/9.0.1/lib/libclangCodeGen.a;/usr/local/Cellar/llvm/9.0.1/lib/libclangSema.a;/usr/local/Cellar/llvm/9.0.1/lib/libclangAnalysis.a;/usr/local/Cellar/llvm/9.0.1/lib/libclangRewriteFrontend.a;/usr/local/Cellar/llvm/9.0.1/lib/libclangRewrite.a;/usr/local/Cellar/llvm/9.0.1/lib/libclangAST.a;/usr/local/Cellar/llvm/9.0.1/lib/libclangParse.a;/usr/local/Cellar/llvm/9.0.1/lib/libclangLex.a;/usr/local/Cellar/llvm/9.0.1/lib/libclangBasic.a;/usr/local/Cellar/llvm/9.0.1/lib/libclangARCMigrate.a;/usr/local/Cellar/llvm/9.0.1/lib/libclangEdit.a;/usr/local/Cellar/llvm/9.0.1/lib/libclangFrontendTool.a;/usr/local/Cellar/llvm/9.0.1/lib/libclangSerialization.a;/usr/local/Cellar/llvm/9.0.1/lib/libclangTooling.a;/usr/local/Cellar/llvm/9.0.1/lib/libclangStaticAnalyzerCheckers.a;/usr/local/Cellar/llvm/9.0.1/lib/libclangStaticAnalyzerCore.a;/usr/local/Cellar/llvm/9.0.1/lib/libclangStaticAnalyzerFrontend.a
--   Libclang C library:  /usr/local/Cellar/llvm/9.0.1/lib/libclang.dylib
--   Builtin include dir: /usr/local/Cellar/llvm/9.0.1/lib/clang/9.0.1/include
-- Found libgit2: /usr/local/lib/libgit2.dylib  
-- Performing Test FLAG_WEXTRA
-- Performing Test FLAG_WEXTRA - Success
CMake Warning at third_party/googletest/CMakeLists.txt:54 (project):
  VERSION keyword not followed by a value or was followed by a value that
  expanded to nothing.

-- Found PythonInterp: /usr/local/bin/python (found version "2.7.17") 
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/petros/cide.git/build

But running ninja very quickly gave a build error:

ninja
ninja: error: 'third_party/yaml-cpp-0.6.3/test/prefix/lib/libgmock.a', needed by 'third_party/yaml-cpp-0.6.3/test/run-tests', missing and no known rule to make it

Is this from a previous configuration error?

puzzlepaint commented 4 years ago

I think I got an error on Windows as well when trying to build everything. That's why I disabled building the tests (and tools, while at it) for the third-party yaml-cpp component:

  -DYAML_CPP_BUILD_TESTS=FALSE
  -DYAML_CPP_BUILD_TOOLS=FALSE

Of course, this only works around the issue instead of fixing it, but given that this seems to be a problem related to third-party test code only, I think this is acceptable. The issue seems to be reported here in yaml-cpp: https://github.com/jbeder/yaml-cpp/issues/675

Edit: Maybe CIDE should simply turn these settings off by default to avoid this issue.

Petross404 commented 4 years ago

Thank you, your advise helped me to get it building but in the end ninja stoped due to errors described in this build.log about redefinition of 'hash<QString>'.

Let me know if I have to open a new issue and close this one.

puzzlepaint commented 4 years ago

It seems that Qt >= 5.14 defines hash<QString> and hash<QByteArray> itself, leading to a conflict here. I just pushed a change that makes CIDE define those only for Qt < 5.14. Does that make it work? (Regarding whether to make a new issue, both ways are fine with me.)

Petross404 commented 4 years ago

CIDE on Mac is running well. I will post a screenshot later. I have to work through all the bits and configuration but it's nice.

Tell me how to make Mac a supported platform if you are interested. Maybe I could provide a .dmg file for a future release or instructions on how to build them with Travis or similar (I don't know, I will search this info).

puzzlepaint commented 4 years ago

That's good to hear. Let's wait a bit to see whether any bugs show up, then I'd be happy to include Mac as a supported platform for the next release - thanks! If there is something specific to be done (such as setting -DCMAKE_PREFIX_PATH="/usr/local/opt/llvm" for cmake), it could also be added to a "Building on Mac" section in the Readme.

Petross404 commented 4 years ago

Be aware that this llvm installation isn't the official provided by Apple, but through an unofficial package manager named brew. So one has to install brew and llvm with brew.

I don't think the official LLVM/Clang of Apple can work with this, so it's a rather hacky way in my opinion - but it still works.

Here is the screenshot for your README to use. Let me know if you want something else. Also, a last question about this, why my font is so tiny and how can I customise my colour setting?

Screenshot 2020-02-08 at 6 16 08 PM

puzzlepaint commented 4 years ago

Thanks for the screenshot. Apart from the text size, I see two minor issues compared to other platforms:

Regarding the text size and color settings, these are unfortunately still hardcoded at the moment. It appears like perhaps the font size setting might be directly interpreted as the line height in pixels on Mac, while it actually leads to higher lines on other platforms. For the time being, you can increase the font size by increasing the number 11 in https://github.com/puzzlepaint/cide/blob/master/src/cide/settings.cc#L129 and the following line. I should really add settings for these things as soon as possible however.

puzzlepaint commented 4 years ago

As of commit 87425ef, the font size is configurable in the program settings ("General" tab).

Petross404 commented 4 years ago

This is good news but I am afraid I am stuck and I can't test this. Menus on the top bar of the screenshot don't respond at all; It happens both when a project is loaded and when the IDE is freshly started. Anyway, more on this later. I will open a new issue with some ideas and you decide what is best.

EDIT : Scratch that, it works.