Weird problem porting application. Undefined reference errors in standard libraries - c++

I've recently been trying to port a C++ application. I believe I have all of it's dependencies and such and it all compiles. But then, when it goes to link it I get a lot of weird undefined reference errors.
/usr/local/lib/libglibmm-2.4.so.7.0: undefined reference to `std::basic_istream<char, std::char_traits<char> >::seekg(long, std::_Ios_Seekdir)'
/usr/local/lib/libglibmm-2.4.so.7.0: undefined reference to `std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::_S_empty_rep_storage'
/usr/local/lib/libxml++-2.6.so.0.1: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_S_empty_rep_storage'
/usr/local/lib/libxml++-2.6.so.0.1: undefined reference to `std::__default_alloc_template<true, 0>::deallocate(void*, unsigned long)'
What can cause this kind of errors? What do the linking errors mean? I can't really understand the complicated template error messages that gcc gives..
The linking command in it's entirety:
gmake[3]: Entering directory `/home/earlz/synfig-0.62.00/src/tool'
/bin/sh ../../libtool --tag=CXX --mode=link eg++ -I/usr/local/include/libxml++-2.6 -I/usr/local/lib/libxml++-2.6/include -I/usr/local/include/libxml2 -I/usr/local/include -I/usr/local/include/glibmm-2.4 -I/usr/local/lib/glibmm-2.4/include -I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include -I/usr/local/include/sigc++-2.0 -I/usr/local/lib/sigc++-2.0/include -I/usr/local/include -I/usr/local/include/sigc++-2.0 -I/usr/local/lib/sigc++-2.0/include -DSYNFIG_NO_DEPRECATED -DLOCALEDIR=\"/usr/local/share/locale\" -DNDEBUG -O2 -W -Wall -o synfig synfig-main.o ../synfig/libsynfig.la -L/usr/local/lib -lxml++-2.6 -lxml2 -lglibmm-2.4 -lgobject-2.0 -lglib-2.0 -lintl -liconv -lsigc-2.0 -lpthread -L/usr/local/lib -lsigc-2.0 -L/usr/local/lib -lintl -L/usr/local/lib -liconv -lpthread
libtool: link: eg++ -I/usr/local/include/libxml++-2.6 -I/usr/local/lib/libxml++-2.6/include -I/usr/local/include/libxml2 -I/usr/local/include -I/usr/local/include/glibmm-2.4 -I/usr/local/lib/glibmm-2.4/include -I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include -I/usr/local/include/sigc++-2.0 -I/usr/local/lib/sigc++-2.0/include -I/usr/local/include -I/usr/local/include/sigc++-2.0 -I/usr/local/lib/sigc++-2.0/include -DSYNFIG_NO_DEPRECATED -DLOCALEDIR=\"/usr/local/share/locale\" -DNDEBUG -O2 -W -Wall -o .libs/synfig synfig-main.o -L../synfig/.libs -lsynfig -L/usr/local/lib -lxml++-2.6 -lxml2 -lm -lz -lglibmm-2.4 -lgmodule-2.0 -lgobject-2.0 -lglib-2.0 -lpcre -lsigc-2.0 -lintl -liconv -lpthread -Wl,-rpath,/usr/local/lib
Also, I do not get any kind of linking errors about missing files, just stuff about weird string and filestream stuff missing

Use g++ to link C++ applications, that add C++ standard libraries to the link phase.

Related

HDF5 linking error

When linking my hdf5 code I get the following error. Any ideas what I have done wrong.
The command I am using:
g++ -std=c++11 -m64 -DOPENFOAM_PLUS=1712 -Dlinux64 -DWM_ARCH_OPTION=64 -DWM_DP -DWM_LABEL_SIZE=32 -Wall -Wextra -Wold-style-cast -Wnon-virtual-dtor -Wno-unused-parameter -Wno-invalid-offsetof -Wno-attributes -O3 -DNoRepository -ftemplate-depth-100 -I/opt/software/OpenFOAM/OpenFOAM-v1712/src/finiteVolume/lnInclude -I/opt/software/OpenFOAM/OpenFOAM-v1712/src/sampling/lnInclude -I/opt/software/OpenFOAM/OpenFOAM-v1712/src/meshTools/lnInclude -IlnInclude -I. -I/opt/software/OpenFOAM/OpenFOAM-v1712/src/OpenFOAM/lnInclude -I/opt/software/OpenFOAM/OpenFOAM-v1712/src/OSspecific/POSIX/lnInclude -fPIC -Xlinker --add-needed -Xlinker --no-as-needed Make/linux64GccDPInt32Opt/3DIBicoFoam_2.o -L/opt/software/OpenFOAM/OpenFOAM-v1712/platforms/linux64GccDPInt32Opt/lib \
-lfiniteVolume -lsampling -L/local/hulfeldl/hdf5/lib/libhdf5_hl_cpp.a -L/local/hulfeldl/hdf5/lib/libhdf5_cpp.a -L/local/hulfeldl/hdf5/lib/libhdf5_hl.a -L/local/hulfeldl/hdf5/lib/libhdf5.a -lhdf5_hl_cpp -lhdf5_cpp -lhdf5_hl -lhdf5 -lsz -lz -ldl -lm -lOpenFOAM -ldl \
-lm -o /local/hulfeldl/OpenFOAM/hulfeldl-v1712/applications/bin/linux64GccDPInt32Opt/3DIBicoFoam_2
Error:
Make/linux64GccDPInt32Opt/3DIBicoFoam_2.o: In function `main':
3DIBicoFoam_2.C:(.text.startup+0x107b): undefined reference to
`H5::H5Location::openDataSet(std::string const&) const'
3DIBicoFoam_2.C:(.text.startup+0x17de): undefined reference to
`H5::H5Location::openDataSet(std::string const&) const'
3DIBicoFoam_2.C:(.text.startup+0x189e): undefined reference to
`H5::H5Location::openDataSet(std::string const&) const'
3DIBicoFoam_2.C:(.text.startup+0x1919): undefined reference to
`H5::H5Location::openDataSet(std::string const&) const'
3DIBicoFoam_2.C:(.text.startup+0x19d0): undefined reference to
`H5::H5Location::openDataSet(std::string const&) const'
Please remove all -L/...a to start with. Add one single -L/local/hulfeldl/hdf5/lib leave all -lhdf... in the command. And retry.
For runtime please run the following before you run your program.
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/local/hulfeldl/hdf5/lib

Error building wxWidgets DLLs with GCC's Link Time Optimization on Windows

When attempting to build the wxWidgets 3.1.0 library with the following command line:
mingw32-make -f makefile.gcc BUILD=release SHARED=1 CFLAGS="-O2 -flto"
CXXFLAGS="-O2 -flto" LDFLAGS="-O2 -flto"
I'm getting this warning (31 occurrences)
lto1.exe: warning: -fPIC ignored for target (all code is position independent)
Followed by:
C:\Users\Marc\AppData\Local\Temp\ccEDEhIg.ltrans6.ltrans.o:<artificial>:(.text+0x13c4): undefined reference to `wx_regfree'
C:\Users\Marc\AppData\Local\Temp\ccEDEhIg.ltrans6.ltrans.o:<artificial>:(.text+0x1418): undefined reference to `wx_regfree'
C:\Users\Marc\AppData\Local\Temp\ccEDEhIg.ltrans6.ltrans.o:<artificial>:(.text+0x3792): undefined reference to `wx_regerror'
C:\Users\Marc\AppData\Local\Temp\ccEDEhIg.ltrans6.ltrans.o:<artificial>:(.text+0x37c1): undefined reference to `wx_regerror'
C:\Users\Marc\AppData\Local\Temp\ccEDEhIg.ltrans6.ltrans.o:<artificial>:(.text+0x3a7d): undefined reference to `wx_re_exec'
C:\Users\Marc\AppData\Local\Temp\ccEDEhIg.ltrans6.ltrans.o:<artificial>:(.text+0x47de): undefined reference to `wx_re_comp'
C:\Users\Marc\AppData\Local\Temp\ccEDEhIg.ltrans6.ltrans.o:<artificial>:(.text+0x4cf4): undefined reference to `wx_regfree'
C:\Users\Marc\AppData\Local\Temp\ccEDEhIg.ltrans6.ltrans.o:<artificial>:(.text+0x4f94): undefined reference to `wx_regfree'
C:\Users\Marc\AppData\Local\Temp\ccEDEhIg.ltrans12.ltrans.o:<artificial>:(.text+0x57c): undefined reference to `deflateEnd'
C:\Users\Marc\AppData\Local\Temp\ccEDEhIg.ltrans12.ltrans.o:<artificial>:(.text+0x88d): undefined reference to `deflateSetDictionary'
C:\Users\Marc\AppData\Local\Temp\ccEDEhIg.ltrans12.ltrans.o:<artificial>:(.text+0x8ba): undefined reference to `deflateSetDictionary'
C:\Users\Marc\AppData\Local\Temp\ccEDEhIg.ltrans12.ltrans.o:<artificial>:(.text+0x947): undefined reference to `deflate'
C:\Users\Marc\AppData\Local\Temp\ccEDEhIg.ltrans12.ltrans.o:<artificial>:(.text+0x4830): undefined reference to `deflate'
C:\Users\Marc\AppData\Local\Temp\ccEDEhIg.ltrans12.ltrans.o:<artificial>:(.text+0x59f4): undefined reference to `deflateInit2_'
C:\Users\Marc\AppData\Local\Temp\ccEDEhIg.ltrans14.ltrans.o:<artificial>:(.text+0x3354): undefined reference to `deflateReset'
C:\Users\Marc\AppData\Local\Temp\ccEDEhIg.ltrans14.ltrans.o:<artificial>:(.text+0x38db): undefined reference to `inflateReset'
C:\Users\Marc\AppData\Local\Temp\ccEDEhIg.ltrans16.ltrans.o:<artificial>:(.text+0x21d): undefined reference to `inflateSetDictionary'
C:\Users\Marc\AppData\Local\Temp\ccEDEhIg.ltrans16.ltrans.o:<artificial>:(.text+0x24a): undefined reference to `inflateSetDictionary'
C:\Users\Marc\AppData\Local\Temp\ccEDEhIg.ltrans16.ltrans.o:<artificial>:(.text+0x266): undefined reference to `zlibVersion'
C:\Users\Marc\AppData\Local\Temp\ccEDEhIg.ltrans16.ltrans.o:<artificial>:(.text+0x27d): undefined reference to `zlibVersion'
C:\Users\Marc\AppData\Local\Temp\ccEDEhIg.ltrans16.ltrans.o:<artificial>:(.text+0x2d0): undefined reference to `zlibVersion'
C:\Users\Marc\AppData\Local\Temp\ccEDEhIg.ltrans16.ltrans.o:<artificial>:(.text+0x121c): undefined reference to `inflate'
C:\Users\Marc\AppData\Local\Temp\ccEDEhIg.ltrans16.ltrans.o:<artificial>:(.text+0x1924): undefined reference to `inflateEnd'
C:\Users\Marc\AppData\Local\Temp\ccEDEhIg.ltrans16.ltrans.o:<artificial>:(.text+0x20b7): undefined reference to `inflateInit2_'
C:\Users\Marc\AppData\Local\Temp\ccEDEhIg.ltrans16.ltrans.o:<artificial>:(.text+0x3694): undefined reference to `crc32'
C:\Users\Marc\AppData\Local\Temp\ccEDEhIg.ltrans16.ltrans.o:<artificial>:(.text+0x5534): undefined reference to `crc32'
C:\Users\Marc\AppData\Local\Temp\ccEDEhIg.ltrans16.ltrans.o:<artificial>:(.text+0x5813): undefined reference to `crc32'
C:\Users\Marc\AppData\Local\Temp\ccEDEhIg.ltrans16.ltrans.o:<artificial>:(.text+0x773e): undefined reference to `crc32'
C:\Users\Marc\AppData\Local\Temp\ccEDEhIg.ltrans16.ltrans.o:<artificial>:(.text+0x7c5b): undefined reference to `crc32'
collect2.exe: error: ld returned 1 exit status
makefile.gcc:5299: recipe for target '..\..\lib\gcc_dll\wxbase310u_gcc_custom.dll' failed
mingw32-make: *** [..\..\lib\gcc_dll\wxbase310u_gcc_custom.dll] Error 1
Last lines emmited by the compiler and linker, which results in all these errors, are as follows:
g++ -c -o gcc_mswudll\basedll_main.o -O2 -mthreads -DHAVE_W32API_H -D__WXMSW__ -DNDEBUG -D_UNICODE -I..\..\lib\gcc_dll\mswu -I..\..\include -W -Wall -DWXBUILDING -I..\..\src\tiff\libtiff -I..\..\src\jpeg -I..\..\src\png -I..\..\src\zlib -I..\..\src\regex -I..\..\src\expat\lib -DwxUSE_GUI=0 -DWXMAKINGDLL_BASE -DwxUSE_BASE=1 -Wno-ctor-dtor-privacy -O2 -flto -MTgcc_mswudll\basedll_main.o -MFgcc_mswudll\basedll_main.o.d -MD -MP ../../src/msw/main.cpp
g++ -c -o gcc_mswudll\basedll_volume.o -O2 -mthreads -DHAVE_W32API_H -D__WXMSW__ -DNDEBUG -D_UNICODE -I..\..\lib\gcc_dll\mswu -I..\..\include -W -Wall -DWXBUILDING -I..\..\src\tiff\libtiff -I..\..\src\jpeg -I..\..\src\png -I..\..\src\zlib -I..\..\src\regex -I..\..\src\expat\lib -DwxUSE_GUI=0 -DWXMAKINGDLL_BASE -DwxUSE_BASE=1 -Wno-ctor-dtor-privacy -O2 -flto -MTgcc_mswudll\basedll_volume.o -MFgcc_mswudll\basedll_volume.o.d -MD -MP ../../src/msw/volume.cpp
g++ -shared -fPIC -o ..\..\lib\gcc_dll\wxbase310u_gcc_custom.dll gcc_mswudll\basedll_dummy.o gcc_mswudll\basedll_version_rc.o gcc_mswudll\basedll_any.o gcc_mswudll\basedll_appbase.o gcc_mswudll\basedll_arcall.o gcc_mswudll\basedll_arcfind.o gcc_mswudll\basedll_archive.o gcc_mswudll\basedll_arrstr.o gcc_mswudll\basedll_base64.o gcc_mswudll\basedll_clntdata.o gcc_mswudll\basedll_cmdline.o gcc_mswudll\basedll_config.o gcc_mswudll\basedll_convauto.o gcc_mswudll\basedll_datetime.o gcc_mswudll\basedll_datetimefmt.o gcc_mswudll\basedll_datstrm.o gcc_mswudll\basedll_dircmn.o gcc_mswudll\basedll_dynarray.o gcc_mswudll\basedll_dynlib.o gcc_mswudll\basedll_dynload.o gcc_mswudll\basedll_encconv.o gcc_mswudll\basedll_evtloopcmn.o gcc_mswudll\basedll_extended.o gcc_mswudll\basedll_ffile.o gcc_mswudll\basedll_file.o gcc_mswudll\basedll_fileback.o gcc_mswudll\basedll_fileconf.o gcc_mswudll\basedll_filefn.o gcc_mswudll\basedll_filename.o gcc_mswudll\basedll_filesys.o gcc_mswudll\basedll_filtall.o gcc_mswudll\basedll_filtfind.o gcc_mswudll\basedll_fmapbase.o gcc_mswudll\basedll_fs_arc.o gcc_mswudll\basedll_fs_filter.o gcc_mswudll\basedll_hash.o gcc_mswudll\basedll_hashmap.o gcc_mswudll\basedll_init.o gcc_mswudll\basedll_intl.o gcc_mswudll\basedll_ipcbase.o gcc_mswudll\basedll_languageinfo.o gcc_mswudll\basedll_list.o gcc_mswudll\basedll_log.o gcc_mswudll\basedll_longlong.o gcc_mswudll\basedll_memory.o gcc_mswudll\basedll_mimecmn.o gcc_mswudll\basedll_module.o gcc_mswudll\basedll_mstream.o gcc_mswudll\basedll_numformatter.o gcc_mswudll\basedll_object.o gcc_mswudll\basedll_platinfo.o gcc_mswudll\basedll_powercmn.o gcc_mswudll\basedll_process.o gcc_mswudll\basedll_regex.o gcc_mswudll\basedll_stdpbase.o gcc_mswudll\basedll_sstream.o gcc_mswudll\basedll_stdstream.o gcc_mswudll\basedll_stopwatch.o gcc_mswudll\basedll_strconv.o gcc_mswudll\basedll_stream.o gcc_mswudll\basedll_string.o gcc_mswudll\basedll_stringimpl.o gcc_mswudll\basedll_stringops.o gcc_mswudll\basedll_strvararg.o gcc_mswudll\basedll_sysopt.o gcc_mswudll\basedll_tarstrm.o gcc_mswudll\basedll_textbuf.o gcc_mswudll\basedll_textfile.o gcc_mswudll\basedll_threadinfo.o gcc_mswudll\basedll_time.o gcc_mswudll\basedll_timercmn.o gcc_mswudll\basedll_timerimpl.o gcc_mswudll\basedll_tokenzr.o gcc_mswudll\basedll_translation.o gcc_mswudll\basedll_txtstrm.o gcc_mswudll\basedll_unichar.o gcc_mswudll\basedll_uri.o gcc_mswudll\basedll_ustring.o gcc_mswudll\basedll_variant.o gcc_mswudll\basedll_wfstream.o gcc_mswudll\basedll_wxcrt.o gcc_mswudll\basedll_wxprintf.o gcc_mswudll\basedll_xlocale.o gcc_mswudll\basedll_xti.o gcc_mswudll\basedll_xtistrm.o gcc_mswudll\basedll_zipstrm.o gcc_mswudll\basedll_zstream.o gcc_mswudll\basedll_fswatchercmn.o gcc_mswudll\basedll_fswatcherg.o gcc_mswudll\basedll_basemsw.o gcc_mswudll\basedll_crashrpt.o gcc_mswudll\basedll_debughlp.o gcc_mswudll\basedll_dde.o gcc_mswudll\basedll_dir.o gcc_mswudll\basedll_dlmsw.o gcc_mswudll\basedll_evtloopconsole.o gcc_mswudll\basedll_mimetype.o gcc_mswudll\basedll_power.o gcc_mswudll\basedll_regconf.o gcc_mswudll\basedll_registry.o gcc_mswudll\basedll_snglinst.o gcc_mswudll\basedll_stackwalk.o gcc_mswudll\basedll_stdpaths.o gcc_mswudll\basedll_thread.o gcc_mswudll\basedll_timer.o gcc_mswudll\basedll_utils.o gcc_mswudll\basedll_utilsexc.o gcc_mswudll\basedll_fswatcher.o gcc_mswudll\basedll_event.o gcc_mswudll\basedll_fs_mem.o gcc_mswudll\basedll_msgout.o gcc_mswudll\basedll_utilscmn.o gcc_mswudll\basedll_main.o gcc_mswudll\basedll_volume.o -mthreads -L..\..\lib\gcc_dll -Wl,--out-implib=..\..\lib\gcc_dll\libwxbase31u.a -O2 -flto -lwxzlib -lwxregexu -lwxexpat -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lshlwapi -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lversion -lwsock32 -lwininet
What I've tried so far:
Added -fPIC to CFLAGS and CXXFLAGS, to no avail.
Use -fwhopr instead of -flto, as suggested by the MinGW-w64 Wiki but it's not recognized by either gcc.exe and g++.exe. After reading this article: Linktime optimization in GCC, part 1 - brief history, I'm assuming the -fwhopr option doesn't exist anymore and is now the default mode for the -flto switch.
Build the static configuration (SHARED=0). It builds successfully, but is unusable. See Reference #1.
Omit -flto from LDFLAGS - i.e. use -flto in CFLAGS and CXXFLAGS only. Also no avail.
How to get past these errors, and build wxWidgets with GCC's Link Time Optimization?
I'm building with MinGW-w64; threading model Win32; exception handling DWARF; GCC version 5.3.0.
Reference #1: Result from the "Minimal Sample" build command line
H:\temp\wxwidgets-3.1.0\samples\minimal>mingw32-make -f makefile.gcc BUILD=release SHARED=0 CFLAGS="-O2 -flto" CXXFLAGS="-O2 -flto" LDFLAGS="-O2 -flto"
windres --use-temp-file -i../../samples/sample.rc -ogcc_mswu\minimal_sample_rc.o --define __WXMSW__ --define NDEBUG --define _UNICODE --include-dir .\..\..\lib\gcc_lib\mswu --include-dir ./../../include --include-dir . --include-dir ./../../samples --define NOPCH
g++ -c -o gcc_mswu\minimal_minimal.o -O2 -mthreads -DHAVE_W32API_H -D__WXMSW__ -DNDEBUG -D_UNICODE -I.\..\..\lib\gcc_lib\mswu -I.\..\..\include -W -Wall -I. -I.\..\..\samples -DNOPCH -Wno-ctor-dtor-privacy -O2 -flto -MTgcc_mswu\minimal_minimal.o -MFgcc_mswu\minimal_minimal.o.d -MD -MP minimal.cpp
g++ -o gcc_mswu\minimal.exe gcc_mswu\minimal_sample_rc.o gcc_mswu\minimal_minimal.o -mthreads -L.\..\..\lib\gcc_lib -Wl,--subsystem,windows -mwindows -O2 -flto -lwxmsw31u_core -lwxbase31u -lwxtiff -lwxjpeg -lwxpng -lwxzlib -lwxregexu -lwxexpat -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lshlwapi -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lversion -lwsock32 -lwininet
C:\Users\Marc\AppData\Local\Temp\ccY1ZbWs.ltrans0.ltrans.o:<artificial>:(.text+0x191): undefined reference to `wxDefaultPosition'
C:\Users\Marc\AppData\Local\Temp\ccY1ZbWs.ltrans0.ltrans.o:<artificial>:(.text+0x197): undefined reference to `wxDefaultPosition'
C:\Users\Marc\AppData\Local\Temp\ccY1ZbWs.ltrans0.ltrans.o:<artificial>:(.text+0x1a8): undefined reference to `wxDefaultSize'
(Many, many other "undefined reference" errors - probably one for every function the code ever depends on) and then...
collect2.exe: error: ld returned 1 exit status
makefile.gcc:221: recipe for target 'gcc_mswu\minimal.exe' failed
mingw32-make: *** [gcc_mswu\minimal.exe] Error 1
I've never tried using LTO with DLLs before, but there are apparently bugs with doing it, see e.g. this one. Not sure if using the workaround proposed there can help in your case.
What I think should definitely work would be compiling your application sources and wxWidgets together at once, this would be similar to building a static library but shouldn't optimize away things unused in the library -- but used in the application code.
Finally, I'm really not sure if you're going to achieve much with LTO in wxWidgets case. There is not that much "slow" code to optimize in the library...

Undefined reference to wpa_ctrl functions in my C++ OpenFrameworks project. Need help integrating this c library

I'm working on a menu option to connect to wifi in my C++ application that is build using OpenFrameworks. I want to use the wpa_ctrl library but I can't get it to compile.
Code snippet:
NetworkWrapper.h:
#ifndef NETWORKWRAPPER_H_
#define NETWORKWRAPPER_H_
class NetworkWrapper {
public:
NetworkWrapper():
private:
struct wpa_ctrl* m_ctrl;
};
#endif
NetworkWrapper.cpp:
#include "NetworkWrapper.h"
extern "C" {
#include "wpa_ctrl.h"
}
NetworkWrapper::NetworkWrapper() {
m_ctrl = wpa_ctrl_open("wlan0");
}
Error:
***/NetworkWrapper.cpp:7: undefined reference to `wpa_ctrl_open'
collect2: error: ld returned 1 exit status
I've tried throwing around the include and using and not using extern "C" but it makes no difference seeing as wpa_ctrl.h is also enclosed in the extern "C" tag, albeit with #ifdef __cplusplus (which is defined, I double checked).
I'm pretty much out of ideas now. I should note that I tried enclosing wpa_ctrl.c in the extern "C" tags, which to my knowledge shouldn't compile(?). Which also gave the exact same result. This led me to manually compiling the wpa_ctrl library and copying to the obj directory but again: same result.
Thank you for taking the time to read my question, hope you can help!
* EDIT *
As per request my linking options (I trimmed it down a bit):
g++ -o bin/application_debug obj/linux64/Debug/src/main.o [...] obj/linux64/Debug/src/libs/wpa_ctrl.o [...] obj/linux64/Debug/src/common/NetworkWrapper.o [...] -Wl,-rpath=./libs:./bin/libs -Wl,--as-needed -Wl,--gc-sections -Wl,-rpath=./libs -liw -L../../../libs/fmodex/lib/linux64/ -lfmodex -L ./bin/libs -lSDL -lSDL_mixer -lcurl ../../../libs/glfw/lib/linux64/libglfw3.a ../../../libs/kiss/lib/linux64/libkiss.a ../../../libs/rtAudio/lib/linux64/libRtAudio.a ../../../libs/tess2/lib/linux64/libtess2.a ../../../libs/poco/lib/linux64/libPocoNet.a ../../../libs/poco/lib/linux64/libPocoXML.a ../../../libs/poco/lib/linux64/libPocoUtil.a ../../../libs/poco/lib/linux64/libPocoFoundation.a ../../../libs/poco/lib/linux64/libPocoNetSSL.a ../../../libs/poco/lib/linux64/libPocoNet.a ../../../libs/poco/lib/linux64/libPocoCrypto.a ../../../libs/poco/lib/linux64/libPocoUtil.a ../../../libs/poco/lib/linux64/libPocoXML.a ../../../libs/poco/lib/linux64/libPocoFoundation.a -L/usr/lib64 -lz -lgstapp-0.10 -lgstvideo-0.10 -lgstbase-0.10 -lgstreamer-0.10 -lgmodule-2.0 -pthread -lgthread-2.0 -pthread -lxml2 -ludev -lsndfile -lopenal -lssl -lcrypto -lpulse-simple -lpulse -lasound -lGLEW -lGLU -lGL -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lfontconfig -lfreetype -lmpg123 -lglut -lX11 -lXrandr -lXxf86vm -lXi -lXcursor -ldl -lpthread -lfreeimage
So I finally found what I was doing wrong. For future visitors:
I needed to add the following defines in my makefile:
-D CONFIG_CTRL_IFACE -D CONFIG_CTRL_IFACE_UNIX

Linking issue with libcrypto: undefined reference to `__imp__CertFreeCertificateContext'

I'm trying to cross-compile cachecoin binaries on a linux host using gitian and i686-w64-mingw for a windows target.
The compilation works fine until the final step of static linking of the dependencies. This is what I get:
/home/ubuntu/staging32/lib/libcrypto.a(e_capi.o):e_capi.c:(.text+0x1ff): undefined reference to `__imp__CertFreeCertificateContext#4'
Google suggests it's a missing -lcrypto link or even -lcrypt32. But in the last line before it fails you can see it's linking both. What's the issue here?
My gitian descriptor is available here. And this is the qmake project file. Full tail of the build log:
[...]
i686-w64-mingw32-g++ -c -frandom-seed=cachecoin -D_FORTIFY_SOURCE=2 -msse2 -O2 -frtti -fexceptions -fdiagnostics-show-option -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter -Wstack-protector -DBOOST_THREAD_USE_LIB -DQT_GUI -DBOOST_THREAD_USE_LIB -DBOOST_SPIRIT_THREADSAFE -DBOOST_THREAD_PROVIDES_GENERIC_SHARED_MUTEX_ON_WIN -D__NO_SYSTEM_INCLUDES -DSCRYPT_CHACHA -DSCRYPT_KECCAK512 -DUSE_QRCODE -DUSE_UPNP=1 -DSTATICLIB -DUSE_IPV6=1 -DCACHECOIN_NEED_QT_PLUGINS -DHAVE_BUILD_INFO -DWIN32 -D_MT -DQT_THREAD_SUPPORT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I'../../staging32/include/QtCore' -I'../../staging32/include/QtNetwork' -I'../../staging32/include/QtGui' -I'../../staging32/include' -I'../../staging32' -I'src' -I'src/json' -I'src/qt' -I'../../staging32' -I'../../staging32' -I'../../staging32' -I'../../staging32' -I'../../staging32' -I'../../staging32/include/ActiveQt' -I'build' -I'build' -I'../../staging32/mkspecs/unsupported/win32-g++-cross' -o build/moc_qrcodedialog.o build/moc_qrcodedialog.cpp
i686-w64-mingw32-g++ -c -frandom-seed=cachecoin -D_FORTIFY_SOURCE=2 -msse2 -O2 -frtti -fexceptions -fdiagnostics-show-option -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter -Wstack-protector -DBOOST_THREAD_USE_LIB -DQT_GUI -DBOOST_THREAD_USE_LIB -DBOOST_SPIRIT_THREADSAFE -DBOOST_THREAD_PROVIDES_GENERIC_SHARED_MUTEX_ON_WIN -D__NO_SYSTEM_INCLUDES -DSCRYPT_CHACHA -DSCRYPT_KECCAK512 -DUSE_QRCODE -DUSE_UPNP=1 -DSTATICLIB -DUSE_IPV6=1 -DCACHECOIN_NEED_QT_PLUGINS -DHAVE_BUILD_INFO -DWIN32 -D_MT -DQT_THREAD_SUPPORT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I'../../staging32/include/QtCore' -I'../../staging32/include/QtNetwork' -I'../../staging32/include/QtGui' -I'../../staging32/include' -I'../../staging32' -I'src' -I'src/json' -I'src/qt' -I'../../staging32' -I'../../staging32' -I'../../staging32' -I'../../staging32' -I'../../staging32' -I'../../staging32/include/ActiveQt' -I'build' -I'build' -I'../../staging32/mkspecs/unsupported/win32-g++-cross' -o build/qrc_cachecoin.o release/qrc_cachecoin.cpp
i686-w64-mingw32-g++ -Wl,--dynamicbase -Wl,--nxcompat -Wl,--large-address-aware -static-libgcc -static-libstdc++ -Wl,-s -lmingwthrd -Wl,-subsystem,windows -o release/cachecoin-qt.exe object_script.cachecoin-qt.Release -L'/home/ubuntu/staging32/lib' -lmingwthrd -lmingw32 -lqtmain build/cachecoin-qt_res.o -lqrencode -L/home/ubuntu/staging32 -lminiupnpc -liphlpapi -L/home/ubuntu/staging32 -L/home/ubuntu/staging32 -L/home/ubuntu/staging32 -L/home/ubuntu/staging32 -ldb_cxx -lshlwapi -lmswsock -lcrypt32 -lboost_system-mt-s -lboost_filesystem-mt-s -lboost_program_options-mt-s -lboost_thread_win32-mt-s -lboost_chrono-mt-s -L/home/ubuntu/staging32/plugins/codecs -lqcncodecs -lqjpcodecs -lqtwcodecs -lqkrcodecs -L/home/ubuntu/staging32/plugins/accessible -lqtaccessiblewidgets -lQtGui -lQtNetwork -lcomdlg32 -loleaut32 -limm32 -lwinmm -lwinspool -lmsimg32 -lQtCore -L/home/ubuntu/deps32/lib -lssl -lcrypto -lgdi32 -lole32 -luuid -lws2_32 -ladvapi32 -lshell32 -luser32 -lkernel32
/home/ubuntu/staging32/lib/libcrypto.a(e_capi.o):e_capi.c:(.text+0x1ff): undefined reference to `__imp__CertFreeCertificateContext#4'
/home/ubuntu/staging32/lib/libcrypto.a(e_capi.o):e_capi.c:(.text+0x27f): undefined reference to `__imp__CertFreeCertificateContext#4'
/home/ubuntu/staging32/lib/libcrypto.a(e_capi.o):e_capi.c:(.text+0xbf8): undefined reference to `__imp__CertGetCertificateContextProperty#16'
/home/ubuntu/staging32/lib/libcrypto.a(e_capi.o):e_capi.c:(.text+0x20f6): undefined reference to `__imp__CertOpenStore#20'
/home/ubuntu/staging32/lib/libcrypto.a(e_capi.o):e_capi.c:(.text+0x212d): undefined reference to `__imp__CertEnumCertificatesInStore#8'
/home/ubuntu/staging32/lib/libcrypto.a(e_capi.o):e_capi.c:(.text+0x2208): undefined reference to `__imp__CertDuplicateCertificateContext#4'
/home/ubuntu/staging32/lib/libcrypto.a(e_capi.o):e_capi.c:(.text+0x2291): undefined reference to `__imp__CertCloseStore#8'
/home/ubuntu/staging32/lib/libcrypto.a(e_capi.o):e_capi.c:(.text+0x23c6): undefined reference to `__imp__CertFreeCertificateContext#4'
/home/ubuntu/staging32/lib/libcrypto.a(e_capi.o):e_capi.c:(.text+0x2648): undefined reference to `__imp__CertGetCertificateContextProperty#16'
/home/ubuntu/staging32/lib/libcrypto.a(e_capi.o):e_capi.c:(.text+0x27cc): undefined reference to `__imp__CertGetCertificateContextProperty#16'
/home/ubuntu/staging32/lib/libcrypto.a(e_capi.o):e_capi.c:(.text+0x2bc9): undefined reference to `__imp__CertOpenStore#20'
/home/ubuntu/staging32/lib/libcrypto.a(e_capi.o):e_capi.c:(.text+0x2ce2): undefined reference to `__imp__CertOpenStore#20'
/home/ubuntu/staging32/lib/libcrypto.a(e_capi.o):e_capi.c:(.text+0x2d4d): undefined reference to `__imp__CertFindCertificateInStore#24'
/home/ubuntu/staging32/lib/libcrypto.a(e_capi.o):e_capi.c:(.text+0x2d7d): undefined reference to `__imp__CertFreeCertificateContext#4'
/home/ubuntu/staging32/lib/libcrypto.a(e_capi.o):e_capi.c:(.text+0x2d94): undefined reference to `__imp__CertCloseStore#8'
/home/ubuntu/staging32/lib/libcrypto.a(e_capi.o):e_capi.c:(.text+0x2db3): undefined reference to `__imp__CertEnumCertificatesInStore#8'
/home/ubuntu/staging32/lib/libcrypto.a(e_capi.o):e_capi.c:(.text+0x2e25): undefined reference to `__imp__CertEnumCertificatesInStore#8'
/home/ubuntu/staging32/lib/libcrypto.a(e_capi.o):e_capi.c:(.text+0x3777): undefined reference to `__imp__CertOpenStore#20'
/home/ubuntu/staging32/lib/libcrypto.a(e_capi.o):e_capi.c:(.text+0x37a8): undefined reference to `__imp__CertCloseStore#8'
/home/ubuntu/staging32/lib/libcrypto.a(e_capi.o):e_capi.c:(.text+0x3829): undefined reference to `__imp__CertEnumCertificatesInStore#8'
/home/ubuntu/staging32/lib/libcrypto.a(e_capi.o):e_capi.c:(.text+0x388d): undefined reference to `__imp__CertFreeCertificateContext#4'
/home/ubuntu/staging32/lib/libcrypto.a(e_capi.o):e_capi.c:(.text+0x38c9): undefined reference to `__imp__CertFindCertificateInStore#24'
/home/ubuntu/staging32/lib/libcrypto.a(e_capi.o):e_capi.c:(.text+0x39ef): undefined reference to `__imp__CertFreeCertificateContext#4'
/home/ubuntu/staging32/lib/libcrypto.a(e_capi.o):e_capi.c:(.text+0x3a9b): undefined reference to `__imp__CertFreeCertificateContext#4'
collect2: ld returned 1 exit status
make[1]: *** [release/cachecoin-qt.exe] Error 1
make[1]: Leaving directory `/home/ubuntu/build32/distsrc'
make: *** [release] Error 2
Any ideas?
(I'd rather post ask in the comments first, but I don't have enough reputation yet.)
Judging purely from your post (I haven't tried compiling the program myself), it could be one of these three issues:
wrong order of libraries in the command line (try appending one more -lcrypt32 to it)
the import libraries provided by your mingw-w64 packages are incomplete (you can use nm libcrypt32.a | grep ' T ' to check)
the functions are imported incorrectly (dllimport vs. dllexport vs. undecorated, calling conventions, ...)
After examining the error log once more, I'm inclined to believe it's the first option, as libcrypto seems to be importing functions from libcrypt32, but -lcrypto is almost at the end of the command line and it's not followed by any -lcrypt32.

undefined reference to `utf8_nextCharSafeBody_48' icu4c while building a library

I have tried to build the stmd library (http://getassoc.cs.nii.ac.jp/package/stmd-1.1.5.tar.gz) on Ubuntu 12.04.2 amd64 which use the ICU library.
I have installed libicu-dev (version: 48) from Ubuntu repository and using the following configuration.
./configure --with-icu-config=/usr/bin/icu-config --with-defaultstemmer=SNOWBALL --enable-snowball=yes --enable-kill3number=yes
and then,
make
I got the following errors..
/bin/bash ./libtool --mode=link g++ -I. -g -O2 -Wall -Wno-parentheses -Wdeclaration-after- statement -g -O -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 '-DDEFAULT_STEMMER=SNOWBALL' '-DSTMD_MYSTEMMER_DIR="/usr/local/bin"' -g -Wall -O2 -Wall -ansi -pedantic -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -Wno-long-long -D_REENTRANT -I/usr/include '-DUSE_SNOWBALL=1' -I/usr/local/include -DKILL3NUMBER=1 -L/usr/lib -ldl -lm -L/usr/lib -licui18n -licuuc -licudata -ldl -lm -L/usr/local/lib -o stmd stmd.o stmc.o sigflg.o nio.o -L. -L/usr/lib -ldl -lm -L/usr/lib -licui18n -licuuc -licudata -ldl -lm -L/usr/local/lib -lystem -lstemmer -lexpat -ldl
libtool: link: g++ -I. -g -O2 -Wall -Wno-parentheses -Wdeclaration-after-statement -g -O -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -DDEFAULT_STEMMER=SNOWBALL -DSTMD_MYSTEMMER_DIR=\"/usr/local/bin\" -g -Wall -O2 -Wall -ansi -pedantic -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -Wno-long-long -D_REENTRANT -I/usr/include -DUSE_SNOWBALL=1 -I/usr/local/include -DKILL3NUMBER=1 -o stmd stmd.o stmc.o sigflg.o nio.o -L/usr/lib -L/usr/local/lib -L/home/kobkrit/stmd-1.1.5 -licui18n -licuuc -licudata -lm -lystem -lstemmer /usr/lib/x86_64-linux-gnu/libexpat.so -ldl
/home/kobkrit/stmd-1.1.5/libystem.a(normalizer.o): In function `utf8toutf16':
/home/kobkrit/stmd-1.1.5/normalizer.c:177: undefined reference to `utf8_nextCharSafeBody_48'
/home/kobkrit/stmd-1.1.5/normalizer.c:191: undefined reference to `u_errorName_48'
/home/kobkrit/stmd-1.1.5/libystem.a(normalizer.o): In function `utf16toutf8':
/home/kobkrit/stmd-1.1.5/normalizer.c:227: undefined reference to `u_errorName_48'
/home/kobkrit/stmd-1.1.5/normalizer.c:219: undefined reference to `utf8_appendCharSafeBody_48'
/home/kobkrit/stmd-1.1.5/normalizer.c:223: undefined reference to `utf8_appendCharSafeBody_48'
/home/kobkrit/stmd-1.1.5/libystem.a(normalizer.o): In function `normalizer_sparse_tostr':
/home/kobkrit/stmd-1.1.5/normalizer.c:125: undefined reference to `unorm_normalize_48'
/home/kobkrit/stmd-1.1.5/normalizer.c:138: undefined reference to `unorm_normalize_48'
/home/kobkrit/stmd-1.1.5/normalizer.c:140: undefined reference to `u_errorName_48'
/home/kobkrit/stmd-1.1.5/libystem.a(ngram.o): In function `nextchar':
/home/kobkrit/stmd-1.1.5/ngram.c:158: undefined reference to `utf8_nextCharSafeBody_48'
/home/kobkrit/stmd-1.1.5/ngram.c:150: undefined reference to `utf8_nextCharSafeBody_48'
/home/kobkrit/stmd-1.1.5/libystem.a(ngram.o): In function `ng_output':
/home/kobkrit/stmd-1.1.5/ngram.c:182: undefined reference to `utf8_appendCharSafeBody_48'
collect2: ld returned 1 exit status
make: *** [stmd] Error 1
It seems about the problem between linker to ICU library, so I take a look on Makefile, I found
...
CFLAGS+=$(shell /usr/bin/icu-config --cflags)
CFLAGS+=$(shell /usr/bin/icu-config --cppflags)
LDFLAGS+=$(shell /usr/bin/icu-config --ldflags-searchpath)
LDFLAGS+=$(shell /usr/bin/icu-config --ldflags)
...
(I don't quite sure, does it relate to the problem or not?)
I tried build the stmd library on Ubuntu 10.04.4 LTS amd64 and it went fine and work perfectly. But sadly my server's hardware is not compatible with the old Ubuntu. Please help.
Your command line:
g++ ... -licui18n -licuuc -licudata -ldl -lm ... -o stmd stmd.o stmc.o ...
is incorrect: the order of object files and libraries on command line matters.