Installing a 3rd party module for Qt 5.5 in OSX - c++

I want to install Qt Xlsx 3rd party module to use with QtCreator on a OSX system. I tried the instructions provided by the official page but I am failing to compile the code.
What I tried,
My Qt project is on directory: /Users/Documents/Qt Projects/Test
So as instructed in the guide, I copy pasted the source code from gitHub to this directory.
Then I navigated to this working directory through Terminal and executed the following code;
qmake
make
make install
But when I run this code (at command qmake, the terminal returns the following error;
-bash: qmake: command not found
Since this method failed, I tried the second method listed on the guide. But I do not understand second point of this given method. The guide says;
Put the source code in any directory you like. For example, 3rdparty:
|-- project.pro
|-- ....
|-- 3rdparty\
| |-- qtxlsx\
| |
And also the 3rd point which reads;
Add following line to your qmake project file:
include(3rdparty/qtxlsx/src/xlsx/qtxlsx.pri)
What is the qmake project file? Is it the Test.pro file in my working directory? How do I install this module? Please explain clearly since I do not have much experience with Qt.

So made it work;
According to the QtXlsx documentation
I just have to add the following lines to my .pro file.
include(3rdparty/qtxlsx/src/xlsx/qtxlsx.pri)
XLSX_NO_LIB
So the directory of your project should look something like this;
<project folder>/3rdparty/qtxlsx

Related

cannot use Qt Xlsx

I have Qt 5.15 Beta-2 in /opt. I've also downloaded from here and built the Qt5::Xlsx module [qmake, sudo make, sudo make install]. Now in /opt/Qt/5.15.0/gcc_64/include there's a directory QtXlsx but it contains only one file QtXlsxDepends. No xlsxdocument.h, xlsxcell.h or anything like that, so Qt Creator says file not found if I try to include them as in here.
the output of the build commands
The sought-for headers are in /opt/Qt/5.15.0/gcc_64/mkspecs/features/include/QtXlsx. So I added target_include_directories(target PRIVATE /opt/Qt/5.15.0/gcc_64/mkspecs/features/include/QtXlsx) to my CMakeLists.txt and the problem went away.

Build folder and makefile

The question comes from my puzzlement when compiling a makefile for Deep Learning framework Caffe on Ubuntu, but it relates, I believe, to a more general phenomenon of the nature of compiling a C++ makefile.
After "make all", the resulting files from the compilation were put in a hidden folder: .build_release, not in the respective folders where the cpp files are.
Then when I tried to run the following lines:
./data/mnist/get_mnist.sh
./examples/mnist/create_mnist.sh
I was getting an error that the system does not find the file:
./create_mnist.sh: 16: ./create_mnist.sh: build/examples/mnist/convert_mnist_data.bin: not found
But the file actually existed in the .build_release folder.
What happened and how to fix this problem?
The issue is not with make, you simply need to follow the instructions carefully. The BUILD_DIR is specified by Makefile.config. By default this folder is named build. Once you followed the compilation instructions:
cp Makefile.config.example Makefile.config
# Adjust Makefile.config (for example, if using Anaconda Python)
make all
make test
make runtest
Navigate to build:
cd build
./data/mnist/get_mnist.sh
./examples/mnist/create_mnist.sh

How to build Modernizr with bower and brunch - missing main in bower.json

I've read this github issue stating:
there isn't a main file to be in the main.
I have modernizr 3.0.0 installed automatically as a dependency of Foundation 5.5.2 and am trying to build my project with Brunch.
When running brunch build I get the following error:
Error: Component JSON file "/path/to/brunch-test/bower_components/modernizr/.bower.json" must havemainproperty. See https://github.com/paulmillr/read-components#README
So following the read-components issue, I am trying to override modernizr's main in my root bower.json but not sure how to go about it as there's no simple compiled modernizr.js present.
I know modernizr is meant to be customized, and indeed the modernizr 3 release news state there is a really cool solution of dynamically creating a custom package that can be installed via bower but I'm unable to find information about this?
Ok, I figured it out.
So my directory tree is something along the lines of (simplified):
/
|-- bower.json
|-- bower_components
|-- modernizr
|-- bin
|-- modernizr
I went into bower_components/modernizr and ran npm install to get the dependencies required to run the bin/modernizr builder.
Then I went to their website to pick out the features I required: https://modernizr.com/download?setclasses
Next, I clicked Build and downloaded the Command Line Config which I placed at the root directory of my project as modernizr-config.json.
Then I ran bin/modernizr -c ../../modernizr-config.json which placed a custom built modernizr.js in /bower_components/modernizr/modernizr.js
Finally, in my root bower.json, I added (following the read components issue:
"overrides": {
"modernizr": {
"main": "modernizr.js"
}
}
and brunch build is running beautifully now.

dyld: Library not loaded: myOwnLibrary

Context
I'm developing an app in Qt with Qt Creator in OS X. Right now my file organization is a mess (every file is the same folder) so I've decided to move to another project structure that also allows me to also run unit tests.
What have I tried
Following this blog entry I tried to create the same project (just for testing purposes).
Problem
Everything compiles but when executing it gives an error Library not loaded.
I thought that maybe I was doing something wrong so I cloned the example repo and try it again with a working example. But it gives me the same error:
dyld: Library not loaded: libmyapp.1.dylib
Referenced from: /Users/(my build folder)/app/app
Reason: image not found
The example is supposed to be right. The only changed I made is to remove the test subdir as I haven't installed yet UnitTest++ so my .pro file is like this:
TEMPLATE = subdirs
CONFIG+=ordered
SUBDIRS = \
src \
app
app.depends = src
OTHER_FILES += \
defaults.pri
Am I doing something wrong? Is there any step that I forgot?
Edit 1:
Creating manually a Frameworks folder and adding the libmyapp.1.dylib inside the bundle makes the app work. But I think this step should be done automatically
Edit 2:
I've tried to run macdeployqt as suggested. It seems that the app is trying to get the library from the system path instead of the provided:
macdeployqt app.app
ERROR: no file at "/usr/lib/libmyapp.1.dylib"
I have done the following to get the correct dependencies on a lib in the executable...
This code in the application pro file sets dependencies and also places the files directly into the Contents/Framework folder inside bundle (I chose to make the executable do all the work)
# to get the dependencies
INCLUDEPATH += ../libmyapp
macx {
LIBS += ../libmyapp/libmyapp.1.dylib
PRE_TARGETDEPS += ../libmyapp/libmyapp.1.dylib
MY.path = Contents/Frameworks
MY.files = ../libmyapp/libmyapp.1.dylib
QMAKE_BUNDLE_DATA += MY
}
Alternatively you can make your lib become a framework .. 2 options in this post:
How to create a Bundle Library (mh_bundle) with qmake on Mac OS X?
Would be good to read on the process of deploying an app on OS X... The tool trojanfoe was thinking of, for deploying qt apps, is called macdeployqt
Working with bundles of C++ programs with dependencies on Mac OS X can be a real pain. A workaround until you actually need to ship your app as a bundle is tell Qt not to create a bundle at all. Add the following to your app.pro file:
CONFIG -= app_bundle
Then you may add the dylib to the output directory yourself and it should hopefully work fine.
Another option is to set/add the environment variable LD_LIBRARY_PATH in the Run settings for your project in Qt Creator to point to the path where your compiled dylib is located.
I'm not sure that the above works, but those are my best guesses from earlier experience with similar issues. Also, make sure you are using the newest versions of Qt and Qt Creator.

how to generate glut .so file in Linux

I would like to generate glut .so file in Ubuntu. I've downloaded the files, extracted them and opened the readme. This is the instructions for Linux
MAKEFILE GENERATION TO BUILD GLUT: <-- IMPORTANT!
Use "mkmkfiles.sgi" to put Makefiles using the SGI Makefile conventions
in place. Use "mkmkfiles.imake" to put Makefiles generated from
Imakefiles in place. Run one of these two commands in this directory,
then do a "make".
I don't really understand SGI Makefile. I know Makefile though. Could you please guide me for generating the dll. In the folder, these are the files
adainclude Imakefile mkmkfiles.imake README.fortran README.man
CHANGES include mkmkfiles.sgi README.glut2 README.mesa
FAQ.glut lib mkmkfiles.win README.glut3 README.mui
Glut.cf linux NOTICE README.ibm-shlib README.win
glutdefs Makefile Portability.txt README.inventor README.xinput
glutmake.bat Makefile.sgi progs README.irix6 test
glutwin32.mak Makefile.win README README.irix64bit
IAFA-PACKAGE man README.ada README.linux
I've tried running make but getting errors and there is no CMakeLists. Thank you.
When I run ./mkmkfiles.sgi or mkmkfiles.imake, I get this error
bash: ./mkmkfiles.sgi: /bin/csh: bad interpreter: No such file or directory
Technically you need first to instal tcsh. With that installed, running mkmkfiles.imake will work and generate the required Makefile so you can build on Linux. Here is an old post asking pretty much the same question: http://comments.gmane.org/gmane.linux.lfs.general/17539