Installing Qt 5.0 from source - windows

I have recently used git to get the qt source code and I'm now slightly lost on what to do. I've been following the instructions on this page - http://qt-project.org/wiki/Building_Qt_5_from_Git and I'm on windows 7.
I am at the 'Configuring and Building' stage now from the above link and have just finished the 'mingw32-make' step (about 2/3 down the page, just before the Building Qt Webkit step, which I won't be doing). So I left it running overnight and came back to it seemingly completed, as in there were no errors, failures, that I noticed on the command window output.
So my qt folder (installed at C:\Qt\qt5), looks something like this
http://i.imgur.com/dgcl99w.png
So here's a similar question asked on Stack Overflow that I've found, How to install Qt on Windows after building?.
I've done step 4, which was to add QMAKE_INCDIR += "." to the qmake.conf file inside the qtbase\mkspecs\win32-g++ folder. But now I need a bit of advice as to what to do next.
I already have Qt 5 installed from binary which I did months ago but before I delete that I would like to make sure this building from source plan is going to work right. So I also have Qt Creator and simply put, I would like to be able to open this and create a Qt project after I delete my binary installed version of Qt. How do I do this? I would have thought maybe put a path variable but I'm not sure where to put the path to. Do I need to change any settings inside Qt creator? Is the image above what I should be seeing, or is there some step I have still yet to take to finish build/install.
Thanks

I think you will have to setup your System Environment variables to your new QT bin directory and if your using Qt creator then point to this new QT setup in the project build settings, you'll basically point your Qt version with qmake and then make sure the tool chain contains the complier.

Related

Linker error building Adobe DNG SDK on MacOS 11

I am working on a project that uses Adobe's DNG SDK 1.6 library, and it is supposed to work on Windows and MacOS.
The library has instructions on how to build it for both platforms, but I had to figure out an error that came up on Windows with Visual Studio. I am not very experienced with big C++ projects so it was not trivial but I got it working. Most of my own code will be done in C# .Net Core, calling the native libraries using a wrapper class with P/Invoke.
Now for Mac that's a different story, I have a MacOS 11 VM, installed Xcode 12.5.1 and followed the steps provided, as expected, it does not work. Bare in mind this is my first time touching Xcode and MacOS.
The project I am trying to build is dng_validate, and it depends on two libraries built by these projects: XMPFiles64 and XMPCore64.
The library projects build without any hiccups, each one of them creating a ".a" file in the folder: dng_sdk_1_6/xmp/toolkit/public/libraries/macintosh/intel_64_libcpp/Debug, they are named libXMPFilesStaticDebug.a and libXMPCoreStaticDebug.a respectively.
When I try to build the dng_validate project, I get the following error:
Library not found for -lXMPFilesStaticDebug
Because of the the error starting with an "l" instead of "lib", under both libraries project settings, I changed the "Executable Prefix" setting to "l" instead of "lib". Rebuilt both of them and made sure the file names changed as expected. But the error persists when trying to build the main project.
Under dng_validate's project settings, there is a setting called "Library Search Paths" and it does point to the proper aforementioned folder using a relative path. I even changed it to an absolute path to see if that would make it work.
I am really lost here, does anyone have an idea of what might be causing it?
Well... After asking on other forums and almost hiring a freelancer to fix this for me, I tried another shot in the dark of renaming the library files and it worked.
I changed the extensions of libXMPFilesStaticDebug.a and libXMPCoreStaticDebug.a from ".a" to ".dylib" and it just compiled and blew my mind with it.

How to add a kit to Qt Creator from the command line, or other programmatic manner? [duplicate]

SO!
Let's say I have a number of settings (GCC compiler 9.3.0 built from source, as the distribution I have to use has a very old one, along with environment setup) for a new Kit in QtCreator.
I have managed to setup an environment for compilation and execution of compiled binaries, and made a script to make it work (like qmake -nocache -recursive/make/sudo make install, direct execution of g++, and other stuff).
One thing that script can't do at the moment, is that it cannot create a kit for QtCreator with new compilers and environment being set as required, so after running a script, its user has to go through setting it up himself through GUI, which is bad, because this can cause misconfiguration.
This thing I'm trying to create is going to be used by around ~200 people in my company, so leaving readme.txt with instructions just doesn't go well enough for me - I don't want running around fixing missing "{" and "}" in Environment description in created Kits, and other stuff.
Are there ways to create Kits for QtCreator automatically from command line? Maybe, there's some files to edit?
I've looked into this one a few years back (I wanted to do something similar for registering Buildroot toolchains automatically in QtCreator), and I was unable to find an off the shelf solution. So i think there are 2 ways to implement this:
a) Implementing a command line utility the manipulate the ~/.config/QtProject/qtcreator/{toolchains,profiles}.xml files. Maybe by (re)using the existing C++ implementation within QtCreator, or just re-implement it ie. in Python. Back than I didn't start to work on this as there was no real business need.
b) Switching to qbs, as qbs has support for setting up toolchains from the command line ( see: https://doc.qt.io/qbs/cli-setup-toolchains.html)
If you decide to go with solution a), please let me know and maybe we can partner up to implement it.
Check out the command line sdktool bundled with QtCreator:
The SDK tool can be used to set up Qt versions, tool chains, devices
and kits in Qt Creator.
There still is a lot of knowledge about Qt Creator internals required
to use this tool!
I haven't tried it yet, but I did find the executable under Tools/QtCreator/libexec/qtcreator subdirectory of the Qt Creator installation directory. ./sdktool --help works for me under Linux.

QML module not found error

When using QtCreator, I display a qml file in the editor. The qml file is for a file named main.qml that is a plugin.
I then click on the Design button. It displays the error message: QML module not found.
If I take the Go to error link it goes to a line containing the following import com.name.os.app.all 1.0. This is the location of various component qml files needed by the plugin.
I have added the path c:\users\me\ui\viewer\ to my QML_IMPORT_PATH env variable. If QtCreater appends the com.name... from the qml file import statement to the pathname I added to QML_IMPORT_PATH, it would find the desired directory. It doesn't.
The project uses qmake.
I have tried using qmlplugindump.exe to generate a qmltypes file for my main qml view container file, but qmlplugindump.exe gives me an error saying the component is not ready and file::///c:/Users/name/ui/viewer/modules/app/qml/com/name/os/app/all/typelist.qml:2:1 module MyViewContainer.qml is not installed.
The command I used was qmlplugindump.exe MyViewContainer.qml 1.0 c:\users\myname\ui\viewer\modules\app\qml\com\name\os\app\all\ > ...
This Error Ruined My Life
Real Solution for "QML module not found error":
lets say if you have plugins in directory like this, with qmldir inside it
"myproject/modules/mymodule/blabla.qmldir"
you need to import parent directory like this in ".pro" file :
QML_IMPORT_PATH += $$PWD/modules
not like this (this one wont work):
QML_IMPORT_PATH += $$PWD/modules/mymodule
//---------------------------------------------
side note:
this is going to happen in other part of qml too like qmlplugindump you need to give parent directory not exact folder!
but windeployqt is working with exact folder
for example:
qmlplugindump lib 1.0 C:\Users\Administrator\Documents\projectName\3rdparty > C:\Users\Administrator\Documents\projectName\3rdparty\lib\lib.qmltypes
//---------------------------------------------
and second most important part is QML emulation layer
in Qt Creator go to tools->option->Qt Quick->Qt Quick Designer
select "Use Qml emulation layer that is built with the selected qt"
if its already selected look at textbox under that "Top level build path"
it should refer to Qt version bin directory which should be same as plugins Qt version :
..\5.12.1\msvc2017\bin
for me its :(it should be same version as you used for kits and blabla)
C:\QtN\5.12.1\msvc2017\bin
it should not be like this one :
C:\Users\Administrator\AppData\Roaming\QtProject\qtcreator\qmlpuppet
dont forget to deploy after adding new item in plugins(cmd command) :
windeployqt --qmldir C:\Users\Administrator\Documents\projectName C:\Users\Administrator\Documents\build-projectName-5_12-Debug\debug
and plugin dump :
qmlplugindump lib 1.0 C:\Users\Administrator\Documents\projectName\3rdparty > C:\Users\Administrator\Documents\projectName\3rdparty\lib\lib.qmltypes
after this point if QtCreator gives error for new Objects in Plugins you need to restart QtCreator thats it!
if still there is problems you need to - Clean All - Run Qmake - Rebuild all which solves so many issues.
and in some cases you need to put your qml files into 5.13.1\msvc2017\qml or whatever is for your qt version
Have you tested this plugin fully? I ask this because I have written a number of plugins and have run into this issue multiple times.
Possible issues include the version of Qt you are using, and some form of naming error in the plugin uri / classname.
I have an app that I build for multiple versions of Qt and it seems that the qmlplugindump tool has different levels of effectiveness.
Sorry to be so general, but hopefully it points you in the right direction.
From within QtCreator, do a "project-clean", and then rebuild. The module will be found.
I had the same problem and stumbled onto your question. After some effort, the "clean" and rebuild worked.
There seems to be an "incomplete-dependency-checking" during the build process to "understand" that the main.cpp needed to be rebuilt, which would then expose the qmlRegisterType<MyType>() so that it can be found within the main.qml.
After two days of googling and headache, thanks to #MoreMag, I finally worked it out! I just write down some key points here, hoping to help you guys! 😀
Problem:
Solution:
â‘  go to Tools -> Options -> Qt Quick -> QML Emulation Layer.
â‘¡ check Use QML emulation layer that is built with the selected Qt
â‘¢ click Browse button choose the Qt building environment bin folder. The path is in the form of D:\Qt\5.15.2\msvc2019_64\bin. Here I'm using the msvc2019 64bit building environment.
â‘£ click Apply button and restart the Qt creater. Done!
Qt Creator document says
A QML emulation layer (also called QML Puppet) is used in the Design mode to render and preview images and to collect data. To be able to render custom types correctly from QML modules, the emulation layer must be built with the same Qt version as the QML modules.
By default, a fallback emulation layer is provided by Qt Creator and built with the same Qt version as Qt Creator. Therefore, your QML modules will mostly not work out of the box.
I guess this issue is caused by the fact that the default QML Emulation layer may not be compatible with some QML modules. In my case, it's QtMultimedia module.

Application won't launch from Creator

my Qt application won't launch from Qt Creator, however I can run the .exe directly from the release folder. Why is that ? I am totally lost here. In Qt Creator, I just get a message telling me that my application just crashed, with the code -1073741515.
Qt Creator must be pointing to the wrong dlls. You could reinstall the QtSDK and it should fix finding the runtime dlls in the IDE (Qt Creator).
http://www.daniweb.com/.../ok-so-whats-error-1073741515-again
On this post here they said they fixed it by updating the PATH in Qt. Here is the portion that gets prepended to my PATH variable as seen in the picture below:
C:\QtSDK\mingw\bin;C:\QtSDK\Desktop\Qt\4.7.3\mingw\lib;C:\QtSDK\Desktop\Qt\4.7.3\mingw\bin;
Here is a screenshot showing how to access that:
Another option is you could go into the QtSDK folder, find the bin folder for compiler and platform you are using and put it in the path for your system. Then Qt should be able to run the program just by finding the dlls in the system path.
Possibly the shortest option, but the trickiest would be to go into Qt Creator > Tools > Options > Qt4 and make sure you have something that looks similar to this:
.
Going by this answer it looks as if it's failing to find a shared library.
Check the appropriate path environment variable in the project's run settings and make sure it's got everything it needs.

How to get started with D on Mac OS X 10.6 (Snow Leopard)

I've been interested in "D" for a couple of years now and recently decided to start actually playing with it. I've been able to grasp the basics quite easily, I love the basic feature set of the language and the more I read about it, the more impressed I get.
Now, I'm very interested in writing a custom web application server as a hobby project and I want it to be a simple binary, using dynamically linked libraries for the actual web applications. I believe D to be the perfect language for this venture.
There is only one big problem... over the past couple of days, I have been completely unable to get any kind of IDE setup working. I can compile and run everything just fine on the command line, but everything I try in any of the IDE's available (Code::Blocks, eclipse+descent, Xcode with D plugin, and even the windows D-IDE running in VirtualBox on Windows XP Pro) the only thing that ever happens is:
object.d: Error: module object cannot read file 'object.d'
After two days of trying different things and following tutorials, this is really getting on my nerves. I want to learn to use D efficiently, but I need some comfy tool chain that includes code completion in the editor if I want to keep my sanity, which I obviously do.
[edit:added emphasis to the really important bit]
Is there anyone that can help me set up eclipse or (preferably) netbeans (but no plugin seems to be publicly available) to give me compile and run abilities in the IDE, along with code completion? on my Mac, running Mac OS X 10.6?
I want to use the phobos libraries (and therefor a 2.0 compiler) but I don't really care if its dmd or gdmd (gdcmac).
[addition]
I believe we can assume that my dmd compiler installation is in order because it works from the commandline. I just don't want to use it from the commandline because its tedious. The question is about and IDE, the compiler works, its just IDEs that won't
Well, the persistent bugger in me could not leave the problem alone and I finally got it to work.
The required components to get it all working on Mac OS X 10.6 are:
DMD compiler
Eclipse "Galileo" (version 3.4)
Descent
DSSS
a change to /usr/etc/rebuild/default
a new file i hacked together /usr/etc/rebuild/macosx.conf
global and per-project settings for Eclipse
After following these instructions you'll have Eclipse able to do code completion on your D projects and you'll be able to build/run from within the IDE as well.
The actual steps to get it operational are as follows.
install the digitalmars dmd 2.0 compiler
download the binary distribution from digitalmars.com (direct link to 2.041)
unzip the downloaded file into ~/somefolder (that created a ~/somefolder/dmd2 folder for me which I'll use for the duration of this example.)
in the terminal (/Applications/Utilities/Terminal.app) move the files to their destination
sudo mv ~/somefolder/dmd2/osx/bin/* /usr/bin/ enter your login password when asked
move the just copied dmd.conf to its location: sudo mv /usr/bin/dmd.conf /etc/dmd.conf
sudo mv ~/somefolder/dmd2/osx/lib/* /usr/lib/
sudo mv ~/somefolder/dmd2 /usr/
use your favorite text editor to edit /etc/dmd.conf to contain the following:
[Environment]
DFLAGS=-I/usr/dmd2/src/phobos -I/usr/dmd2/src/druntime/import -L-L/usr/lib
Download and install your favorite Mac OS X version of eclipse out of the umpteen hundreds available at http://www.eclipse.org/downloads/ (I picked a cocoa version for c/c++)
Install Descent (almost as per the normal instructions in the wiki)
run Eclipse (don't bother running as root)
goto Help -> Install New Software from the menu bar. (wtf does that do in the Help menu?!)
copy/paste http://downloads.dsource.org/projects/descent/update-site into the url field.
follow on screen instructions to finish installation.
install dsss from sourceforge (direct link to .dmg)
use the installer package on the disk image like any other.
create a file /usr/etc/rebuild/macosx.conf and paste the following snippet into it. (and save, duh)
profile=phobos
compiler=dmd
inifile=dmd.conf
exeext=
objext=o
version=DigitalMars
noversion=GNU
version=MacOSX
version=linux
noversion=Unix
noversion=Posix
noversion=Windows
noversion=Win32
noversion=Win64
version=X86
noversion=PPC
noversion=X86_64
version=D_InlineAsm
version=D_InlineAsm_X86
noversion=D_InlineAsm_PPC
noversion=D_InlineAsm_X86_64
version=LittleEndian
noversion=BigEndian
[compile]
cmd=dmd -version=MacOSX -c $i
flag=$i
incdir=-I$i
libdir=-L-L$i
optimize=-O
version=-version=$i
[link]
oneatatime=yes
#cmd=dmd -L-lphobos $i -of$o
cmd=dmd $i -of$o
# cmd=dmd -L--start-group -L-lphobos $i -of$o
libdir=-L-L$i
lib=-L-l$i
flag=-L$i
[liblink]
safe=yes
oneatatime=yes
cmd=if [ ! -z "$o" ]; then ar rc $o $i; fi
libdir=
lib=
flag=
[postliblink]
cmd=ranlib $i
[shliblink]
shlibs=no
[dyliblink]
dylibs=no
change the /usr/etc/rebuild/default file to read: profile=dmd-macosx
Set up Eclipse to have code completion
In the global eclipse preferences navigate tp D => Build Path => User Libraries
click New, type "std", press OK select the newly created entry, click Add Directory
navigate to /usr/dmd2/src/phobos/std and add it.
Set up Eclipse project.
You have to do this manually for every D project you'll make
Create a new project with the "D => D Project" wizard (thanks to Descent)
Go into project properties (right click project in the Project Explorer and choose Properties)
In the list to the left select D Build Path and in the panel that appears choose the Include Path tab.
Click the Add Library button and choose std in the second page of the wizard.
Configure the extarnal build tool
Go to External tools configurations... (from the dropdown in the little green play button with the toolbox in front of it in the build/run/debug toolbar thingy)
In the list to the left right click Program and choose New from the context menu.
give your config a decent name like "Build with dsss" and set the following options:
Location: /usr/bin/dsss
Working Directory: full path to directory with your dsss.conf file for the project
(if you don't have a dsss.conf file create one on the commandline: dsss genconfig)
Arguments: build (or rebuild, or clean, or...)
repeat steps 2 and 3 above for as many build/run options as you require.
Congratulations, everything should work now.
If for some reason this does not work for you, let me know and I'll be happy to figure out where it went wrong and help you to get it working. If there's a better or simpler way, I'd love to know about it as well.
object.d: Error: module object cannot read file 'object.d'
clearly indicates that it can't find the libraries properly. So, the first question is how your dmd.conf is set up. You need to make sure that it's pointing to the correct places for src/phobos, src/druntime/import, and osx/lib - wherever you put those. Personally, I put the dmd code in a subfolder of home and don't try and install it in /usr, but the instructions do tell you to install them there as the default, so it should work.
Assuming that your dmd.conf looks okay, the most likely situation is that it's actually using the wrong dmd.conf. Per the instructions on the digital mars site ( http://www.digitalmars.com/d/2.0/dmd-osx.html ):
dmd will look for the initialization file dmd.conf in the following sequence of directories:
1. current working directory
2. directory specified by the HOME environment
3. variable directory dmd resides in
4. /etc/
My guess is that you put dmd.conf in /etc and have been editing that one but left the original dmd.conf in
/where_dmd_is/dmd2/osx/bin/
Certainly, I've had that happen to me a time or two. In any case, the first thing that you need to make sure of is that the dmd.conf that you're editing is the one that dmd is using (so make sure that the places where dmd looks first don't have a dmd.conf), and the second thing that you need to make sure of is that the paths in your dmd.conf correctly point to where the dmd stuff is. If those two things are correct, then dmd should find the libraries correctly.
On a side note, I would point out, however, given your comment about wanting to use shared libraries is that shared libraries don't work correctly with D2 right now (I have no idea whether they work with D1 since I don't use D1 - I suspect that they don't though). There have been discussions about it on the D newsgroup ( http://www.digitalmars.com/NewsGroup.html ), so you can look there. It is something on the radar and is being looked into, but doesn't fully work yet. Also, you can look to the newsgroup for further help on D-related issues. It's probably the best place to ask right now.
If it's a question of an IDE, as far as eclipse goes, I believe that the plugin to look at is descent: http://www.dsource.org/projects/descent
Unfortunately, I haven't tried it myself yet, so I don't know how good it is. According to its wiki page, it's primarily intended for D1 but does support D2 to at least some extent.
If you wanna get started quickly (aka Double-click-install): D for Xcode
Requirements:
Xcode
That's it. Installs the latest dmd compiler, so it works in Terminal too etc.
As i keep seeing this question coming back in my search results every now and then, I figured I'd keep it relevant.
Nowadays; In the Mountain Lion era, a much easier solution exists in the Mono-D project
Just install MonoDevelop (or Xamarin Studio) and follow the five minute installation manual
(You can use Phobos on D 1.0. Anyway…)
Where did you install the Phobos and druntime headers?
<the .zip file>/src/druntime/
<the .zip file>/src/phobos/
Usually I copy them into /usr/include.
(Also, try to edit dmd.conf to use the absolute path:
[Environment]
DFLAGS=-I/usr/include/phobos -I/usr/include/druntime/import -L-L/usr/lib
)

Resources