I have a problem using libclang:
I built libclang locally. It resides somewhere like clang-llvm/…/libclang.3.4.dylib.
Then I developed a foundation tool using that dylib. (exactly: I copied a version to my project folder and linked against this.) The foundation tool works fine. But, of course, at load time it uses the dylib in my local build folder. This is unacceptable, because the user of the tool has to install clang to use my tool.
So I copied libclang.3.4.dylib to a location inside /usr/…/libclang.3.4.dylib and changed the installation path to that location using install_name_path -id /usr/…/libclang.3.4.dylib /usr/…/libclang.3.4.dylib.
After that my tool finds the dylib there but does not work since the parser cannot find stdarg.h any more in the file, that is parsed by my tool.
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:12:10: fatal error: 'stdarg.h' file not found
How can I set the installation path of libclang.3.4.dylib to something public?
Amin, my good friend.
<sarcasm>
From what you wrote it should be OBVIOUS to EVERYONE that you have to create a release build of your tool and NOT a debug build. Xcode should have told you that in the form of CLEAR and EASY to understand error messages.
</sarcasm>
Solution: Use a release build of your tool instead of a debug build.
:)
Related
I try to compile an eclipse-project written in c++ which is building a .so-File. Now i try to build the project without an IDE. I tried it with MinGW but the created .so doesn't work. I think there are used some special packages but how can I get the information's.
Is there a way to Export the build settings and import them into MinGW?
How can i else set the compiler?
This is the ToolChainEditor which i would recreat in MinGW.
You can't import a configuration into mingw, but you can tell mingw where to find a configuration of sorts.
Eclipse can be configured to generate a makefile (At least as recent as Neon). Select your project and use the main menu to navigate Project->Properties->C/C++ Build->Tool Chain Editor. Set the "Current builder" to Gnu Make Builder and build the project.
In the generated folder where you would find the finished executable you will find three more files: makefile, objects.mk and sources.mk and can use the make utility that often comes with mingw. It can also be downloaded separately if you have to.
From the command line, enter the folder and type make. Magic will happen. If you want to know more about the magic, make is a very deep topic well worth learning, even if only as a gateway drug to more modern build systems that descended from it.
Checking CLion help https://www.jetbrains.com/help/clion/2016.2/importing-existing-non-cmake-project.html I see how to import a non-CMake project into CLion.
And I'm also able to clone a project from GitHub https://www.jetbrains.com/help/clion/2016.2/cloning-a-repository-from-github.html
The project https://github.com/quickfix/quickfix uses ./bootstrap and ./configure to setup a makefile.
What I'd like to do is import that makefile into my CLion project and build and run from that. Is this possible?
While it is possible to "import a project" that's not CMake-based into your CLion project, CLion does not itself directly support using Makefiles as an origination point for a project yet. I know that this is something that has been wanted by many people, and as far as I know, the creators of CLion are at some point planning to integrate some support for this.
In the meantime, however, there is no handy way to do this directly. CMake is a build system configurator, in that it generates its own set of Makefiles to build everything, based on the things you write in your CMakeLists.txt file.
Your best bet, should you want to use the quickfix lib in a project of yours, is to learn the CMake process for building an external dependency, and then linking it to your project. A good blog post on such a thing can be found here. If you simply want to work on changes to it in CLion for your own convenience, but keep the original build files, you could just have CLion generate its own little CMakeLists.txt file for the purposes of importing and color-coding everything, and then set your debug config, etc to point to the binaries generated by running make in the command line.
Long story short, there's no easy way to do what you are talking about directly, but depending on your intended purpose, there are a couple of alternate paths to a similar end. Hope this helps!
Support for Makefiles has been added to CLion, however, the feature is (as of writing) still in early development.
This feature allows for a CLion project to be created by selecting File > Open from the main menu and then selecting the top level Makefile for the project.
More details of the feature can be found here: https://www.jetbrains.com/help/clion/makefiles-support.html
So basically I have the following setup:
A small test library called mylib with an according CMake file. The CMake file creates all the necessary information so that another project (which is going to be my binary) can use find_package to add the library. The library also has a install target.
A small binary called mybin again wih according CMake file which is depended on the mylib project. Using find_package I can add mylib either by specifying the location of the according myLibConfig.cmake (and myLibTargets.cmake etc.) files or by executing the install target of mylib and then letting CMake find the library itself.
Using CMake and XCode everything works like a charm. First, I configure and build the library. Second, I configure my binary project, specify the location of the library and then build it without any problems.
Now I want to do the same using CLion. My problem now is that CLion puts all the generated CMake file (which usually are placed in the build folder) in some cryptic location which can't be changed in the IDE. Now, when I want to build the mybin project I have to specify this cryptic location which seems kinda odd to me (especially because you have to find out first where CLion actually places those files).
So my question is: Is there a more convenient way to handle the described configuration? I guess this is more or less the standard use case which makes me wonder if I'm missing out on something. Being able to specify where CLion should put the generated CMake files would solve my problem I guess.
I know that i can install the library (using the install target) and then let CMake find it. The problem here is that CLion (to my understanding) doesn't support install targets and therefore I have to use (in my case) XCode to build and install the library first.
I was misunderstsanding the intention of find_package(as Tsyvarev pointed out). By using the solution proposed in this question I managed to add an install target to CLion which now allows me to conveniently build "mylib" and use it in the "mybin" project without having to configure anything manually.
I'm trying to build a static version of Qt, so I could make a .exe file of my project.
I have found this tutorial, and am using the script made by the tutorial author. When I try to run the script, my PowerShell gives me this>
Building static Qt version 5.3.1
ERROR: MinGW environment not found, no Qt prebuilt version?
Press Enter to continue...:
This is impossible. I know this because I already had made projects with Qt5 and built them with my MinGW compiler.
Some additional info:
MinGW is located:
C:/Qt/Tools/mingw491_32 (/bin/gcc.exe)
When I open the script, theres this line>
#Search all instances of gcc.exe from C:\Qt prebuilt environment.
$GccList = #(Get-ChildItem -Path C:\Qt\*\Tools\mingw*\bin\gcc.exe | ForEach-Object FullName | Sort-Object)
So, to me it looks like the gcc should be found by the script.
Anyone have any ideas as to what is happening here?
Thanks.
Replace
C:\Qt\*\Tools\mingw*\bin\gcc.exe
with
C:\Qt\Tools\mingw*\bin\gcc.exe
Not exactly the answer to your question but probably the solution for your problem.
There is no need to make Qt static for creating an executable of your sources. The static option is more appropriate for embedded system without OS, or with a very thin OS below. I can't imagine, it would make sense on windows.
Build a release version, copy your exe and all required dlls of Qt and mingw to one directory and copy this directory to any windows pc. It should work.
For checking, which dlls are required, use depends-tool
For providing your exe in a more professional way, create an installer. I'd recommend Inno Setup, which is very easy to use.
In case you want to copy the dlls use windeployqt, its very simple than using dependency walker. This will copy all the dlls for you to a given folder...
Copy <MyApp.exe> to a folder say <MyAppPackage>
cd to <MyAppPackage>
C:\Qt\Qt5.7.0\5.7\mingw53_32\bin\windeployqt.exe MyApp.exe
All the dlls will be copied to <MyAppPackage> folder.
It helped me:
The path that reads " C:\Qt*\Tools\mingw*\bin\gcc.exe" needed to be changed to " C:\Qt\Tools\mingw*\bin\gcc.exe" on my (Windows 10) system.
https://wiki.qt.io/Building_a_static_Qt_for_Windows_using_MinGW
I am new to the Mac OS X environment when it comes to compiling linux based libraries. Whenever I used a library i just downloaded the .framework file, added it to my /Library/Frameworks and included it in my XCODE project, and all was fine.
Now I am stuck with libnoise. I want to use it on my project and I have no idea how to generate the .framework file/directory.
Can you help me please?
If you have libnoise, most likely it contains some sort of a Makefile or a configure script.
By running the
./configure
make all
you will get the library file (libnoise.a) for your platform, the OSX10.8.
Framework is essentially a folder with specific layout and a .plist file. To generate such a folder automatically, you may create an expty Xcode project of the type Framework and add the libnoise.a you've just created as a linker's input.
There is a detailed instruction on how to create the Framework from static libraries (.a files): http://www.blackdogfoundry.com/blog/creating-a-library-to-be-shared-between-ios-and-mac-os-x/
You might be missing the header files in you framework, but then can be also added to the Xcode project from libnoise sources.
This SO answer may be of use also: Difference between framework and static library in xcode4, and how to call them
Apple's documentation is also good: https://developer.apple.com/library/mac/#documentation/MacOSX/Conceptual/BPFrameworks/Tasks/CreatingFrameworks.html
I'm not entirely sure if this is what was meant by "with a different fork and cmake"
but I got libnoise to run in my mac using this git repo.
https://github.com/qknight/libnoise