std::stringstream
classes (see bug#779)
dpkg-shlibdeps: warning: symbol XXX used by libfoo.so.0 found in none of the libraries.
libfoo.so.0
uses the symbol XXX
, but this symbol was not found in dependencies for this library. It looks like there is a dependency chain A → B → C, where A (libfoo
) uses symbols from C. In this case introducing a new direct dependency A → C will fix the warning.
-fPIC
readelf
from binutils
package outputs TEXTREL
section, then some code was compiled without -fPIC
:
$ readelf -d libtest.so | grep TEXTREL 0x00000016 (TEXTREL) 0x0
Run eu-findtextrel
from elfutils
to see the violating symbols and pipe to scanelf
from pax-utils
to find library containing that symbol:
$ eu-findtextrel libtest.so | sort -u | perl -ne 'while (<>) { while (/the function \x27(\w+)\x27/g) { print "$1\n"} }' | while read i; do scanelf -l -A -s $i | grep $i; done
References:
-Wl,--as-needed
flags causes unresolved symbols #ifdef __cplusplus extern "C" #endif char pnm_readpnminit(); int main() { return pnm_readpnminit(); }
the following error is produced:
# g++ -o conftest -g -Wl,--as-needed conftest_orig.cpp -lnetpbm -lm /usr/lib64/libnetpbm.so: undefined reference to `log' /usr/lib64/libnetpbm.so: undefined reference to `pow' collect2: ld returned 1 exit status
-Wl,--as-needed
the linker will ignore all libraries, from which no symbols are used by current module. -lm
was ignored and that caused the mentioned error message.libm
. However it does not.libnetpbm.so
is correctly linked, -Wl,--as-needed
will not break the test anymore (and one don't need to pass -lm
).See also DSO Linking.
pkg-config is much superior to libtool, since libtool includes all the libraries on dynamic links as well, which creates unwanted shared library dependencies and causes other problems. pkg-config has some intelligence, i.e. if you request two libs at once it will nuke duplicate flags and order the -l
flags properly. Also, it can gripe about missing dependencies or conflicting libraries. Note that pkg-config merges at query-time: if gtk+.pc
file contains CFLAGS
that are specific to that library, pkg-config –cflags gtk+
also outputs CFLAGS
for all dependencies of gtk+
.
See also:
ln -s `g++ -print-file-name=libstdc++.a` g++ -static-libgcc -L. -o example example.cpp
Get package: XXX download failed
C:\MinGW\bin\mingw-get.exe: *** ERROR *** Get package: http://prdownloads.sourceforge.net/mingw/openssl-1.0.0-1-msys-1.0.13-bin.tar.lzma?download: download failed C:\MinGW\bin\mingw-get.exe: *** ERROR *** Get package: http://prdownloads.sourceforge.net/mingw/libiconv-1.13.1-1-mingw32-dll-2.tar.lzma?download: download failed
mingw-get.exe install libiconv mingw-get.exe install msys-openssl
CYGWIN
and and mingw use MINGW32
.
So the conditional check for any other Win32 compiler will be:
#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__MINGW32__) #include <windows.h> #endif
java.lang.UnsatisfiedLinkError
? $ g++ -shared cpp_wrap.o -o libmy_java.so $ nm libcrfpp_java.so | grep CRFPPJNI_VERSION 64303a43 T _Java_org_chasen_crfpp_CRFPPJNI_VERSION_1get@8
What should I do to remove @n
(e.g. get _Java_org_chasen_crfpp_CRFPPJNI_VERSION_1get
)?
Calling Convention | Internal | MSVC DLL (w/ DEF) | MSVC DLL (dllexport) | DMC DLL | MinGW DLL | BCC DLL |
---|---|---|---|---|---|---|
__stdcall | _function@n | function | _function@n | _function@n | function@n | function |
__cdecl | _function | function | function | function | function | _function |
so you need to use cdecl
in function declaration:
instead of
stdcall
#ifdef __MINGW32__ #define JNICALL __cdecl #endif
On the other hand, the options -Wl,–add-stdcall-alias
and -Wl,–kill-at
should work just fine, but they don't in some cases.
jni_md.h
refers the __int64
type, which is unknwon for GCC compiler #if defined(__GNUC__) && !defined(__INTEL_COMPILER) typedef long long __int64; #endif #include <jni.h>
or use gcc -D__int64="long long" ...
(check Generating .dll files for JNI under Windows/Cygwin/GCC and Building w32 JNI DLLs with gcc)
g++ -dD -E -I... source.cpp
.
V = 0 CC_0 := @echo -t "Compiling $<..."; $(CC) CC_1 := $(CC) CC = $(CC_$(V)) %.o: %.c $(CC) $(CFLAGS) -c $< -o $@
Afterwards make V=0 …
will do the job.
gdb
print
command? ~/.gdb/libstdcxx_printers
: cd ~/.gdb && svn co http://gcc.gnu.org/svn/gcc/trunk/libstdc++-v3/python libstdcxx_printers
~/.gdbinit
: python import sys, os sys.path.insert(0, os.path.expanduser('~/.gdb/libstdcxx_printers')) from libstdcxx.v6.printers import register_libstdcxx_printers register_libstdcxx_printers(None) end
"Девица не хочет лезть в Окно" – device not compatible with Windows.