Comments (9)
Have you tried running it with -v
?
from ycm-generator.
I've tried the following command in a very simple demo project (with macx-clang
):
config_gen.py -F ycm -v --qt-version 5 .
and get the following output:
Running qmake in '/var/folders/2y/5g7w8vc53mn0xfymbbxg3pxm000lj5/T/tmpuopyft' with Qt 5...
$ qmake /Users/heimbach/tmp/qt5/src/src.pro
Info: creating stash file /private/var/folders/2y/5g7w8vc53mn0xfymbbxg3pxm000lj5/T/tmpuopyft/.qmake.stash
Running make...
$ make -i -j8
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -c -pipe -g -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -mmacosx-version-min=10.7 -Wall -W -fPIC -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I/Users/heimbach/tmp/qt5/src -I. -I/Users/heimbach/tmp/qt5/src -I/usr/local/qt-5.5/lib/QtWidgets.framework/Headers -I/usr/local/qt-5.5/lib/QtGui.framework/Headers -I/usr/local/qt-5.5/lib/QtCore.framework/Headers -I. -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/OpenGL.framework/Headers -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/AGL.framework/Headers -I/usr/local/qt-5.5/mkspecs/macx-clang -F/usr/local/qt-5.5/lib -o main.o /Users/heimbach/tmp/qt5/src/main.cpp
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -headerpad_max_install_names -Wl,-syslibroot,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -mmacosx-version-min=10.7 -Wl,-rpath,/usr/local/qt-5.5/lib -o src.app/Contents/MacOS/src main.o -F/usr/local/qt-5.5/lib -framework QtWidgets -framework QtGui -framework QtCore -framework DiskArbitration -framework IOKit -framework OpenGL -framework AGL
Cleaning up...
Build completed in 2.77 sec
Collected 0 relevant entries for C compilation (0 discarded).
Collected 0 relevant entries for C++ compilation (0 discarded).
()
ERROR: No commands were logged to the build logs (C: /var/folders/2y/5g7w8vc53mn0xfymbbxg3pxm000lj5/T/tmpszxdwD, C++: /var/folders/2y/5g7w8vc53mn0xfymbbxg3pxm000lj5/T/tmp4eQNDK).
Your build system may not be compatible.
So, there are enough arguments that could be collected.
from ycm-generator.
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++
This indicates that instead of invoking YCM-Gen's toolchain, your build system is invoking the system toolchain. I'm not hugely familiar with qmake, but this typically happens because the build file isn't respecting the CXX
variable and has hardcoded the compiler. You should take a look at your .pro
file to see if this is the case.
I've also pushed a change to fix OSX Qmake support - please checkout develop
and confirm that it works.
from ycm-generator.
My .pro file was auto generated with qmake -project
and has only the following contents:
TEMPLATE = app
TARGET = src
INCLUDEPATH += .
QT += core
QT += widgets
# Input
SOURCES += main.cpp
Till now, I was not able to figure out why the wrong toolchain is used.
Your commit looks fine (I will test it as soon as my CXX configuration works). On Mac OSX there is an additional -F
switch for framework search paths that should be collected like -I
. So I think line 333 (on develop)
flags_whitelist = ["-[iID].*", "-W[^,]*", "-std=[a-z0-9+]+", "-(no)?std(lib|inc)", "-m[0-9]+"]
should be altered to
flags_whitelist = ["-[iIDF].*", "-W[^,]*", "-std=[a-z0-9+]+", "-(no)?std(lib|inc)", "-m[0-9]+"]
Is that the only location where new flags must be added?
from ycm-generator.
Qmake behavior on OSX is a bit strange. Whatever I set as CXX variable in the qmake project has no effect on the generated Makefile. I always get the following line in the generated output:
CXX = /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++
Therefore, I wrote a litte helper function that patches the generated Makefile after the qmake run:
def patch_qmake_makefile_osx(makefile_path):
compilers = {
'CC': 'clang',
'CXX': 'clang++'
}
patched_makefile_lines = []
with open(makefile_path, 'r') as f:
for line in f:
line = line.rstrip()
for variable_name, compiler in compilers.items():
if re.match('\s*{}\s*='.format(variable_name), line):
line = re.sub('=.*', '= {}'.format(compiler), line)
break
patched_makefile_lines.append(line)
with open(makefile_path, 'w') as f:
f.write('\n'.join(patched_makefile_lines))
It's a bit hacky but the collection of flags does work now. However now I get another error:
Running qmake in '/var/folders/2y/5g7w8vc53mn0xfymbbxg3pxm000lj5/T/tmpBBZ2fG' with Qt 5...
$ qmake /Users/heimbach/tmp/qt5/src/src.pro
Info: creating stash file /private/var/folders/2y/5g7w8vc53mn0xfymbbxg3pxm000lj5/T/tmpBBZ2fG/.qmake.stash
Running make...
$ make -i -j8
clang++ -c -pipe -g -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -mmacosx-version-min=10.7 -Wall -W -fPIC -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I/Users/heimbach/tmp/qt5/src -I. -I/Users/heimbach/tmp/qt5/src -I/usr/local/qt-5.5/lib/QtWidgets.framework/Headers -I/usr/local/qt-5.5/lib/QtGui.framework/Headers -I/usr/local/qt-5.5/lib/QtCore.framework/Headers -I. -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/OpenGL.framework/Headers -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/AGL.framework/Headers -I/usr/local/qt-5.5/mkspecs/macx-clang -F/usr/local/qt-5.5/lib -o main.o /Users/heimbach/tmp/qt5/src/main.cpp
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -headerpad_max_install_names -Wl,-syslibroot,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -mmacosx-version-min=10.7 -Wl,-rpath,/usr/local/qt-5.5/lib -o src.app/Contents/MacOS/src main.o -F/usr/local/qt-5.5/lib -framework QtWidgets -framework QtGui -framework QtCore -framework DiskArbitration -framework IOKit -framework OpenGL -framework AGL
clang: error: no such file or directory: 'main.o'
make: [src.app/Contents/MacOS/src] Error 1 (ignored)
Cleaning up...
Build completed in 1.14 sec
Collected 0 relevant entries for C compilation (0 discarded).
Collected 1 relevant entries for C++ compilation (0 discarded).
Created YCM config file with 15 C++ flags
Usually, YCM-Generator does not try to do a linking step, does it?
from ycm-generator.
YCM-Generator skips the linking step by specifying its own linker (which is just a symlink to the equivalent of /bin/true
). This is normally done by appending fake-toolchain/Unix
to PATH
, so that it takes precedence over the installed compiler/linker.
Take a look at /usr/lib64/qt5/mkspecs/macx-clang/qmake.conf
(and the included files) - they might give some hints as to which variables to override. QMAKE_CXX
and QMAKE_LINK
seem particularly promising, but I'd like to make sure that there aren't any downstream changes to them that might hardcode the compiler.
The reason it's failing is that you haven't replaced all the instances of clang++
- the line immediately before the error is calling the system compiler.
from ycm-generator.
Setting QMAKE_CXX
and QMAKE_LINK
to clang++
directly has no effect unfortunately. The compiler and linker path is always expanded to an absolute path to the executables of the Xcode installation. I browsed through the mkspecs files but could not find any clue yet where the expansion occurs.
from ycm-generator.
Hmmm, in that case the simplest solution might be to just modify the generated makefile before invoking it.
from ycm-generator.
Is there any update about this issue? I have the same issue in my Qt environment. I am eager to know your solution. Thanks.
Brs/Kevin
from ycm-generator.
Related Issues (20)
- unwanted flag "c++" in the flags HOT 1
- Possible to support alternative compiler for cross compiler such as ARM, POWERPC ? HOT 1
- Stucked on Linux kernel of version 4.9-rc8
- 'CC=gcc-7' inside Makefile does not work , while 'CC=gcc' does. (ERROR: no commands ... ) HOT 1
- meson/ninja generator creates incorrect include paths HOT 1
- How to set external library dir
- ERROR: No commands were logged to the build logs HOT 1
- test for generating configuration file for linux kernel is slow HOT 1
- ERROR: Unknown build system HOT 4
- Compatible with Conan HOT 2
- E464: Ambiguous use of user-defined command: Plug 'rdnetto/YCM-Generator' , { 'branch': 'stable'} HOT 1
- Package not found via config_gen HOT 4
- ld in fake-toolchain must work properly HOT 2
- ESP32 IDF and YCM-Generator not working well together HOT 5
- Does YCM-Generator support transform compile_commands.json to .color_coded
- Does this plugin support python 3?
- The template file for .ycm_extra_conf.py should be changed for clangd changed
- .vimrc imap <C-n> <Down>, when type "return 0;", then "<C-n> cant use anymore HOT 1
- Missing verb in README.md
- Doesn't seem to work with Kbuild (Linux Kernel build system)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ycm-generator.