I need to transfer data between c++ and java. I have decided to use Google's protobuf.
I made installation process and I got:
bin > protoc.exe
lib > libprotobuf.a
libprotobuf.la
libprotobuf-lite.a
libprotobuf-lite.la
libprotoc.a
libprotoc.la
and include folder
I've link library in .pro file
QT += core gui network webkit
TARGET = MWOP
TEMPLATE = app
LIBS += -LC:\msys\1.0\local\lib\ -lprotobuf
INCLUDEPATH += C:\msys\1.0\local\include
SOURCES +=
...
HEADERS +=
...
FORMS +=
...
CONFIG += mobility
MOBILITY += bearer systeminfo
symbian {
TARGET.UID3 = xxxxx
TARGET.CAPABILITY += ReadUserData NetworkServices
TARGET.EPOCSTACKSIZE = 0x14000
TARGET.EPOCHEAPSIZE = 0x020000 0x800000
}
RESOURCES += Resources/Registration.qrc
in simulator everything seems to work fine and project builds but when I want to deploy application on phone I've got compilation error:
:: error: No rule to make target \NokiaQtSDK\Symbian\SDK\epoc32\release\armv5\LIB\protobuf.dso, needed by \NokiaQtSDK\Symbian\SDK\epoc32\release\gcce\urel\MWOP.exe. Stop.
How can I fix that?
The DSO file you need is the ARM compiled protobuf library. I expect that the libs you list (libprotobuf.a etc) are windows/x86 binaries, so no use for running on target. You need to either:
get hold of the protobuf source code and build it yourself for ARM
find pre-compiled ARM binaries for the protobuf library
An alternative is to use the Nokia APIbridge, which can achieve the same thing
Related
QT Version used: 5.12.6
I'm trying to build the example from QTWebEngine (quicknanobrowser) with debug symbols.
I kept getting a binary without debug symbols, even when explicitly setting CONFIG+=debug or CONFIG+=debug nostrip.
After many troubleshooting I noticed the generated Makefile to indeed have -g flag to enable symbols, but it also has the -s flag to strip them. However, I can't seem to find why it's adding this -s flag.
.pro file:
requires(qtConfig(accessibility))
TEMPLATE = app
TARGET = quicknanobrowser
HEADERS = utils.h
SOURCES = main.cpp
CONFIG+= debug
OTHER_FILES += ApplicationRoot.qml \
BrowserDialog.qml \
BrowserWindow.qml \
DownloadView.qml \
FullScreenNotification.qml
RESOURCES += resources.qrc
QT += qml quick webengine
qtHaveModule(widgets) {
QT += widgets # QApplication is required to get native styling with QtQuickControls
}
target.path = $$[QT_INSTALL_EXAMPLES]/webengine/quicknanobrowser
INSTALLS += target
Piece of generated Makefile:
LFLAGS = -Wl,--enable-new-dtags -Wl,-z,origin -Wl,-rpath,\$$ORIGIN/../../../../5.12.6/gcc_64/lib -Wl,-rpath,\$$ORIGIN/../../../../5.12.6/gcc_64/lib -Wl,-rpath-link,/home/amol/code/QTJimber/qtwebengine/lib -Wl,-rpath-link,/home/amol/Qt/5.12.6/gcc_64/lib -s
If I manually remove the -s flag from the Makefile I can get a binary with symbols, but that can't seem to be intended..
Edit
Output of adding message(CONFIG: $$CONFIG) message(QMAKE_LFLAGS: $$QMAKE_LFLAGS) message(QMAKE_LFLAGS_DEBUG: $$QMAKE_LFLAGS_DEBUG) message(QMAKE_LFLAGS_RELEASE: $$QMAKE_LFLAGS_RELEASE) message(QMAKESPEC: $$QMAKESPEC) to .pro file:
Project MESSAGE: CONFIG: lex yacc debug exceptions depend_includepath testcase_targets import_plugins import_qpa_plugin qt_build_extra file_copies qmake_use qt warn_on release link_prl incremental shared release linux unix posix gcc sse2 aesni sse3 ssse3 sse4_1 sse4_2 avx avx2 avx512f avx512bw avx512cd avx512dq avx512er avx512ifma avx512pf avx512vbmi avx512vl compile_examples enable_new_dtags f16c force_debug_info largefile precompile_header rdrnd shani x86SimdAlways prefix_build force_independent utf8_source create_prl link_prl prepare_docs qt_docs_targets no_private_qt_headers_warning QTDIR_build qt_example_installs exceptions_off testcase_exceptions explicitlib warning_clean debug
Project MESSAGE: QMAKE_LFLAGS:
Project MESSAGE: QMAKE_LFLAGS_DEBUG:
Project MESSAGE: QMAKE_LFLAGS_RELEASE: -Wl,-O1
Project MESSAGE: QMAKESPEC: /home/amol/Qt/5.12.6/gcc_64/mkspecs/linux-g++
https://doc.qt.io/qt-5/qmake-variable-reference.html
nostrip - If set, the typical Unix strip functionality is turned off and the debug information will remain in the binary.
I'm currently implementing a GUI interface for a very small GNU Radio application. The application will simply connect to a USRP device, receive some IQ samples and forward them through a TCP socket. Following the gqrx project file example, I was able to run some example gnuradio blocks (the dial tone example from gr-analog). Problems started when I tried to include UHD/USRP blocks into the project. Basically, Qt creator report the following error:
/usr/local/lib/libgnuradio-uhd.so:-1: error: undefined reference to `uhd::usrp::multi_usrp::ALL_MBOARDS
The .pro file configured as shown below:
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = USRPDialog
TEMPLATE = app
SOURCES += main.cpp \
usrpdialog.cpp
HEADERS += \
usrpdialog.h \
ui_sdrdialog.h
FORMS += \
sdrdialog.ui
CONFIG += c++11
CONFIG += link_pkgconfig
PKGCONFIG += gnuradio-analog \
gnuradio-blocks \
gnuradio-digital \
gnuradio-filter \
gnuradio-fft \
gnuradio-runtime\
gnuradio-uhd
LIBS += -lboost_system$$BOOST_SUFFIX -lboost_program_options$$BOOST_SUFFIX -lboost_thread$$BOOST_SUFFIX
LIBS += -luhd -lgnuradio-uhd
And this is the function that calls the uhd::usrp_source object
void USRPDialog::createFlowgraph()
{
tb = gr::make_top_block("usrp");
d_tcpSource = gr::blocks::tcp_server_sink::make(sizeof(gr_complex),"127.0.0.1",d_rxTCPPort,true);
d_usrpSource = gr::uhd::usrp_source::make(uhd::device_addr_t(ipAddressLineEdit->text().toStdString()),
uhd::stream_args_t("fc32"));
//Connecting blocks
tb->connect(d_usrpSource,0,d_tcpSource,0);
tb->start();
}
UHD is installed in my system (GNU Radio flowgraphs in my system can connect to USRP devices without any problem). Could anyone shed some light as to why this problem occurs?
Thanks in advance.
too late answer , but fo future ...
I recommend you that use this page step by step: Build UHD from sources
and after these steps , you can use all methods classes and uhd API to build your project in C/C++.
note:don't forget installing winusb for detect usrp devices.
you can use examples in dir: uhd/host/examples.
you can use simple example for finding (detecting usrp device) by name: uhd_find_devices.exe after building uhd , etc.
Been trying to compile this sample code: https://github.com/boostorg/compute/blob/master/README.md
I installed QT Creator 5.7 using mingw530
I compiled the boost libraries using
bootstrap.bat gcc
b2 install --prefix="C:\Boostbuild" --toolset=gcc
bjam --build-dir=c:/Dev/Boost/Boost_lib toolset=gcc stage
I installed AMD SDK 3.0, 2.9.1, and 2.9
I even downloaded opencl 1.1, 1.2, and 2.1 cl.hpp and tried to include that.
The compile starts, but I get a slew of errors
C:\Dev\Boost\compute-master\include\boost\compute\device.hpp:80: error: undefined reference to `clRetainDevice#4'
C:\Users\User\Documents\Projects\build-console-test-Desktop_Qt_5_7_0_MinGW_32bit-Debug\debug\main.o:-1: In function `ZN5boost7compute6deviceaSERKS1_':
I tried a simple qt console app, using the code supplied by boost compute
Note: this isn't specific to qt, I've also tried compiling this using
g++ -I/path/to/compute/include sort.cpp -lOpenCL
doing an -I to each of the include's in the main.cpp (see below)
Ideally, I'd like to know how to compile the example given on their page, with includes and all (and relevant amd sdk and/or opencl versions) along with the necessary included libraries.
My qt project file libraries
INCLUDEPATH += C:\Dev\Boost\compute-master\include
INCLUDEPATH += C:/Users/User/Downloads/dev/boost_1_61_0
INCLUDEPATH += "C:\Program Files (x86)\AMD APP SDK\2.9-1\include"
My main.cpp
#include <iostream>
#include <vector>
#include <algorithm>
#include <boost/compute.hpp>
//#define CL_USE_DEPRECATED_OPENCL_1_1_APIS
//#undef CL_VERSION_1_2
//#include <C:\Dev\OpenCL\2.1\cl.hpp>
namespace compute = boost::compute;
int main()
{
// get the default compute device
compute::device gpu = compute::system::default_device();
// create a compute context and command queue
compute::context ctx(gpu);
compute::command_queue queue(ctx, gpu);
// generate random numbers on the host
std::vector<float> host_vector(1000000);
std::generate(host_vector.begin(), host_vector.end(), rand);
// create vector on the device
compute::vector<float> device_vector(1000000, ctx);
// copy data to the device
compute::copy(
host_vector.begin(), host_vector.end(), device_vector.begin(), queue
);
// sort data on the device
compute::sort(
device_vector.begin(), device_vector.end(), queue
);
// copy data back to the host
compute::copy(
device_vector.begin(), device_vector.end(), host_vector.begin(), queue
);
return 0;
}
if I uncomment out the include cl.hpp, I get further
C:/Dev/Boost/compute-master/include/boost/compute/allocator/buffer_allocator.hpp:91: undefined reference to `clReleaseMemObject#4'
The "slew of errors" are link errors because the location of the AMP APP SDK libraries (libOpenCL.a in this case) is missing.
E.g. to link to the 32 bit version for MinGw, -lOpenCL becomes:
-L"C:\Program Files (x86)\AMD APP SDK\2.9-1\lib\x86" -lOpenCL
Or you could add the following to your qt .pro file:
# Ensure that the AMDAPPSDKROOT environment variable has been set
OPENCL_ROOT = $$(AMDAPPSDKROOT)
isEmpty(OPENCL_ROOT) {
error("Please set AMDAPPSDKROOT to the location of the AMD APP SDK")
} else {
message(Using Boost from: $$OPENCL_ROOT)
}
INCLUDEPATH += $$OPENCL_ROOT/include
LIBS += -L$${OPENCL_ROOT}/lib/x86
LIBS += -lOpenCL
Note: the AMDAPPSDKROOT environment variable is normally created when you install the AMD APP SDK. In your case it should be set to:
C:\Program Files (x86)\AMD APP SDK\2.9-1\
I'm using Yocto buildsystem to create an image for raspberry pi that contains Qt5, but I'm having problems with configuring qtbase properly.
Due to those problems when I run Qt app I get an error:
This application failed to start because it could not find or load the Qt platform plugin "xcb" in "".
Available platform plugins are: eglfs, minimal, minimalegl, offscreen.
Reinstalling the application may fix this problem.
Aborted (core dumped)
On the other hand if I start my app like so:
myApp -platform eglfs
it works properly. The same if I set environment variable QT_QPA_PLATFORM=eglfs - it works.
How can I set my default platform to eglfs and not to xcb?
I have tried to set it like below (in my distro.conf):
DISTRO_FEATURES_remove = "x11"
DISTRO_FEATURES_append = " gles2"
PACKAGECONFIG_GL_pn-qtbase = "gles2"
PACKAGECONFIG_X11_pn-qtbase = ""
PACKAGECONFIG_pn-qtbase += "gles2"
PACKAGECONFIG_pn-qtbase += "dbus udev evdev widgets tools libs"
Unfortunately it did not help and my application still shows this error if I don't set platform explicitly.
all you have to do is:
in /etc/profile, add
export QT_QPA_PLATFORM=eglfs so that every time you logged in the machine, it will automatically does it for you.
Or if you do not know what your graphic backends is. The following is the corresponding
Backend: FB; XWayland; X11
GRAPHICS: eglfs; wayland-egl; xcb
export QT_QPA_PLATFORM=${GRAPHICS}
I have two Qt4 Gui Application projects and one shared library project, all referenced under a .pro file with the "subdirs" template. So, it's like:
exampleapp.pro
app1.pro
app2.pro
sharedlib.pro
Now, what I want to do is reference sharedlib from app1 and app2 so that every time I run app1.exe, I don't have to manually copy sharedlib.dll from its own folder to app1.exe's folder.
I could set PATH environment variable in the projects window, but this isn't very portable. I've looked at putting the LIBS variable in the app1.pro file, but I'm not sure if that refers to statically linked libraries only - I've tried it with various syntaxes and it doesn't seem to work with shared libs.
You can organize your project as follows:
Project1
bin
lib
app1
app2.pro
app2
app2.pro
sharedlib
sharedlib.pro
in sharedlib.pro can add something like this:
TEMPLATE = lib
TARGET = sharedlibr
QT + = core \
gui
DESTDIR = .. / lib
DESTDIR: guarantees that the result of the compilation will be copied to the location ".. / lib"
as for applications app1 and app2:
TEMPLATE = app
TARGET = app1
QT + = core \
gui
DESTDIR = .. / bin
this only for development, when creating the installer, the libraries and executables are placed in the appropriate dirs, depending of the operating system.
To add to this (a bit late!), one can use QMAKE_POST_LINK to copy files around after a build has been completed. Example:
defineReplace(formatpath) {
path = $$1
win32 {
return(\"$$replace(path, "/", "\\")\")
} else:unix {
return($$replace(path, " ", "\\ "))
} else {
error("Unknown platform in formatpath!")
}
}
win32:COPY_CMD = copy
unix:COPY_CMD = cp -P
macx:COPY_CMD = cp -R
win32:CMD_SEP = $$escape_expand(\n\t)
unix:CMD_SEP = ";"
win32:LIB_EXT = dll
unix:LIB_EXT = so*
macx:LIB_EXT = dylib
# Put here the directory of your library's build dir, relative to the current directory
# A path is given for example...
MYLIB_BUILD_DIR = $$_PRO_FILE_PWD_/../lib/bin
QMAKE_POST_LINK += $$COPY_CMD $$formatpath($$MYLIB_BUILD_DIR/*.$$LIB_EXT) $$formatpath($$OUT_PWD/$$DESTDIR) $$CMD_SEP