I'm attempting to create a static build of Qt. I've configured as follows:
./configure -release -opensource -confirm-license -static -no-sql-sqlite -qt-zlib -qt-libpng -qt-libjpeg -qt-freetype -qt-xcb -icu -openssl -nomake examples -skip xmlpatterns
However, I get the following errors:
g++ -Wl,--gc-sections -Wl,-O1 -fuse-ld=gold -Wl,--enable-new-dtags -Wl,-rpath-link,/home/coin/tmp/qt-everywhere-opensource-src-5.5.0/qtdeclarative/lib -Wl,-rpath-link,/home/coin/tmp/qt-everywhere-opensource-src-5.5.0/qtbase/lib -o ../../bin/qmltestrunner .obj/main.o .obj/qmltestrunner_plugin_import.o -L/home/coin/tmp/qt-everywhere-opensource-src-5.5.0/qtdeclarative/lib -lQt5QuickTest -L/home/coin/tmp/qt-everywhere-opensource-src-5.5.0/qtbase/lib -lQt5Test -lQt5Widgets -L/home/coin/tmp/qt-everywhere-opensource-src-5.5.0/qtbase/plugins/platforms -lqxcb -L/home/coin/tmp/qt-everywhere-opensource-src-5.5.0/qtbase/src/plugins/platforms/xcb/xcb-static -L/home/coin/tmp/qt-everywhere-opensource-src-5.5.0/qtbase/plugins/xcbglintegrations -lqxcb-egl-integration -L/home/coin/tmp/qt-everywhere-opensource-src-5.5.0/qtbase/src/plugins/platforms/xcb/gl_integrations/xcb_egl/xcb-static -lqxcb-glx-integration -L/home/coin/tmp/qt-everywhere-opensource-src-5.5.0/qtbase/src/plugins/platforms/xcb/gl_integrations/xcb_glx/xcb-static -lQt5XcbQpa -lXi -lxcb-static -L/home/coin/tmp/qt-everywhere-opensource-src-5.5.0/qtimageformats/plugins/imageformats -lqdds -lqicns -lqjp2 -lqmng -lqtga -lqtiff -lqwbmp -lqwebp -L/home/coin/tmp/qt-everywhere-opensource-src-5.5.0/qtbase/plugins/imageformats -lqico -L/home/coin/tmp/qt-everywhere-opensource-src-5.5.0/qtbase/plugins/egldeviceintegrations -lqeglfs-x11-integration -lX11-xcb -lxcb -lQt5EglDeviceIntegration -lQt5PlatformSupport -lfontconfig -lfreetype -lXrender -lXext -lX11 -ludev -lEGL -L/home/coin/tmp/qt-everywhere-opensource-src-5.5.0/qtdeclarative/plugins/qmltooling -lqmldbg_qtquick2 -lQt5Quick -lQt5Gui -lqtharfbuzzng -lqmldbg_tcp -lQt5Qml -L/home/coin/tmp/qt-everywhere-opensource-src-5.5.0/qtbase/plugins/bearer -lqconnmanbearer -lqgenericbearer -lqnmbearer -lQt5Network -lQt5DBus -lQt5Core -licui18n -licuuc -licudata -lqtpcre -lm -ldl -pthread -lgthread-2.0 -lrt -lglib-2.0 -lGL -lpthread
.obj/qmltestrunner_plugin_import.o:qmltestrunner_plugin_import.cpp:function _GLOBAL__sub_I_qmltestrunner_plugin_import.cpp: error: undefined reference to 'qt_static_plugin_QXcbIntegrationPlugin()'
.obj/qmltestrunner_plugin_import.o:qmltestrunner_plugin_import.cpp:function _GLOBAL__sub_I_qmltestrunner_plugin_import.cpp: error: undefined reference to 'qt_static_plugin_QXcbEglIntegrationPlugin()'
.obj/qmltestrunner_plugin_import.o:qmltestrunner_plugin_import.cpp:function _GLOBAL__sub_I_qmltestrunner_plugin_import.cpp: error: undefined reference to 'qt_static_plugin_QXcbGlxIntegrationPlugin()'
.obj/qmltestrunner_plugin_import.o:qmltestrunner_plugin_import.cpp:function _GLOBAL__sub_I_qmltestrunner_plugin_import.cpp: error: undefined reference to 'qt_static_plugin_QDDSPlugin()'
.obj/qmltestrunner_plugin_import.o:qmltestrunner_plugin_import.cpp:function _GLOBAL__sub_I_qmltestrunner_plugin_import.cpp: error: undefined reference to 'qt_static_plugin_QICNSPlugin()'
.obj/qmltestrunner_plugin_import.o:qmltestrunner_plugin_import.cpp:function _GLOBAL__sub_I_qmltestrunner_plugin_import.cpp: error: undefined reference to 'qt_static_plugin_QJp2Plugin()'
.obj/qmltestrunner_plugin_import.o:qmltestrunner_plugin_import.cpp:function _GLOBAL__sub_I_qmltestrunner_plugin_import.cpp: error: undefined reference to 'qt_static_plugin_QMngPlugin()'
.obj/qmltestrunner_plugin_import.o:qmltestrunner_plugin_import.cpp:function _GLOBAL__sub_I_qmltestrunner_plugin_import.cpp: error: undefined reference to 'qt_static_plugin_QTgaPlugin()'
.obj/qmltestrunner_plugin_import.o:qmltestrunner_plugin_import.cpp:function _GLOBAL__sub_I_qmltestrunner_plugin_import.cpp: error: undefined reference to 'qt_static_plugin_QTiffPlugin()'
.obj/qmltestrunner_plugin_import.o:qmltestrunner_plugin_import.cpp:function _GLOBAL__sub_I_qmltestrunner_plugin_import.cpp: error: undefined reference to 'qt_static_plugin_QWbmpPlugin()'
.obj/qmltestrunner_plugin_import.o:qmltestrunner_plugin_import.cpp:function _GLOBAL__sub_I_qmltestrunner_plugin_import.cpp: error: undefined reference to 'qt_static_plugin_QWebpPlugin()'
.obj/qmltestrunner_plugin_import.o:qmltestrunner_plugin_import.cpp:function _GLOBAL__sub_I_qmltestrunner_plugin_import.cpp: error: undefined reference to 'qt_static_plugin_QICOPlugin()'
.obj/qmltestrunner_plugin_import.o:qmltestrunner_plugin_import.cpp:function _GLOBAL__sub_I_qmltestrunner_plugin_import.cpp: error: undefined reference to 'qt_static_plugin_QEglFSX11IntegrationPlugin()'
.obj/qmltestrunner_plugin_import.o:qmltestrunner_plugin_import.cpp:function _GLOBAL__sub_I_qmltestrunner_plugin_import.cpp: error: undefined reference to 'qt_static_plugin_QConnmanEnginePlugin()'
.obj/qmltestrunner_plugin_import.o:qmltestrunner_plugin_import.cpp:function _GLOBAL__sub_I_qmltestrunner_plugin_import.cpp: error: undefined reference to 'qt_static_plugin_QGenericEnginePlugin()'
.obj/qmltestrunner_plugin_import.o:qmltestrunner_plugin_import.cpp:function _GLOBAL__sub_I_qmltestrunner_plugin_import.cpp: error: undefined reference to 'qt_static_plugin_QNetworkManagerEnginePlugin()'
collect2: error: ld returned 1 exit status
make[3]: *** [../../bin/qmltestrunner] Error 1
make[3]: Leaving directory `/home/coin/tmp/qt-everywhere-opensource-src-5.5.0/qtdeclarative/tools/qmltestrunner'
It seems to be an issue between plugins and static builds. The config does give the following warning:
WARNING: Using static linking will disable the use of dynamically
loaded plugins. Make sure to import all needed static plugins,
or compile needed modules into the library.
Qt is now configured for building. Just run 'make'.
Once everything is built, you must run 'make install'.
Qt will be installed into /usr/local/Qt-5.5.0
Prior to reconfiguration, make sure you remove any leftovers from
the previous build.
However, it seems to indicate that it should work. What's the issue? Can I just disable these plugins or the tools that try to use them, since I don't think I will need them?
As mentioned by AlexanderVX an unclean working directory AND an unclean rootfs directory, from a previous build and installation of the dynamic version of the SDK, was my problem.
I found that using the '-nomake tests' option during the configuration allowed the SDK build to complete but I then had the same linker errors when compiling my application against the SDK.
I traced my problem down to having both the static and dynamic link libraries (e.g. libqlinuxfb.a and libqlinuxfb.so) installed in the library directory of the rootfs. The linker then chose the dynamic version rather than the statically built version of the library and hence the 'qt_static_plugin*' symbols were not present. A clean of the build directory and the installed rootfs resolved the problem.
Unclean working directory was the problem for me like AlexanderVX pointed out.
git submodule foreach --recursive "git clean -dfx"
is also possible for cleaning and a lot faster than
make/jom clean
Related
What I did so far on my Linux Mint system:
Write a thin binding to the GSL library
Write a thick binding based on the thin binding
Write a test program for 1.
Write a test program for 2.
When I create static libraries, everything works fine. When creating dynamic libraries however, compiling 4. with
gprbuild -P test_odeiv2_dyn
gets me undefined references:
Compile
[Ada] test_odeiv2.adb
[Ada] odeiv2_aux.adb
[Ada] integration.adb
[Ada] odeiv2.adb
Build Libraries
[gprlib] gsl.lexch
[link library] libgsl.so
Bind
[gprbind] test_odeiv2.bexch
[Ada] test_odeiv2.ali
Link
[link] test_odeiv2.adb
/usr/bin/ld: /home/frank/Lib/Ada/Num/GSL/lib//libgsl.so: undefined reference to `gsl_odeiv2_driver_apply'
/usr/bin/ld: /home/frank/Lib/Ada/Num/GSL/lib//libgsl.so: undefined reference to `gsl_odeiv2_step_rk4imp'
/usr/bin/ld: /home/frank/Lib/Ada/Num/GSL/lib//libgsl.so: undefined reference to `gsl_odeiv2_step_msbdf'
/usr/bin/ld: /home/frank/Lib/Ada/Num/GSL/lib//libgsl.so: undefined reference to `gsl_odeiv2_step_bsimp'
/usr/bin/ld: /home/frank/Lib/Ada/Num/GSL/lib//libgsl.so: undefined reference to `gsl_odeiv2_step_rkf45'
/usr/bin/ld: /home/frank/Lib/Ada/Num/GSL/lib//libgsl.so: undefined reference to `gsl_odeiv2_step_rk1imp'
/usr/bin/ld: /home/frank/Lib/Ada/Num/GSL/lib//libgsl.so: undefined reference to `gsl_odeiv2_step_rk4'
/usr/bin/ld: /home/frank/Lib/Ada/Num/GSL/lib//libgsl.so: undefined reference to `gsl_odeiv2_driver_free'
/usr/bin/ld: /home/frank/Lib/Ada/Num/GSL/lib//libgsl.so: undefined reference to `gsl_strerror'
/usr/bin/ld: /home/frank/Lib/Ada/Num/GSL/lib//libgsl.so: undefined reference to `gsl_odeiv2_step_rkck'
/usr/bin/ld: /home/frank/Lib/Ada/Num/GSL/lib//libgsl.so: undefined reference to `gsl_odeiv2_step_msadams'
/usr/bin/ld: /home/frank/Lib/Ada/Num/GSL/lib//libgsl.so: undefined reference to `gsl_odeiv2_driver_alloc_y_new'
/usr/bin/ld: /home/frank/Lib/Ada/Num/GSL/lib//libgsl.so: undefined reference to `gsl_odeiv2_step_rk2imp'
/usr/bin/ld: /home/frank/Lib/Ada/Num/GSL/lib//libgsl.so: undefined reference to `gsl_integration_qng'
/usr/bin/ld: /home/frank/Lib/Ada/Num/GSL/lib//libgsl.so: undefined reference to `gsl_odeiv2_step_rk8pd'
/usr/bin/ld: /home/frank/Lib/Ada/Num/GSL/lib//libgsl.so: undefined reference to `gsl_odeiv2_step_rk2'
collect2: error: ld returned 1 exit status
gprbuild: link of test_odeiv2.adb failed
gprbuild: failed command was: /usr/bin/gnatgcc test_odeiv2.o b__test_odeiv2.o -L/home/frank/Lib/Ada/Num/GSL/lib/ -lgsl -L/home/frank/Lib/Ada/Num/GSL/Thin/lib/ -lgsl_thin_dyn -L/usr/lib/x86_64-linux-gnu -lgsl -lgslcblas -L/usr/lib/x86_64-linux-gnu -lgsl -lgslcblas -L/home/frank/Lib/Ada/Num/Tests/Test_GSL/obj_dyn/ -L/home/frank/Lib/Ada/Num/Tests/Test_GSL/obj_dyn/ -L/home/frank/Lib/Ada/Num/GSL/lib/ -L/home/frank/Lib/Ada/Num/GSL/Thin/lib/ -L/usr/lib/gcc/x86_64-linux-gnu/9/adalib/ -shared-libgcc -lgnarl-9 -lgnat-9 -lrt -lpthread -lrt -ldl -Wl,-rpath-link,/usr/lib/gcc/x86_64-linux-gnu/9//adalib -Wl,-z,origin,-rpath,$ORIGIN/../..//GSL/lib:$ORIGIN/../..//GSL/Thin/lib:/usr/lib/x86_64-linux-gnu:$ORIGIN//obj_dyn:/usr/lib/gcc/x86_64-linux-gnu/9/adalib:/usr/lib64:/usr/lib -o /home/frank/Lib/Ada/Num/Tests/Test_GSL//test_odeiv2_dyn
What am I missing?
My project files are:
1.
library project GSL_Thin_Dyn is
version:= "1";
for Source_Dirs use ("src", "src/matrix");
for Library_Dir use "lib";
for Object_Dir use "obj_rel";
for Library_Name use "gsl_thin_dyn";
for Library_Kind use "relocatable";
for Library_Version use "libgsl_thin.so." & version;
for Externally_Built use "false";
package Linker is
for Linker_Options use ("-L/usr/lib/x86_64-linux-gnu", "-lgsl", "-lgslcblas");
end Linker;
end GSL_Thin_Dyn;
with "Thin/gsl_thin_dyn";
library project GSL_dyn is
version:= "1";
for Source_Dirs use (".");
for Object_Dir use "obj_dyn";
for Library_Dir use "lib";
for Library_Name use "gsl";
for Library_Kind use "relocatable";
for Library_Version use "libgsl.so." & version;
for Externally_Built use "false";
package Linker is
for Linker_Options use ("-L/usr/lib/x86_64-linux-gnu", "-lgsl", "-lgslcblas");
end Linker;
end GSL_dyn;
with "../../../Gen/gen_shared";
with "../../GSL/Thin/gsl_thin_dyn";
project Test_Odeiv2_Thin_Dyn is
for Source_Dirs use (".");
case gen_shared.mode is
when "debug" => for Object_Dir use "obj_dyn";
when "release" => for Object_Dir use "obj_dyn/release";
when others => null;
end case;
for Exec_Dir use ".";
for Main use ("test_odeiv2_thin.adb");
package Builder is
for Executable ("test_odeiv2_thin.adb") use "test_odeiv2_thin_dyn";
end Builder;
end Test_Odeiv2_Thin_Dyn;
with "../../../Gen/gen_shared";
with "../../GSL/gsl_dyn";
project Test_Odeiv2_Dyn is
for Source_Dirs use (".");
case gen_shared.mode is
when "debug" => for Object_dir use "obj_dyn";
when "release" => for Object_Dir use "obj_dyn/release";
end case;
for Exec_Dir use ".";
for Main use ("test_odeiv2.adb");
package Linker is
for Linker_Options use ("-L/usr/lib/x86_64-linux-gnu", "-lgsl", "-lgslcblas");
end Linker;
package Builder is
for Executable ("test_odeiv2.adb") use "test_odeiv2_dyn";
end Builder;
end Test_Odeiv2_Dyn;
You named your thick wrapper library gsl. The library you're wrapping is also named gsl. Internally, this will cause the linker to get -lgsl two times, and both will be resolved to your thick wrapper. This is why it's missing the symbols from the original library.
Change the Library_Name of your thick wrapper to resolve this.
Qt 5.7.0 GCC 4.9.1
I created a simple widget project (no single code written, no settings changed, only drag a few controls to the form) right after installing Qt and did a test compile. I got error messages:
:-1: error: skipping incompatible /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../libGL.so when searching for -lGL
:-1: error: skipping incompatible /lib/libGL.so when searching for -lGL
:-1: error: skipping incompatible /usr/lib/libGL.so when searching for -lGL
:-1: error: cannot find -lGL
:-1: error: collect2: error: ld returned 1 exit status
I reckon that it was trying to link to the 32 bit OpenGL in my 64 bit machine. /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../libGL.so is indeed located in /usr/lib/libGL. The 64 bit version, I think, is the one in /usr/lib64/libGL. How can I change the linking path so that it will link to the right library?
This seems like you are missing libraries needed to compile 32-bit binaries.
Try running:
sudo yum install glibc-devel.i686 libgcc.i686 libstdc++-devel.i686
this is how I solved this problem.
locate libGL.so and find the right 64 bit version (I used the latest);
create a link in the Qt lib path: ln -s /usr/lib64/libGL.so.352.79 ~/Qt/5.7/gcc_64/lib/libGL.so
Got a sample program (from https://raw.githubusercontent.com/libevent/libevent/master/sample/https-client.c) that uses libevent to simulate HTTPS client. I saved it to te1.c and compiled it, but got the following link error.
$ gcc -g te1.c -levent -levent_openssl
/tmp/cc5xxmcP.o: In function `http_request_done':
/home/jin1/tmp/te1.c:82: undefined reference to `evhttp_request_get_response_code_line'
/tmp/cc5xxmcP.o: In function `main':
/home/jin1/tmp/te1.c:297: undefined reference to `bufferevent_openssl_set_allow_dirty_shutdown'
/home/jin1/tmp/te1.c:301: undefined reference to `evhttp_connection_base_bufferevent_new'
collect2: ld returned 1 exit status
Any idea what library has the functions such as evhttp_request_get_response_code_line, evhttp_connection_base_bufferevent_new? Thanks in advance!
Turned out the libevent-2.0.so.5.1.4 is installed /usr/lib (by apt-get install libevent-dev). libevent-2.0.so.5.1.4 doesn't have the symbols. The latest libevent library that I compiled and installed were in /usr/local/bin.
The following line (with -L/usr/local/bin) helped:
gcc -g te1.c -L/usr/local/lib -levent -levent_openssl
I searched and could not really find an answer for this. I have a CentOS server that does not have and RHN connectivity. I need to install cairo and libcairo2 to make rapache work. I did find the cairo tar file, and installed it sucessfully. When I attempted to install R cairo package, it failed with this error:
R CMD INSTALL -l /usr/local/lib64/R/library Cairo_1.5-1.tar.gz
error: checking whether Cairo programs can be compiled... configure: error: Cannot compile a simple Cairo program. See config.log for details.
Someone suggested that I'm missing libcairo2 package. I searched all over the place and cannot find this package for centos. Any ideas? P.S. I tried to install the R cairo package within R, the same exact error.
locate libcairo output:
/usr/lib/libcairo.so.2
/usr/lib/libcairo.so.2.9.2
/usr/lib64/libcairo.a
/usr/lib64/libcairo.so
/usr/lib64/libcairo.so.2
/usr/lib64/libcairo.so.2.9.2
/usr/local/lib/libcairo-script-interpreter.a
/usr/local/lib/libcairo-script-interpreter.la
/usr/local/lib/libcairo-script-interpreter.so
/usr/local/lib/libcairo-script-interpreter.so.2
/usr/local/lib/libcairo-script-interpreter.so.2.11000.0
/usr/local/lib/libcairo.a
/usr/local/lib/libcairo.la
/usr/local/lib/libcairo.so
/usr/local/lib/libcairo.so.2
/usr/local/lib/libcairo.so.2.11000.0
/usr/local/lib/cairo/libcairo-trace.a
/usr/local/lib/cairo/libcairo-trace.la
/usr/local/lib/cairo/libcairo-trace.so
/usr/local/lib/cairo/libcairo-trace.so.0
/usr/local/lib/cairo/libcairo-trace.so.0.0.0
I see these type of errors in config.log file:
configure:3631: checking whether Cairo programs can be compiled
configure:3645: gcc -std=gnu99 -o conftest -g -O2 -I/usr/local/include/cairo conftest.c -L/usr/local/lib -lcairo >&5
/usr/local/lib/libcairo.so: undefined reference to `png_create_read_struct'
/usr/local/lib/libcairo.so: undefined reference to `png_set_write_user_transform_fn'
/usr/local/lib/libcairo.so: undefined reference to `png_set_bKGD'
/usr/local/lib/libcairo.so: undefined reference to `png_get_valid'
/usr/local/lib/libcairo.so: undefined reference to `png_set_write_fn'
/usr/local/lib/libcairo.so: undefined reference to `png_get_error_ptr'
/usr/local/lib/libcairo.so: undefined reference to `png_set_filler'
/usr/local/lib/libcairo.so: undefined reference to `png_read_update_info'
/usr/local/lib/libcairo.so: undefined reference to `png_set_read_fn'
/usr/local/lib/libcairo.so: undefined reference to `png_create_info_struct'
/usr/local/lib/libcairo.so: undefined reference to `png_set_packing'
/usr/local/lib/libcairo.so: undefined reference to `png_set_strip_16'
/usr/local/lib/libcairo.so: undefined reference to `png_set_tRNS_to_alpha'
/usr/local/lib/libcairo.so: undefined reference to `png_error'
/usr/local/lib/libcairo.so: undefined reference to `png_write_image'
/usr/local/lib/libcairo.so: undefined reference to `png_set_interlace_handling'
/usr/local/lib/libcairo.so: undefined reference to `png_read_end'
/usr/local/lib/libcairo.so: undefined reference to `png_set_expand_gray_1_2_4_to_8'
/usr/local/lib/libcairo.so: undefined reference to `png_set_longjmp_fn'
/usr/local/lib/libcairo.so: undefined reference to `png_read_image'
The fact that locate can find the library suggests that it was installed succesfully. A problem could be that although it is installed, R cannot find it. Check if the location of libcairo.so is in your LD_LIBRARY_PATH.
And to see what goes wrong, what does the file config.log say?
I'm having troubling linking a program with sqlite3. Any ideas?
gcc -g -O2 main.o work.o uuid.o sqlite3.o -lboost_system -lboost_thread -o server
sqlite3.o: In function `unixDlError':
/home/matt/dev/serv/sqlite3.c:27231: undefined reference to `dlerror'
sqlite3.o: In function `unixDlSym':
/home/matt/dev/serv/sqlite3.c:27258: undefined reference to `dlsym'
sqlite3.o: In function `unixDlClose':
/home/matt/dev/serv/sqlite3.c:27262: undefined reference to `dlclose'
sqlite3.o: In function `unixDlOpen':
/home/matt/dev/serv/sqlite3.c:27217: undefined reference to `dlopen'
collect2: ld returned 1 exit status
Tack an -ldl on there after -lboost_thread.