I have some Qt chess application. Everything works fine when i build it using VS compiler or gcc but I have problem with web assembly version using emscripten. When i run html with emrun everything is ok but images just does not show up.
My emscripten version is emcc (Emscripten gcc/clang-like replacement) 1.38.30 (commit d33f7a29002a2463a7956cd53a559b97a52f9560).
My qmake version: QMake version 3.1
My Qt version: Using Qt version 5.13.0
I am using official Qt binaries from online linux installer for wasm.
I am using emrun --no_browser .html command to set up server on localhost.
I tried different kinds of paths specification.
I ended up with this code example, works ok but not with web assembly version.
This is code to load an example image.
...
QDir::setSearchPaths("qrc", QStringList(":/"));
return QIcon(QUrl("qrc:///Images/king_white.svg").toString());
this is my .qrc file:
<!DOCTYPE RCC><RCC version="1.0">
<qresource>
<file>Images/king_black.svg</file>
...
</qresource>
</RCC>
in .pro file I also have:
RESOURCES = resources.qrc
It works okay when I am not using emscripten.
Thanks for help.
EDIT:
Build options (from Makefile generated by qmake)
CC = emcc
CXX = em++
DEFINES = -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB
CFLAGS = -pipe -O3 -s ALLOW_MEMORY_GROWTH=1 -Wall -W $(DEFINES)
CXXFLAGS = -pipe -O3 -std=gnu++1y -s ALLOW_MEMORY_GROWTH=1 -Wall -W $(DEFINES)
INCPATH = -I. -I../../Qt513/5.13.0/wasm_32/include -I../../Qt513/5.13.0/wasm_32/include/QtWidgets -I../../Qt513/5.13.0/wasm_32/include/QtGui -I../../Qt513/5.13.0/wasm_32/include/QtCore -I. -I/home/somas/.emscripten_ports/openssl/include -I../../Qt513/5.13.0/wasm_32/mkspecs/wasm-emscripten
QMAKE = /home/somas/Qt513/5.13.0/wasm_32/bin/qmake
DEL_FILE = rm -f
CHK_DIR_EXISTS= test -d
MKDIR = mkdir -p
COPY = cp -f
COPY_FILE = cp -f
COPY_DIR = cp -f -R
INSTALL_FILE = install -m 644 -p
INSTALL_PROGRAM = install -m 755 -p
INSTALL_DIR = cp -f -R
QINSTALL = /home/somas/Qt513/5.13.0/wasm_32/bin/qmake -install qinstall
QINSTALL_PROGRAM = /home/somas/Qt513/5.13.0/wasm_32/bin/qmake -install qinstall -exe
DEL_FILE = rm -f
SYMLINK = ln -f -s
DEL_DIR = rmdir
MOVE = mv -f
TAR = tar -cf
COMPRESS = gzip -9f
DISTNAME = ChessNewGeneration.js1.0.0
DISTDIR = /home/somas/ChessNewGeneration/ChessNewGeneration/.tmp/ChessNewGeneration.js1.0.0
LINK = em++
LFLAGS = -s WASM=1 -s FULL_ES2=1 -s USE_WEBGL2=1 -s NO_EXIT_RUNTIME=0 -s ERROR_ON_UNDEFINED_SYMBOLS=1 --bind -s "BINARYEN_TRAP_MODE='clamp'" -O3 -s ALLOW_MEMORY_GROWTH=1
LIBS = $(SUBLIBS) /home/somas/Qt513/5.13.0/wasm_32/plugins/platforms/libqwasm.a /home/somas/Qt513/5.13.0/wasm_32/lib/libQt5EventDispatcherSupport.a /home/somas/Qt513/5.13.0/wasm_32/lib/libQt5FontDatabaseSupport.a /home/somas/Qt513/5.13.0/wasm_32/lib/libqtfreetype.a /home/somas/Qt513/5.13.0/wasm_32/lib/libQt5EglSupport.a /home/somas/Qt513/5.13.0/wasm_32/plugins/imageformats/libqgif.a /home/somas/Qt513/5.13.0/wasm_32/plugins/imageformats/libqicns.a /home/somas/Qt513/5.13.0/wasm_32/plugins/imageformats/libqico.a /home/somas/Qt513/5.13.0/wasm_32/plugins/imageformats/libqjpeg.a /home/somas/Qt513/5.13.0/wasm_32/plugins/imageformats/libqtga.a /home/somas/Qt513/5.13.0/wasm_32/plugins/imageformats/libqtiff.a /home/somas/Qt513/5.13.0/wasm_32/plugins/imageformats/libqwbmp.a /home/somas/Qt513/5.13.0/wasm_32/plugins/imageformats/libqwebp.a /home/somas/Qt513/5.13.0/wasm_32/lib/libQt5Widgets.a /home/somas/Qt513/5.13.0/wasm_32/lib/libQt5Gui.a /home/somas/Qt513/5.13.0/wasm_32/lib/libqtlibpng.a /home/somas/Qt513/5.13.0/wasm_32/lib/libqtharfbuzz.a /home/somas/Qt513/5.13.0/wasm_32/lib/libQt5Core.a /home/somas/Qt513/5.13.0/wasm_32/lib/libqtpcre2.a
AR = emar cqs
RANLIB =
SED = sed
STRIP =
I presume that by "when I am not using emscripten" means the regular, dynamically-loaded Qt. Image format plugins included in such installations are dynamic libraries and can be loaded on demand by Qt - this is the mechanism used to load the svg format plugin if it is required.
The emscripten Qt builds are currently only static libraries - these must be linked together in advance as they cannot be dynamically loaded when required. In order to make qmake aware which plugins you will need, add
QTPLUGIN += qsvg
to your project file. You will probably want to make it wasm-specific to
avoid interference on other platforms:
wasm {
QTPLUGIN += qsvg
}
Related
I am working with Teledyne Lumenera USB Camera. I installed lucam-sdk_2.4.3.94 for Linux on my Ubuntu 18.04. It includes these files:
The api folder contains this files:
One of the folders is example which contains several examples for working with Teledyne Lumenera USB Camera. Each example in example folder, shows one of the aspects of the camera like setting focus, reading camera info, etc. Each example has a folder that contains some .cpp, .h and one make file.
I want to write a C++ ROS node that uses this SDK.
First, I create a ROS package in my catkin_ws/src then I copy one of the examples in SDK into the src package folder.
When I use catkin_make, it says that it does not recognize lucamapi.h, which is one of the header files in the SDK.
My question is two parts:
1- the code that I copied from example folders contains some .cpp and .h files. Also, that has a make file beside themselves. I do not know how to handle the make file. How can I put parameters of the following MakeFile into CMakeList.txt?
2- I do not know how to change CMakeList.txt in my ROS package in order to have access to SDK headers, lib, etc.
This is make file for one of of the examples in the SDK:
#
CC = g++
LD = $(CC)
ifndef ARCH
ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/ -e s/x86_64/x86-64/)
endif
LU_LDFLAGS = -lm -lpthread -lstdc++
PROG = livePreview
VERSION = 0.1
INCLUDES = $(LUMENERA_SDK)/include
CFLAGS = -DVERSION=\"$(VERSION)\" -I$(INCLUDES) -g
CFLAGS += -DLUMENERA_LINUX_API
OBJS =
ALL_INCLUDES =
all lu: $(PROG)
clean:
rm -f $(PROG) *.o *.core core *.bak *~
livePreview: verify_environment livePreview.o Camera.o
$(LD) livePreview.o Camera.o `pkg-config --libs opencv` -llucamapi $(LU_LDFLAGS) -o $#
verify_environment:
#if test "$(LUMENERA_SDK)" = "" ; then \
echo "LUMENERA_SDK environment variable is not set!"; \
exit 1; \
fi
Camera.o: Camera.cpp $(INCLUDES)/lucamapi.h
$(CC) $(CFLAGS) -c Camera.cpp
livePreview.o: livePreview.cpp $(INCLUDES)/lucamapi.h
$(CC) $(CFLAGS) -c livePreview.cpp
I solved the problem. Working with CMakeList and ROS was confusing.
Go to this repository, and read instalation part, then look at CMakeList.txt:
https://github.com/farhad-dalirani/lumenera_camera_package
I'm trying to replicate the result of this github repo using Google Colab since I don't want to install all the requirements on my local machine and to take advantage of the GPU on Google Colab
However, one of the things I need to do (as indicated in the repo's README) is to first compile a cpp makefile. The instruction of the makefile is included below. Obvious I can't follow this instruction since I don't know Google Colab's directories of ncvv, cudalib and tensorflow library
cd latent_3d_points/external
with your editor modify the first three lines of the makefile to point to
your nvcc, cudalib and tensorflow library.
make
Is there a way for me to compile the files included in the makefile (because those functions are needed to run the model) either using the makefile directly or compile each cpp file individually? I included the content of the makefile below to avoid having you to click around in the repo looking for it
nvcc = /usr/local/cuda-8.0/bin/nvcc
cudalib = /usr/local/cuda-8.0/lib64
tensorflow = /orions4-zfs/projects/optas/Virt_Env/tf_1.3/lib/python2.7/site-packages/tensorflow/include
all: tf_approxmatch_so.so tf_approxmatch_g.cu.o tf_nndistance_so.so tf_nndistance_g.cu.o
tf_approxmatch_so.so: tf_approxmatch_g.cu.o tf_approxmatch.cpp
g++ -std=c++11 tf_approxmatch.cpp tf_approxmatch_g.cu.o -o tf_approxmatch_so.so -shared -fPIC -I $(tensorflow) -lcudart -L $(cudalib) -O2 -D_GLIBCXX_USE_CXX11_ABI=0
tf_approxmatch_g.cu.o: tf_approxmatch_g.cu
$(nvcc) -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++11 -c -o tf_approxmatch_g.cu.o tf_approxmatch_g.cu -I $(tensorflow) -DGOOGLE_CUDA=1 -x cu -Xcompiler -fPIC -O2
tf_nndistance_so.so: tf_nndistance_g.cu.o tf_nndistance.cpp
g++ -std=c++11 tf_nndistance.cpp tf_nndistance_g.cu.o -o tf_nndistance_so.so -shared -fPIC -I $(tensorflow) -lcudart -L $(cudalib) -O2 -D_GLIBCXX_USE_CXX11_ABI=0
tf_nndistance_g.cu.o: tf_nndistance_g.cu
$(nvcc) -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++11 -c -o tf_nndistance_g.cu.o tf_nndistance_g.cu -I $(tensorflow) -DGOOGLE_CUDA=1 -x cu -Xcompiler -fPIC -O2
clean:
rm tf_approxmatch_so.so
rm tf_nndistance_so.so
rm *.cu.o
You can use the bash like on your pc by adding %%bash in the colab's cells.
Example:
Cell one: write cpp file
%%writefile welcome.cpp
#include <iostream>
int main()
{
std::cout << "Welcome To AI with Ashok's Blog\n";
return 0;
}
Cell two: compile and run
%%bash
g++ welcome.cpp -o welcome
./welcome
You can also open the cpp file in colab's build-in text editor in order to enjoy correct highlights. It opens when you open a text file from the "Files" tab on the left and can be save with "ctr+s" shortcut.
You can install the required version of Cuda in google colab. For eg.
For Cuda 9.2 you can try
!apt-get --purge remove cuda nvidia* libnvidia-*
!dpkg -l | grep cuda- | awk '{print $2}' | xargs -n1 dpkg --purge
!apt-get remove cuda-*
!apt autoremove
!apt-get update
!wget https://developer.nvidia.com/compute/cuda/9.2/Prod/local_installers/cuda-repo-ubuntu1604-9-2-local_9.2.88-1_amd64 -O cuda-repo-ubuntu1604-9-2-local_9.2.88-1_amd64.deb
!dpkg -i cuda-repo-ubuntu1604-9-2-local_9.2.88-1_amd64.deb
!apt-key add /var/cuda-repo-9-2-local/7fa2af80.pub
!apt-get update
!apt-get install cuda-9.2
Similarly, you can find a way to install Cuda 8.2.
For gcc
!apt-get install -qq gcc-5 g++-5 -y
!ln -s /usr/bin/gcc-5
!ln -s /usr/bin/g++-5
!sudo apt-get update
!sudo apt-get upgrade
Then you can compile it or make it by running make, if your installation has a custom make file.
!make
I started this year to use Qt Creator (Windows 10, Qt Creator 4.12.1, based on Qt 5.14.2) for writing my C++ code.
Running the program in Qt is no problem (compiling with some minor warnings, runtime is okay).
However, when I compile the program outside of Qt (in the command line) the resulting executable is slightly different: It is a little bit bigger (142 instead of 130kb) and the runtime is much slower (about 8 times slower).
I didn't change anything of the compiler settings of Qt Creator generated when starting a Qt console application.
Do I miss anything? Is Qt Creator internally optimizing the program?
I also noticed that I am not able to run the executable compiled with Qt Creator externally in the command line (the program starts, but it crashes when I read in an external txt-file).
Here is an example of the g++ command produced by Qt, which I also used within the command line:
g++ -c -fno-keep-inline-dllexport -O2 -std=gnu++11 -Wall -W -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_DEPRECATED_WARNINGS -DQT_NO_DEBUG -DQT_CORE_LIB -I..\Test2 -I. -IC:\Qt\5.13.0\mingw73_32\include -IC:\Qt\5.13.0\mingw73_32\include\QtCore -Irelease -IC:\Qt\5.13.0\mingw73_32\mkspecs\win32-g++ -o release\runtimeenvironment.o ..\Test2\runtimeenvironment.cpp
g++ -Wl,-s -Wl,-subsystem,console -mthreads -o release\Test2.exe release/cell.o release/ft_pop.o release/ft_traits.o release/gridenvironment.o release/lcg.o release/main.o release/output.o release/runparameter.o release/runtimeenvironment.o C:\Qt\5.13.0\mingw73_32\lib\libQt5Core.a
When I compile the program in the command line, I tried the qmake/make command and also the raw g++ commands. But even when I run qmake and make with the .pro file generated by Qt, it is not generating the same executable as within Qt Creator.
If it is of interest, this is the project file generated by Qt Creator:
QT -= gui
CONFIG += c++11 console
CONFIG -= app_bundle
# The following define makes your compiler emit warnings if you use
# any Qt feature that has been marked deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
# You can also make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += \
cell.cpp \
[...]
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
HEADERS += \
cell.h \
[...]
And this is the generated Makefile:
#############################################################################
# Makefile for building: Test2
# Generated by qmake (3.1) (Qt 5.13.0)
# Project: Test2.pro
# Template: app
# Command: C:\Qt\5.13.0\mingw73_32\bin\qmake.exe -o Makefile Test2.pro
#############################################################################
MAKEFILE = Makefile
EQ = =
first: release
install: release-install
uninstall: release-uninstall
QMAKE = C:\Qt\5.13.0\mingw73_32\bin\qmake.exe
DEL_FILE = del
CHK_DIR_EXISTS= if not exist
MKDIR = mkdir
COPY = copy /y
COPY_FILE = copy /y
COPY_DIR = xcopy /s /q /y /i
INSTALL_FILE = copy /y
INSTALL_PROGRAM = copy /y
INSTALL_DIR = xcopy /s /q /y /i
QINSTALL = C:\Qt\5.13.0\mingw73_32\bin\qmake.exe -install qinstall
QINSTALL_PROGRAM = C:\Qt\5.13.0\mingw73_32\bin\qmake.exe -install qinstall -exe
DEL_FILE = del
SYMLINK = $(QMAKE) -install ln -f -s
DEL_DIR = rmdir
MOVE = move
SUBTARGETS = \
release \
debug
release: FORCE
$(MAKE) -f $(MAKEFILE).Release
release-make_first: FORCE
$(MAKE) -f $(MAKEFILE).Release
release-all: FORCE
$(MAKE) -f $(MAKEFILE).Release all
release-clean: FORCE
$(MAKE) -f $(MAKEFILE).Release clean
release-distclean: FORCE
$(MAKE) -f $(MAKEFILE).Release distclean
release-install: FORCE
$(MAKE) -f $(MAKEFILE).Release install
release-uninstall: FORCE
$(MAKE) -f $(MAKEFILE).Release uninstall
debug: FORCE
$(MAKE) -f $(MAKEFILE).Debug
debug-make_first: FORCE
$(MAKE) -f $(MAKEFILE).Debug
debug-all: FORCE
$(MAKE) -f $(MAKEFILE).Debug all
debug-clean: FORCE
$(MAKE) -f $(MAKEFILE).Debug clean
debug-distclean: FORCE
$(MAKE) -f $(MAKEFILE).Debug distclean
debug-install: FORCE
$(MAKE) -f $(MAKEFILE).Debug install
debug-uninstall: FORCE
$(MAKE) -f $(MAKEFILE).Debug uninstall
Makefile: Test2.pro C:/Qt/5.13.0/mingw73_32/mkspecs/win32-g++/qmake.conf C:/Qt/5.13.0/mingw73_32/mkspecs/features/spec_pre.prf \
C:/Qt/5.13.0/mingw73_32/mkspecs/qdevice.pri \
[and several more....]
Test2.pro \
C:/Qt/5.13.0/mingw73_32/lib/Qt5Core.prl
$(QMAKE) -o Makefile Test2.pro
C:/Qt/5.13.0/mingw73_32/mkspecs/features/spec_pre.prf:
C:/Qt/5.13.0/mingw73_32/mkspecs/qdevice.pri:
C:/Qt/5.13.0/mingw73_32/mkspecs/features/device_config.prf:
C:/Qt/5.13.0/mingw73_32/mkspecs/common/sanitize.conf:
C:/Qt/5.13.0/mingw73_32/mkspecs/common/gcc-base.conf:
[and several more...]
Test2.pro:
C:/Qt/5.13.0/mingw73_32/lib/Qt5Core.prl:
qmake: FORCE
#$(QMAKE) -o Makefile Test2.pro
qmake_all: FORCE
make_first: release-make_first debug-make_first FORCE
all: release-all debug-all FORCE
clean: release-clean debug-clean FORCE
distclean: release-distclean debug-distclean FORCE
-$(DEL_FILE) Makefile
-$(DEL_FILE) .qmake.stash
release-mocclean:
$(MAKE) -f $(MAKEFILE).Release mocclean
debug-mocclean:
$(MAKE) -f $(MAKEFILE).Debug mocclean
mocclean: release-mocclean debug-mocclean
release-mocables:
$(MAKE) -f $(MAKEFILE).Release mocables
debug-mocables:
$(MAKE) -f $(MAKEFILE).Debug mocables
mocables: release-mocables debug-mocables
check: first
benchmark: first
FORCE:
$(MAKEFILE).Release: Makefile
$(MAKEFILE).Debug: Makefile
It would be great if anyone could help me.
is it possible that you use Visual Studio version of Creator? that would make executable depend on Qt .dll's that use side-by-side runtime.
You can't compile project from scratch by running g++ alone, you have to run qmake, then make. Both outside creator and inside you HAVE to use qmake on the .pro file. Compiling program includes more steps, running moc and uic, compiling and including resource file, etc. It possible that you just have an .exe with external resource file instead of embedded resources.
Qt Creator got own environment in which it compiles, that includes settings, variables and it even may be different compiler, so you have to check settings - they are seen i GUI and stored in .user file.
Qt Creator, depending on version may hide fact that it runs qmake, you you can see that in project settings. Versions I dealt with were using jom as build tool.
I'm trying to use the pdfium libraries in linux(debian 64-bit). I managed (finally) to compile the release _x64 version of pdfium and the test programs seem to work. However, I can't seem to to use the libraries in a separate project.
This is my file:
#include <iostream>
#include "fpdfview.h"
#include "fpdftext.h"
#include "fpdfdoc.h"
#include "fpdfedit.h"
main(){
FPDF_InitLibrary();
std::cout << "Hello World!"<<std::endl;
return 0;
}
And this is my Makefile:
CC = g++
CFLAGS = -Wall -g -Wno-unused-variable -Wno-reorder -I/usr/include/pdfium/core/include -I/usr/include/pdfium/fpdfsdk/include -I/usr/include/pdfium/third_party -I/usr/include/pdfium/v8/include
LIBS_pdfium = -static -L/usr/lib/pdfium
LDFLAGS = $(LIBS_pdfium)
Main : Main.o
${CC} ${CFLAGS} Main.o ${LDFLAGS} -o Main
Main.o : Main.cpp
${CC} ${CFLAGS} -c -std=c++11 Main.cpp
clean:
rm *o Main
When I run the makefile the result is:
g++ -Wall -g -Wno-unused-variable -Wno-reorder -I/usr/include/pdfium/core/include -I/usr/include/pdfium/fpdfsdk/include -I/usr/include/pdfium/third_party -I/usr/include/pdfium/v8/include Main.o -static -L/usr/lib/pdfium -o Main
Main.cpp:11: error: undefined reference to 'FPDF_InitLibrary'
collect2: error: ld returned 1 exit status
I've also tried to use the libraries in /home/username/pdfium/out/Release_x64/obj but got the same error
I know that error: undefined reference to FPDF_InitLibrary means that there is a linking error. Therefore I checked the libraries in /home/username/pdfium/out/Release_x64/obj using objdump and one of them contained the InitLibrary symbol. This doesn't seem to make sense...
I don't know if I am referring to the wrong paths in the include or the libraries or if it is something else that is wrong.
I tried to understand the chromiums pdf plugin project makefile since I thought that might help me understand what I am supposed to use but unfortunately it didn't help.
Any ideas for what I am doing wrong?
To compile with PDFium the link line will depend on if you've compiled V8 and/or XFA into your PDFium binary.
With neither of those things enabled you'll need something similar to:
PDF_LIBS="-lpdfium -lfpdfapi -lfxge -lfpdfdoc -lfxcrt -lfx_agg \
-lfxcodec -lfx_lpng -lfx_libopenjpeg -lfx_lcms2 -lfx_freetype -ljpeg \
-lfx_zlib -lfdrm -lpdfwindow -lbigint -lformfiller -ljavascript \
-lfxedit"
PDF_DIR=<path/to/pdfium>
clang -I $PDF_DIR/public -o foo foo.c -L $PDF_DIR/out/Debug -lstdc++ -framework AppKit $PDF_LIBS
public/ is the only directory you should use when working with PDFium for headers. The -framework AppKit is needed on OSX. The PDFium headers are in plain C but you need -lstdc++ as PDFium uses C++ internally and it needs to be able to link in new/delete.
If you're working with V8 you'll need to add in:
-lv8_libbase -lv8_libplatform -lv8_snapshot -licui18n -licuuc -licudata
and if you're using XFA you'll need the V8 includes plus:
-lfpdfxfa -lxfa -lfx_tiff
EDIT
There was recently a pdf_is_complete_lib option added to the PDFium build. Setting that to true in your gn args will create a single libpdfium that can be linked agains. Note, this has only been tested with V8 and XFA disabled.
Args file..
# Build arguments go here.
# See "gn args <out_dir> --list" for available build arguments.
is_debug = false
pdf_is_standalone = true
pdf_use_skia = false
pdf_use_skia_paths = false
pdf_enable_xfa = false
pdf_enable_v8 = false
is_component_build = false
clang_use_chrome_plugins = false
pdf_is_complete_lib = true
use_custom_libcxx = false
Then gn gen your/dir/catalog.
Then ninja -C your/dir/catalog pdfium_all and you take pdfium.a
In Linker
...
g++ -L-I/usr/include/glib-2.0 -o bin/debug/pdfium_test obj/debug/main.o
...
you must have
-pg -s -Wl,--start-group /home/a/repo/pdfium/out/release/obj/libpdfium.a -Wl,--end-group -lpthread -ldl -lpthread
Linking is ok.
I haven't personally built it - because it was too time taking. But I managed to make it work with my golang application using cgo. I used ubuntu 16.04 as my base image in docker. This depends on https://github.com/bblanchon/pdfium-binaries
Following dockerfile downloads the pdfium binary and links to the app you are developing using pkg-config.
FROM ubuntu:16.04
# Specify pdfium version
ARG PdfiumVersion=4026
# Install pkg-config, etc.
RUN apt-get -yqq update && apt-get clean && apt-get install -yqq apt-utils pkg-config tzdata && dpkg-reconfigure -f noninteractive tzdata
# Create .pc file for pkg-config
RUN echo "\n" \
"prefix=/home\n" \
"Name: pdfium\n" \
"Description: pdfium\n" \
"Version: $PdfiumVersion\n" \
"Requires:\n" \
"Libs: -L/home/lib -lpdfium\n" \
"Cflags: -I/home/include\n" > /home/pdfium.pc
# Download and extract pdfium binary
RUN cd /home && wget --quiet https://github.com/bblanchon/pdfium-binaries/releases/download/chromium%2F$PdfiumVersion/pdfium-linux.tgz \
&& tar -xf pdfium-linux.tgz && rm pdfium-linux.tgz
# Setting up paths for pkg-config
ENV LD_LIBRARY_PATH=/home/lib
ENV PKG_CONFIG_PATH=/home/
## COPY YOUR APP TO /app/src/yourApp
# BUILD YOUR APP
WORKDIR /app/src/yourApp
# RUN your app which is linked to pdfium
ENTRYPOINT [“./yourApp"]
I am having an issue using the QDevelop, Qt IDE (Qt version 4.6.2) in Ubuntu 10.04 LTS Lucid Lynx. The code I am trying to work with was transfered from a newer 64bit laptop to my 32 bit laptop. Both systems are running the same version of Ubuntu and Qt IDE. When I try building the code I get a long list of errors, which I don't really want to post here but I will at the end of my text. Any help would be greatly appreciated. For whatever reason, my blocks of text are getting cut off. I am using the "< pre>insert text here< slashpre> white space retainer trick, what am I doing wrong? Ok my build chunk of text is not being formatted properly using the pre slashpre html thingies.. The formating of this post is getting all messed up! :|
Email I sent my college:
I installed the 32bit version of qwt-5.2.1 and it still isn’t building, I get the same errors.
Attached are my .pro and make files as well as buildoutput.txt showing the results of my build.
See if you see anything wrong with any of the information below:
Checking paths:
In the myPico.pro file there is a line: LIBS += -L/usr/local/qwt-5.2.1/lib -lqwt-qt4 (This is 32bit, I found you can type “file” then space and a file name, it will give you information about the file including if it’s 32bit or 64bit. See note below.)
Inside /usr/local/qwt-5.2.1/lib I have three items that are teal: libqwt.so, libqwt.so.5 and libqwt.so.5.2 and one green item: libqwt.so.5.2.1. They all point to libqwt.so.5.2.1 and it’s 32bit.
Inside the Makefile, the line INCPATH everything seems ok, but I don’t understand the last part of the line: “-I/usr/include/qt4 -Ibuild -Ibuild” When I go to /usr/include/qt4 I don’t see anything that says build. Could this be an issue?
In searching the web for solutions I see a lot of people having the same issue but their solutions are cryptic/Band-Aid short cuts.
Note: I thought of a possible issue. You had me copy the libs from your system and then we found out they were 64 bit. I installed the 32 bit ones but I don’t know if that removed what we copied manually. So I am trying to figure out where we copied those libs to. Ok I found it (/usr/local/qwt-5.2.1/lib) and they’re 32 bit, so installing the 32 bit overwrote the 64bit versions.
.pro file:
TEMPLATE = app
QT = gui core
CONFIG += qt warn_on console debug
DESTDIR = bin
OBJECTS_DIR = build
MOC_DIR = build
UI_DIR = build
FORMS = ui/mainwindow.ui
HEADERS = src/mainwindowimpl.h src/picofunctions.h src/Thread.h
SOURCES = src/mainwindowimpl.cpp src/main.cpp src/picofunctions.cpp src/Thread.cpp
LIBS += -L/usr/local/qwt-5.2.1/lib -lqwt-qt4
Makefile:
#############################################################################
# Makefile for building: bin/myPico
# Generated by qmake (2.01a) (Qt 4.6.2) on: Mon Nov 22 10:56:19 2010
# Project: myPico.pro
# Template: app
# Command: /usr/bin/qmake-qt4 -unix -o Makefile myPico.pro
#############################################################################
####### Compiler, tools and options
CC = gcc
CXX = g++
DEFINES = -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED
CFLAGS = -pipe -g -Wall -W -D_REENTRANT $(DEFINES)
CXXFLAGS = -pipe -g -Wall -W -D_REENTRANT $(DEFINES)
INCPATH = -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -Ibuild -Ibuild
LINK = g++
LFLAGS =
LIBS = $(SUBLIBS) -L/usr/lib -L/usr/local/qwt-5.2.1/lib -lqwt-qt4 -lQtGui -lQtCore -lpthread
AR = ar cqs
RANLIB =
QMAKE = /usr/bin/qmake-qt4
TAR = tar -cf
COMPRESS = gzip -9f
COPY = cp -f
SED = sed
COPY_FILE = $(COPY)
COPY_DIR = $(COPY) -r
STRIP = strip
INSTALL_FILE = install -m 644 -p
INSTALL_DIR = $(COPY_DIR)
INSTALL_PROGRAM = install -m 755 -p
DEL_FILE = rm -f
SYMLINK = ln -f -s
DEL_DIR = rmdir
MOVE = mv -f
CHK_DIR_EXISTS= test -d
MKDIR = mkdir -p
####### Output directory
OBJECTS_DIR = build/
####### Files
SOURCES = src/mainwindowimpl.cpp \
src/main.cpp \
src/picofunctions.cpp \
src/Thread.cpp build/moc_mainwindowimpl.cpp
OBJECTS = build/mainwindowimpl.o \
build/main.o \
build/picofunctions.o \
build/Thread.o \
build/moc_mainwindowimpl.o
DIST = /usr/share/qt4/mkspecs/common/g++.conf \
/usr/share/qt4/mkspecs/common/unix.conf \
/usr/share/qt4/mkspecs/common/linux.conf \
/usr/share/qt4/mkspecs/qconfig.pri \
/usr/share/qt4/mkspecs/features/qt_functions.prf \
/usr/share/qt4/mkspecs/features/qt_config.prf \
/usr/share/qt4/mkspecs/features/exclusive_builds.prf \
/usr/share/qt4/mkspecs/features/default_pre.prf \
/usr/share/qt4/mkspecs/features/debug.prf \
/usr/share/qt4/mkspecs/features/default_post.prf \
/usr/share/qt4/mkspecs/features/warn_on.prf \
/usr/share/qt4/mkspecs/features/qt.prf \
/usr/share/qt4/mkspecs/features/unix/thread.prf \
/usr/share/qt4/mkspecs/features/moc.prf \
/usr/share/qt4/mkspecs/features/resources.prf \
/usr/share/qt4/mkspecs/features/uic.prf \
/usr/share/qt4/mkspecs/features/yacc.prf \
/usr/share/qt4/mkspecs/features/lex.prf \
myPico.pro
QMAKE_TARGET = myPico
DESTDIR = bin/
TARGET = bin/myPico
first: all
####### Implicit rules
.SUFFIXES: .o .c .cpp .cc .cxx .C
.cpp.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$#" "$
Build output:
Build (make)...
g++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -Ibuild -Ibuild -o build/mainwindowimpl.o src/mainwindowimpl.cpp
In file included from /usr/include/qt4/qwt_plot.h:17
,
from build/ui_mainwindow.h:29,
from src/mainwindowimpl.h:5,
from src/mainwindowimpl.cpp:1:
/usr/include/qt4/qwt_array.h:25:23: error: qmemarray.h: No such file or directory
In file included from /usr/include/qt4/qwt_marker.h:20,
from /usr/include/qt4/qwt_plot.h:23,
from build/ui_mainwindow.h:29,
from src/mainwindowimpl.h:5,
from src/mainwindowimpl.cpp:1:
/usr/include/qt4/qwt_text.h:20:29: error: qsimplerichtext.h: No such file or directory
In file included from /usr/include/qt4/qwt_plot.h:24,
from build/ui_mainwindow.h:29,
from src/mainwindowimpl.h:5,
from src/mainwindowimpl.cpp:1:
/usr/include/qt4/qwt_legend.h:16:25: error: qscrollview.h: No such file or directory
In file included from /usr/include/qt4/qwt_legend.h:25,
from /usr/include/qt4/qwt_plot.h:24,
from build/ui_mainwindow.h:29,
from src/mainwindowimpl.h:5,
from src/mainwindowimpl.cpp:1:
/usr/include/qt4/qwt_plot_dict.h:15:22: error: qintdict.h: No such file or directory
In file included from /usr/include/qt4/qwt_plot.h:25,
from build/ui_mainwindow.h:29,
from src/mainwindowimpl.h:5,
from src/mainwindowimpl.cpp:1:
/usr/include/qt4/qwt_plot_printfilter.h:16:24: error: qvaluelist.h: No such file or directory
In file included from /usr/include/qt4/qwt_dimap.h:14,
from /usr/include/qt4/qwt_grid.h:15,
from /usr/include/qt4/qwt_plot.h:18,
from build/ui_mainwindow.h:29,
from src/mainwindowimpl.h:5,
from src/mainwindowimpl.cpp:1:
/usr/include/qt4/qwt_math.h: In function ‘void qwtShiftArray(T*, int, int)’:
/usr/include/qt4/qwt_math.h:162: error: there are no arguments to ‘QABS’ that depend on a template parameter, so a declaration of ‘QABS’ must be available
/usr/include/qt4/qwt_math.h:162: note: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated)
In file included from /usr/include/qt4/qwt_grid.h:16,
from /usr/include/qt4/qwt_plot.h:18,
from build/ui_mainwindow.h:29,
from src/mainwindowimpl.h:5,
from src/mainwindowimpl.cpp:1:
/usr/include/qt4/qwt_scldiv.h: At global scope:
/usr/include/qt4/qwt_scldiv.h:128: error: ISO C++ forbids declaration of ‘QMemArray’ with no type
/usr/include/qt4/qwt_scldiv.h:128: error: expected ‘;’ before ‘’
/usr/include/qt4/qwt_plot_dict.h:22: error: declaration of ‘class QwtSeqDict’
/usr/include/qt4/qwt_plot_dict.h: In constructor ‘QwtCurveDict::QwtCurveDict()’:
/usr/include/qt4/qwt_plot_dict.h:66: error: ‘setAutoDelete’ was not declared in this scope
/usr/include/qt4/qwt_plot_dict.h: At global scope:
/usr/include/qt4/qwt_plot_dict.h:70: error: invalid use of incomplete type ‘class QwtSeqDict’
/usr/include/qt4/qwt_plot_dict.h:22: error: declaration of ‘class QwtSeqDict’
/usr/include/qt4/qwt_plot_dict.h: In constructor ‘QwtMarkerDict::QwtMarkerDict()’:
/usr/include/qt4/qwt_plot_dict.h:72: error: ‘setAutoDelete’ was not declared in this scope
/usr/include/qt4/qwt_plot_dict.h: At global scope:
/usr/include/qt4/qwt_plot_dict.h:75: error: expected initializer before ‘’
/usr/include/qt4/qwt_plot_dict.h:22: error: declaration of ‘class QwtSeqDict’
/usr/include/qt4/qwt_legend.h:31: error: expected initializer before ‘
Uhh well mysteriously the issue just up and disappeared without me doing a single thing.