[odb-users] using ODB with cross-compiler x86_64-linux-gnu -> i686-w64-mingw

Sten Kultakangas ratkaisut at gmail.com
Sun Oct 9 00:39:50 EDT 2016


Hello

I have built ODB to be used with the cross-compiler, however, ODB
doesn't seem to pass the required parameters to the g++ plugin
interface. I have checked that
/i686-w64-mingw32/lib/gcc/i686-w64-mingw32/6.2.0/plugin/i686-w64-mingw32-odb.so
is actually ELF file, not MZ.

Another possibility is that the plugin interface in gcc 6.2.0 is broken.

BTW i had to make a symbolic link from the original odb.so file to
i686-w64-mingw32-odb.so
Until that it reported error "no ODB plugin in GCC plugin directory"
despite the --program-prefix configuration option. Also i had to make
some changes before i managed to compile it with gcc 6.2.0. Namely it
plugin API had somewhat changed and coretypes.h must not anymore be
included directly with C-linkage but rather gcc-plugin.h must be
included instead. Also ANON_AGGRNAME_P is not a valid symbol anymore
but rather anon_aggrname_p shall be used. Also there where a conflict
between toupper, tolower etc macros with the corresponding STL class
member functions so i had to #undef them before #include <ostream>.
Also i had to change new_node<array> to new_node<semantics::array> in
parser.cxx. But it's a different story


In the end of this email you will find the output of the readelf tool.
Here's the output of the ODB:


user at chronoscepter:~/workspace/ICCBackend$
/i686-w64-mingw32/bin/i686-w64-mingw32-odb -v --database mssql --std
c++11 --profile boost/date-time/posix-time --generate-query
-DPRODUCT_ID=1  --output-dir generated iCCSettings_model.h
Profile search paths:
 /i686-w64-mingw32/lib/gcc/i686-w64-mingw32/6.2.0/include/c++
 /i686-w64-mingw32/lib/gcc/i686-w64-mingw32/6.2.0/include/c++/i686-w64-mingw32
 /i686-w64-mingw32/lib/gcc/i686-w64-mingw32/6.2.0/include/c++/backward
 /i686-w64-mingw32/lib/gcc/i686-w64-mingw32/6.2.0/include
 /i686-w64-mingw32//include
 /i686-w64-mingw32/lib/gcc/i686-w64-mingw32/6.2.0/include-fixed
 /i686-w64-mingw32/lib/gcc/i686-w64-mingw32/6.2.0/../../../../i686-w64-mingw32/include
Compiling iCCSettings_model.h
i686-w64-mingw32-g++ -x c++ -std=gnu++0x -S -Wunknown-pragmas
-Wno-deprecated
-fplugin=/i686-w64-mingw32/lib/gcc/i686-w64-mingw32/6.2.0/plugin/i686-w64-mingw32-odb.so
-v -DPRODUCT_ID=1
-fplugin-arg-odb-svc-path=/i686-w64-mingw32/lib/gcc/i686-w64-mingw32/6.2.0/include/c++
-fplugin-arg-odb-svc-path=/i686-w64-mingw32/lib/gcc/i686-w64-mingw32/6.2.0/include/c++/i686-w64-mingw32
-fplugin-arg-odb-svc-path=/i686-w64-mingw32/lib/gcc/i686-w64-mingw32/6.2.0/include/c++/backward
-fplugin-arg-odb-svc-path=/i686-w64-mingw32/lib/gcc/i686-w64-mingw32/6.2.0/include
-fplugin-arg-odb-svc-path=/i686-w64-mingw32//include
-fplugin-arg-odb-svc-path=/i686-w64-mingw32/lib/gcc/i686-w64-mingw32/6.2.0/include-fixed
-fplugin-arg-odb-svc-path=/i686-w64-mingw32/lib/gcc/i686-w64-mingw32/6.2.0/../../../../i686-w64-mingw32/include
-DODB_COMPILER -DODB_COMPILER_VERSION=2040000 -DODB_DATABASE_MSSQL
-fplugin-arg-odb-database=mssql -fplugin-arg-odb-std=c++11
-fplugin-arg-odb-profile=boost/date-time/posix-time
-fplugin-arg-odb-generate-query -fplugin-arg-odb-output-dir=generated
-fplugin-arg-odb-svc-file=iCCSettings_model.h -
Using built-in specs.
COLLECT_GCC=i686-w64-mingw32-g++
Target: i686-w64-mingw32
Configured with: ../gcc-6.2.0/configure --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=i686-w64-mingw32
--prefix=/i686-w64-mingw32 --with-sysroot=/i686-w64-mingw32
--disable-multilib --enable-languages=c,c++ --enable-lto --with-dwarf2
--enable-fully-dynamic-string --enable-version-specific-runtime-libs
--enable-libgomp --disable-nls --enable-checking=release
--disable-win32-registry --disable-libgcj --with-local-prefix=/
--enable-plugin --enable-threads=win32 --enable-__cxa_atexit
--enable-default-ssp --disable-shared --enable-static
Thread model: win32
gcc version 6.2.0 (GCC)
COLLECT_GCC_OPTIONS='-std=gnu++11' '-S' '-Wunknown-pragmas'
'-Wno-deprecated'
'-fplugin=/i686-w64-mingw32/lib/gcc/i686-w64-mingw32/6.2.0/plugin/i686-w64-mingw32-odb.so'
'-v' '-D' 'PRODUCT_ID=1'
'-fplugin-arg-odb-svc-path=/i686-w64-mingw32/lib/gcc/i686-w64-mingw32/6.2.0/include/c++'
'-fplugin-arg-odb-svc-path=/i686-w64-mingw32/lib/gcc/i686-w64-mingw32/6.2.0/include/c++/i686-w64-mingw32'
'-fplugin-arg-odb-svc-path=/i686-w64-mingw32/lib/gcc/i686-w64-mingw32/6.2.0/include/c++/backward'
'-fplugin-arg-odb-svc-path=/i686-w64-mingw32/lib/gcc/i686-w64-mingw32/6.2.0/include'
'-fplugin-arg-odb-svc-path=/i686-w64-mingw32//include'
'-fplugin-arg-odb-svc-path=/i686-w64-mingw32/lib/gcc/i686-w64-mingw32/6.2.0/include-fixed'
'-fplugin-arg-odb-svc-path=/i686-w64-mingw32/lib/gcc/i686-w64-mingw32/6.2.0/../../../../i686-w64-mingw32/include'
'-D' 'ODB_COMPILER' '-D' 'ODB_COMPILER_VERSION=2040000' '-D'
'ODB_DATABASE_MSSQL' '-fplugin-arg-odb-database=mssql'
'-fplugin-arg-odb-std=c++11'
'-fplugin-arg-odb-profile=boost/date-time/posix-time'
'-fplugin-arg-odb-generate-query'
'-fplugin-arg-odb-output-dir=generated'
'-fplugin-arg-odb-svc-file=iCCSettings_model.h' '-mtune=generic'
'-march=pentiumpro'
 /i686-w64-mingw32/libexec/gcc/i686-w64-mingw32/6.2.0/cc1plus -quiet
-v -iplugindir=/i686-w64-mingw32/lib/gcc/i686-w64-mingw32/6.2.0/plugin
-U_REENTRANT -D PRODUCT_ID=1 -D ODB_COMPILER -D
ODB_COMPILER_VERSION=2040000 -D ODB_DATABASE_MSSQL -
-iplugindir=/i686-w64-mingw32/lib/gcc/i686-w64-mingw32/6.2.0/plugin
-quiet -dumpbase - -mtune=generic -march=pentiumpro -auxbase -
-Wunknown-pragmas -Wno-deprecated -std=gnu++11 -version
-fplugin=/i686-w64-mingw32/lib/gcc/i686-w64-mingw32/6.2.0/plugin/i686-w64-mingw32-odb.so
-fplugin-arg-odb-svc-path=/i686-w64-mingw32/lib/gcc/i686-w64-mingw32/6.2.0/include/c++
-fplugin-arg-odb-svc-path=/i686-w64-mingw32/lib/gcc/i686-w64-mingw32/6.2.0/include/c++/i686-w64-mingw32
-fplugin-arg-odb-svc-path=/i686-w64-mingw32/lib/gcc/i686-w64-mingw32/6.2.0/include/c++/backward
-fplugin-arg-odb-svc-path=/i686-w64-mingw32/lib/gcc/i686-w64-mingw32/6.2.0/include
-fplugin-arg-odb-svc-path=/i686-w64-mingw32//include
-fplugin-arg-odb-svc-path=/i686-w64-mingw32/lib/gcc/i686-w64-mingw32/6.2.0/include-fixed
-fplugin-arg-odb-svc-path=/i686-w64-mingw32/lib/gcc/i686-w64-mingw32/6.2.0/../../../../i686-w64-mingw32/include
-fplugin-arg-odb-database=mssql -fplugin-arg-odb-std=c++11
-fplugin-arg-odb-profile=boost/date-time/posix-time
-fplugin-arg-odb-generate-query -fplugin-arg-odb-output-dir=generated
-fplugin-arg-odb-svc-file=iCCSettings_model.h -o -.s
cc1plus: error: plugin odb should be specified before
-fplugin-arg-odb-svc-path=/i686-w64-mingw32/lib/gcc/i686-w64-mingw32/6.2.0/include/c++
in the command line
cc1plus: error: plugin odb should be specified before
-fplugin-arg-odb-svc-path=/i686-w64-mingw32/lib/gcc/i686-w64-mingw32/6.2.0/include/c++/i686-w64-mingw32
in the command line
cc1plus: error: plugin odb should be specified before
-fplugin-arg-odb-svc-path=/i686-w64-mingw32/lib/gcc/i686-w64-mingw32/6.2.0/include/c++/backward
in the command line
cc1plus: error: plugin odb should be specified before
-fplugin-arg-odb-svc-path=/i686-w64-mingw32/lib/gcc/i686-w64-mingw32/6.2.0/include
in the command line
cc1plus: error: plugin odb should be specified before
-fplugin-arg-odb-svc-path=/i686-w64-mingw32//include in the command
line
cc1plus: error: plugin odb should be specified before
-fplugin-arg-odb-svc-path=/i686-w64-mingw32/lib/gcc/i686-w64-mingw32/6.2.0/include-fixed
in the command line
cc1plus: error: plugin odb should be specified before
-fplugin-arg-odb-svc-path=/i686-w64-mingw32/lib/gcc/i686-w64-mingw32/6.2.0/../../../../i686-w64-mingw32/include
in the command line
cc1plus: error: plugin odb should be specified before
-fplugin-arg-odb-database=mssql in the command line
cc1plus: error: plugin odb should be specified before
-fplugin-arg-odb-std=c++11 in the command line
cc1plus: error: plugin odb should be specified before
-fplugin-arg-odb-profile=boost/date-time/posix-time in the command
line
cc1plus: error: plugin odb should be specified before
-fplugin-arg-odb-generate-query in the command line
cc1plus: error: plugin odb should be specified before
-fplugin-arg-odb-output-dir=generated in the command line
cc1plus: error: plugin odb should be specified before
-fplugin-arg-odb-svc-file=iCCSettings_model.h in the command line
cc1plus: plugin.cxx:348: int plugin_init(plugin_name_args*,
plugin_gcc_version*): Assertion `ops.database_specified ()' failed.
(null):0: confused by earlier errors, bailing out



Here's the output of the readelf tool. BTW all the mentioned DLLs are
valid host platform dlls, they are not target platform binaries of
course.


user at chronoscepter:/i686-w64-mingw32/lib/gcc/i686-w64-mingw32/6.2.0/plugin$
readelf -d i686-w64-mingw32-odb.so Is it possible that the problem is
because of "Library soname" which is different from the filename ?

Dynamic section at offset 0x6e8f68 contains 28 entries:
  Tag        Type                         Name/Value
 0x0000000000000001 (NEEDED)             Shared library: [libcutl-1.10.so]
 0x0000000000000001 (NEEDED)             Shared library: [libstdc++.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libgcc_s.so.1]
 0x000000000000000e (SONAME)             Library soname: [odb.so]
 0x000000000000000c (INIT)               0x250d98
 0x000000000000000d (FINI)               0x54bde8
 0x0000000000000019 (INIT_ARRAY)         0x818c30
 0x000000000000001b (INIT_ARRAYSZ)       792 (bytes)
 0x000000000000001a (FINI_ARRAY)         0x818f48
 0x000000000000001c (FINI_ARRAYSZ)       8 (bytes)
 0x000000006ffffef5 (GNU_HASH)           0x1f0
 0x0000000000000005 (STRTAB)             0x573c0
 0x0000000000000006 (SYMTAB)             0x14e38
 0x000000000000000a (STRSZ)              727718 (bytes)
 0x000000000000000b (SYMENT)             24 (bytes)
 0x0000000000000003 (PLTGOT)             0x8ed000
 0x0000000000000002 (PLTRELSZ)           54312 (bytes)
 0x0000000000000014 (PLTREL)             RELA
 0x0000000000000017 (JMPREL)             0x243970
 0x0000000000000007 (RELA)               0x10e7f0
 0x0000000000000008 (RELASZ)             1266048 (bytes)
 0x0000000000000009 (RELAENT)            24 (bytes)
 0x000000006ffffffe (VERNEED)            0x10e6e0
 0x000000006fffffff (VERNEEDNUM)         3
 0x000000006ffffff0 (VERSYM)             0x108e66
 0x000000006ffffff9 (RELACOUNT)          8587
 0x0000000000000000 (NULL)               0x0



Best regards,
Sten Kultakangas



More information about the odb-users mailing list