Discussion:
[odb-users] libc++abi.dylib: terminating with uncaught foreign exception
Adnan RIHAN
2014-10-13 22:38:47 UTC
Permalink
Hi there,
QSharedPointer<Object>    obj1(new Object(...));
QSharedPointer<Object>    obj2(obj1);
return (obj1 == obj2);
by
QSharedPointer<Object>    obj1(new Object(...));
QSharedPointer<Object>    obj2(obj1);
return (*obj1->data() == *obj2->data());
The thing strange is that QSharedPointer::operator==() checks if the internal pointers are the same. But I don’t remember why, changing to the 2nd block (which is what I wanted because my Object::operator==() really checks the equality) removed the runtime error.
---------------------
Today I’m in another situation, the “uncaught” exception is now “uncaught foreign exception” and I can’t find an exception related to “foreign keys”.
[...] // Some Qt’s headers
# include   <odb/database.hxx>
# include   <odb/qt/list.hxx>
# include   <odb/session.hxx>
# include   <odb/transaction.hxx>
 
class EntityManager : public QObject
 {
    [...]
    template                        <typename T>
    QOdbList<QSharedPointer<T> >    all(void)
     {
         QOdbList<QSharedPointer<T> >    list;
 
         try {
             odb::session        s;
             odb::transaction    t(this->m_db->begin());
             qDebug() << "Before query”; // SHOWN
 **          odb::result<T>      r(this->m_db->query<T>()); 
             qDebug() << "After query”; // exception before this line
 
             for (typename odb::result<T>::iterator i(r.begin()); i != r.end(); ++i) {
                 list.append(QSharedPointer<T>(new T(*i)));
             }
 
             t.commit();
         } catch (const odb::exception &e) {
             qDebug() << "ODB Exception:" << e.what();
         }
 
         return (list);
     }
}
[...] // Some Qt’s headers
# include   <odb/core.hxx>
# include   "../AbstractModel.hpp"
# include   "../Product/Product.hpp"
class Offer : public AbstractModel
 {
     [...]
         quint8                     m_id;
         QSharedPointer<Product>    m_product;
         float                      m_price;
 }
odb --changelog apps/LGC/schemas/odb-changelog.xml -d sqlite -p qt -q -s --schema-name LGC -o apps/LGC/src/Models/Product apps/LGC/src/Models/Product/Product.hpp 2>&1
odb --changelog apps/LGC/schemas/odb-changelog.xml -d sqlite -p qt -q -s --schema-name LGC -o apps/LGC/src/Models/Offer apps/LGC/src/Models/Offer/Offer.hpp 2>&1
Any idea?
--
Cordialement, Adnan RIHAN.
Directeur-Gérant de Eolis-Software, société de services informatiques.

GPG: 5675-62BA (https://keybase.io/max13/key.asc)
-> Si vous n'utilisez pas GPG mais souhaitez quand même m’envoyer un e-mail chiffré: (https://encrypt.to/0x567562BA).
Adnan RIHAN
2014-10-13 23:29:20 UTC
Permalink
#   pragma  db  model                       version(1, 1, open)
 #   pragma  db  object(Offer)               table("offers")
 #   pragma  db  member(Offer::m_id)         id  auto
 #   pragma  db  member(Offer::m_product)    not_null    column("product_id") // The foreign key
 #   pragma  db  member(Offer::m_price)      not_null
 #   pragma  db  member(Offer::isDirty)      transient
DB is populated with example data.
--
Cordialement, Adnan RIHAN.
Directeur-Gérant de Eolis-Software, société de services informatiques.

GPG: 5675-62BA (https://keybase.io/max13/key.asc)
-> Si vous n’utilisez pas GPG mais souhaitez quand même m’envoyer un e-mail chiffré: (https://encrypt.to/0x567562BA).
Boris Kolpackov
2014-10-14 05:26:53 UTC
Permalink
Hi Adnan,
Post by Adnan RIHAN
Today I’m in another situation, the “uncaught” exception is now
“uncaught foreign exception” and I can’t find an exception related
to “foreign keys”.
catch (const odb::exception &e) {
qDebug() << "ODB Exception:" << e.what();
}
ODB doesn't have any exceptions that would return "uncaught foreign
exception" string. What is the *exact* text that is printed by the
above catch-block? Generally, when asking for help, always provide
the exact error messages, not your interpretation of them.

Boris
Adnan RIHAN
2014-10-14 05:47:27 UTC
Permalink
Hi Boris,
Post by Boris Kolpackov
ODB doesn't have any exceptions that would return "uncaught foreign
exception" string. What is the *exact* text that is printed by the
above catch-block? Generally, when asking for help, always provide
the exact error messages, not your interpretation of them.
Sorry it's not clear. Actually, the EXACT error message is the one in the subject (copy/past), and it wasn't caught by the catch block.
Instead, the program was terminated.
Post by Boris Kolpackov
qDebug() << "Before query”; // SHOWN
odb::result<T> r(this->m_db->query<T>());
qDebug() << "After query”; // exception before this line
"Before query" is shown, NOT "After query".
--
Cordialement, Adnan RIHAN.
Directeur-Gérant de Eolis-Software, société de services informatiques, Brazzaville.
$this->setMobile("+33 (0) 6 78 62 26 20");
Boris Kolpackov
2014-10-14 13:41:05 UTC
Permalink
Hi Adnan,
Post by Adnan RIHAN
Sorry it's not clear. Actually, the EXACT error message is the one in
the subject (copy/past), and it wasn't caught by the catch block.
Then this is not an ODB exception. I am not familiar with the
Apple toolchain to say what 'foreign' in that phrase means. So
I would suggest that you google for this error message and see
if it is a common/known problem.

Boris
Adnan RIHAN
2014-10-15 09:20:54 UTC
Permalink
Hi Boris,
So I would suggest that you google for this error message and see
if it is a common/known problem.
I tried before asking here. I can’t find anything, it’s often related to Obj-C codes.

What if I tell you that this exception (not even caught by std::exception) is raised ONLY when querying an object with relations (lazy or not). When I query an object with “id” and “name”, it works normally. Maybe I forgot to add something in the pragmas or else? Did you see something wrong or missing in my pragmas or something I could add?

Thank you for your help
--
Cordialement, Adnan RIHAN.
Directeur-Gérant de Eolis-Software, société de services informatiques.

GPG: 5675-62BA (https://keybase.io/max13/key.asc)
-> Si vous n'utilisez pas GPG mais souhaitez quand même m’envoyer un e-mail chiffré: (https://encrypt.to/0x567562BA).
Boris Kolpackov
2014-10-16 02:45:06 UTC
Permalink
Hi Adnan,
Post by Adnan RIHAN
What if I tell you that this exception (not even caught by std::exception)
is raised ONLY when querying an object with relations (lazy or not). When
I query an object with “id” and “name”, it works normally. Maybe I forgot
to add something in the pragmas or else? Did you see something wrong or
missing in my pragmas or something I could add?
Here is what I think happens:

You have built libodb* runtimes (libodb, libodb-sqlite, libodb-qt) with
GCC and you are building your application with Clang. How do I know you
are building it with Clang? Because the error is reported by libc++ and
that's Clang's C++ runtime; GCC runtime is called libstdc++ (you can
verify this by running otool -L on your executable and observing that
both of these libraries are loaded).

So what most likely happens is that the ODB runtime throws an exception
but it uses libstdc++'s implementation of exceptions, not libc++'s. As
a result, your application cannot catch it.

The easiest solution would be to rebuild the above ODB runtimes using
Clang instead of GCC. And don't try to rebuild the ODB compiler itself
with Clang, that should continue to use GCC. As the documentation states,
it is perfectly fine to use a C++ compiler other than GCC (Clang, VC++,
SunCC, etc) to build the ODB runtimes and your application.

Boris
Adnan RIHAN
2014-10-16 11:02:02 UTC
Permalink
 
Hi Boris,

Thank you for the advices.
Post by Boris Kolpackov
The easiest solution would be to rebuild the above ODB runtimes using
Clang instead of GCC.
I tried this already, I had undefined symbols (I’ve tried again today): http://codesynthesis.com/pipermail/odb-users/2014-September/002122.html
Post by Boris Kolpackov
As the documentation states, it is perfectly fine to use a C++ compiler other than GCC (Clang, VC++,
SunCC, etc) to build the ODB runtimes and your application.
This is strange because yes, the runtimes are built with GCC (4.9.1) and my app is built with clang. I’ve tried to build libodb* with GCC AND my app with GCC (actually, before writing this thread.

And I didn’t notice that Qt-Creator isn’t passing GCC path to qmake which fallbacks to Xcode gcc which is clang. I’ve modified by hand the makefiles to set the SAME GCC used to compile libodb, and now it works \o/ (No compilation issues, no runtime issues).

So, to summarize:
- ODB _must_ be compiled with GCC (Because of ODB core)
- libodb* _must_ be compiled with GCC (Or else, compilation errors, see above link)
- App _must_ be compiled with GCC (Or else, runtime error related to libc++abi)

Thanks for your unlimited help Boris. I was almost ready to write the queries myself because I needed to go forward... But ODB seems to be great when it’s correctly set-up, so as these problems are not “Adnan” related (only), I thought it may be a good idea to sort these out for eventual futur others.
--
Cordialement, Adnan RIHAN.
Directeur-Gérant de Eolis-Software, société de services informatiques.

GPG: 5675-62BA (https://keybase.io/max13/key.asc)
-> Si vous n'utilisez pas GPG mais souhaitez quand même m’envoyer un e-mail chiffré: (https://encrypt.to/0x567562BA).
Boris Kolpackov
2014-10-16 11:16:04 UTC
Permalink
Hi Adnan,
Post by Adnan RIHAN
I tried this already, I had undefined symbols (I’ve tried again
today): http://codesynthesis.com/pipermail/odb-users/2014-September/002122.html
Did you make sure that your application and the runtimes are both either
built in 32-bit or 64-bit mode? (-m32/-m64)?
Post by Adnan RIHAN
- ODB _must_ be compiled with GCC (Because of ODB core)
You mean the ODB compiler.
Post by Adnan RIHAN
- libodb* _must_ be compiled with GCC (Or else, compilation errors, see above link)
No, you should be able to build them (and your application) with Clang.
The fact that you weren't able to figure out why the Clang build fails
doesn't mean that everything "must" be built with GCC.
Post by Adnan RIHAN
- App _must_ be compiled with GCC (Or else, runtime error related to libc++abi)
Again, the only "must" here is that both the runtimes and your application
are built with the same compiler (and the same 32/64 bit mode).

Boris
Adnan RIHAN
2014-10-18 07:08:21 UTC
Permalink
Post by Boris Kolpackov
Post by Adnan RIHAN
- libodb* _must_ be compiled with GCC (Or else, compilation errors, see above link)
No, you should be able to build them (and your application) with Clang.
The fact that you weren't able to figure out why the Clang build fails
doesn't mean that everything "must" be built with GCC.
I was exposing MY situation, not in general. To make everything work in my
case, I have to start from a working state.
Post by Boris Kolpackov
Post by Adnan RIHAN
- App _must_ be compiled with GCC (Or else, runtime error related to libc++abi)
Here again, it’s MY case, I wasn’t meaning in general.

I have to admit that I need to go forward on my project, but I also want to
sort this out. I’ve tried many combination, without success. I could blame
Qt/Qt-Creator but the errors were related to sqlite.

I’ve even just tried to compile “hello” example by command line, using
Post by Boris Kolpackov
➜ hello pwd
/Users/Max13/Downloads/odb-examples-2.3.0/hello
➜ hello c++ -v
Apple LLVM version 6.0 (clang-600.0.51) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin13.4.0
Thread model: posix
➜ hello odb -d sqlite --generate-query --generate-schema person.hxx
➜ hello c++ -c person-odb.cxx
➜ hello c++ -DDATABASE_SQLITE -c driver.cxx
➜ hello c++ -o driver driver.o person-odb.o -lodb-sqlite -lodb
"odb::schema_catalog::create_schema(odb::database&,
std::__1::basic_string<char, std::__1::char_traits<char>,
Post by Boris Kolpackov
create_database(int&, char**) in driver.o
"odb::sqlite::query_base::append(std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> > const&)",
Post by Boris Kolpackov
odb::sqlite::query_base::operator+=(std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> > const&) in driver.o
Post by Boris Kolpackov
odb::sqlite::query_base::operator+=(std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> > const&) in
person-odb.o
"odb::sqlite::delete_statement::delete_statement(odb::sqlite::connection&,
std::__1::basic_string<char, std::__1::char_traits<char>,
std::__1::allocator<char> > const&, odb::sqlite::binding&)", referenced
Post by Boris Kolpackov
odb::access::object_traits_impl<person,
(odb::database_id)1>::erase_query(odb::database&, odb::sqlite::query_base
const&) in person-odb.o
"odb::sqlite::select_statement::select_statement(odb::sqlite::connection&,
std::__1::basic_string<char, std::__1::char_traits<char>,
std::__1::allocator<char> > const&, bool, bool, odb::sqlite::binding&,
Post by Boris Kolpackov
odb::access::object_traits_impl<person,
(odb::database_id)1>::query(odb::database&, odb::sqlite::query_base const&)
in person-odb.o
Post by Boris Kolpackov
odb::access::view_traits_impl<person_stat,
(odb::database_id)1>::query(odb::database&, odb::sqlite::query_base const&)
in person-odb.o
Post by Boris Kolpackov
"odb::sqlite::default_value_traits<std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> >,
(odb::sqlite::database_type_id)2>::set_image(odb::details::basic_buffer<char>&,
unsigned long&, bool&, std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> > const&)",
Post by Boris Kolpackov
odb::access::object_traits_impl<person,
(odb::database_id)1>::init(odb::access::object_traits_impl<person,
(odb::database_id)1>::image_type&, person const&,
odb::sqlite::statement_kind) in person-odb.o
Post by Boris Kolpackov
"odb::sqlite::database::print_usage(std::__1::basic_ostream<char,
create_database(int&, char**) in driver.o
"odb::sqlite::database::database(int&, char**, bool, int, bool,
std::__1::basic_string<char, std::__1::char_traits<char>,
std::__1::allocator<char> > const&,
odb::details::transfer_ptr<odb::sqlite::connection_factory>)", referenced
Post by Boris Kolpackov
create_database(int&, char**) in driver.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see
invocation)

Compiled with c++-4.9, no error.

Maybe it’s related to my system... The thing is that I’ve completely
reinstalled my system on 10.9 (Maverick), the only system “things” I’ve
reinstalled is Xcode, Qt (isolated) and homebrew (isolated but touches
$PATH).
I don’t know what could I check more...

While writing this email, something strange happened, the lib compiled with
GCC and my app with clang, no more runtime errors... I don't understand,
same code, same environment and no more libc++/glibc. So I got 2 ideas to
check to determine where it could come from:
1- Make a clean partition, install nothing on it but the required lib (gcc,
xcode, odb, libodb, ...) then try and log environment combinations (because
the libc++abi error shouldn't have disappeared)
2- Try with another db driver, because so far I've only tried libodb-sqlite.

Then I'll be back to you to keep you updated. Yosemite (10.10) is now final
and released, i'll also check on this system.

Thanks for your help.
--
Cordialement, Adnan RIHAN.
Directeur-Gérant de Eolis-Software, société de services informatiques.

GPG: 5675-62BA (https://keybase.io/max13/key.asc)
-> Si vous n'utilisez pas GPG mais souhaitez quand même m’envoyer un e-mail
chiffré: (https://encrypt.to/0x567562BA).
Boris Kolpackov
2014-10-20 11:58:53 UTC
Permalink
Hi Adnan,
I’ve even just tried to compile “hello” example by command line, using
➜ hello pwd
/Users/Max13/Downloads/odb-examples-2.3.0/hello
➜ hello c++ -v
Apple LLVM version 6.0 (clang-600.0.51) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin13.4.0
Thread model: posix
➜ hello odb -d sqlite --generate-query --generate-schema person.hxx
➜ hello c++ -c person-odb.cxx
➜ hello c++ -DDATABASE_SQLITE -c driver.cxx
➜ hello c++ -o driver driver.o person-odb.o -lodb-sqlite -lodb
[...]
Good. When you give me something like this I can actually go and try
to reproduce the problem. So here is what I have done:

1. Install command line tools.

One thing I could not do is first uninstall everything (e.g.,
get rid of /usr/bin/{clang,gcc,...} and /usr/include/*).
Apparently there is no way to do it. In particular, running
this did not remove those tools:

/Developer/Library/uninstall-devtools --mode=all

In any case, to make sure I have the latest stuff, I ran:

xcode-select --install

And it downloaded and installed something. After that, I got:

$ clang --version
Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin13.4.0

It looks like an even newer version than yours, so I am definitely
using the latest tools.

2. Then, for general undestanding, I compiled a test program called
sizeof_funds.cxx (attached) to see which mode (32/64) is the
default:

$ clang++ sizeof_funds.cxx
$ ./a.out
bool sizeof = 1 alignof = 1
wchar_t sizeof = 4 alignof = 4
short int sizeof = 2 alignof = 2
int sizeof = 4 alignof = 4
long int sizeof = 8 alignof = 8
long long int sizeof = 8 alignof = 8
float sizeof = 4 alignof = 4
double sizeof = 8 alignof = 8
long double sizeof = 16 alignof = 16
void* sizeof = 8 alignof = 8

$ clang++ -m32 sizeof_funds.cxx
$ ./a.out
bool sizeof = 1 alignof = 1
wchar_t sizeof = 4 alignof = 4
short int sizeof = 2 alignof = 2
int sizeof = 4 alignof = 4
long int sizeof = 4 alignof = 4
long long int sizeof = 8 alignof = 8
float sizeof = 4 alignof = 4
double sizeof = 8 alignof = 8
long double sizeof = 16 alignof = 16
void* sizeof = 4 alignof = 4

So, by default, clang generates 64-bit code (look at size of void*)
but you can request 32-bit with -m32.

3. Next I downloaded and unpacked these 4 ODB packages:

libodb-2.3.0.tar.bz2
libodb-sqlite-2.3.0.tar.bz2
odb-2.3.0-i686-macosx.tar.bz2
odb-examples-2.3.0.tar.bz2

Then I built and installed libodb and libodb-sqlite:

$ cd libodb-2.3.0
$ ./configure CC=clang CXX=clang++
$ make
$ sudo make install
$ cd ..

$ cd libodb-sqlite-2.3.0
$ ./configure CC=clang CXX=clang++
$ make
$ sudo make install
$ cd ..

Then I tried to build the hello example by hand, just like you did:

$ cd odb-examples-2.3.0/hello
$ ../../odb-2.3.0-i686-macosx/bin/odb -d sqlite -q -s person.hxx
clang++ -c person-odb.cxx
clang++ -DDATABASE_SQLITE -c driver.cxx
clang++ -o driver driver.o person-odb.o -lodb-mysql -lodb
clang++ -o driver driver.o person-odb.o -lodb-sqlite -lodb
$ ./driver
Hello, John Doe!
Hello, Jane Doe!

count : 3
min age: 31
max age: 33

So, for me, everything works pretty smoothly. Can you try these exact
steps and see if they work for you?
While writing this email, something strange happened, the lib compiled with
GCC and my app with clang, no more runtime errors... I don't understand,
same code, same environment and no more libc++/glibc.
This could work as long as the code doesn't throw an exception. It is
definitely a bad idea to mix those things, even if it appear to work
right now.

Boris
Adnan RIHAN
2014-10-23 10:55:18 UTC
Permalink
Hello !

So, I’ll try to reproduce everything with Yosemite on VM (Parallels Desktop) because as it’s final from few days, I will also try if it’s supported. If it’s not, I will revert to Maverick on the VM. So here as I start:

0. 1) Install Maverick from host recovery partition.
2) Copied "Install Yosemite.app” from host then installed it.
3) Copied XCode 6.0.1 from host and started it (to initialize, no CLT explicitly installed).
4) Updated Xcode from VM AppStore to 6.1 .
5) Problem with update detection with AppStore, removed and installed Xcode from VM AppStore.
MacBook-Pro-de-OSX:~ osx$ xcode-select -v
xcode-select version 2339.
MacBook-Pro-de-OSX:~ osx$ which clang
/usr/bin/clang
MacBook-Pro-de-OSX:~ osx$ clang --version
Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin14.0.0
Thread model: posix
1. Install command line tools.
One thing I could not do is first uninstall everything (e.g.,
get rid of /usr/bin/{clang,gcc,...} and /usr/include/*).
Apparently there is no way to do it. In particular, running
/Developer/Library/uninstall-devtools --mode=all
I don’t have this path, neither in /Applications/Xcode.app .
xcode-select --install
If Xcode is installed on your machine, then there is no need to install them. Xcode comes bundled with all your command-line tools. OS X 10.9 includes shims or wrapper executables. These shims, installed in /usr/bin, can map any tool included in /usr/bin to the corresponding one inside Xcode. xcrun is one of such shims, which allows you to find or run any tool inside Xcode from the command
line. Use it to invoke any tool within Xcode from the command line.

I still have installed them via `xcode-select --install`.
$ clang --version
Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin14.0.0
2. Then, for general undestanding, I compiled a test program called
sizeof_funds.cxx (attached) to see which mode (32/64) is the
So, by default, clang generates 64-bit code (look at size of void*)
but you can request 32-bit with -m32.
Same for me, without precising “-mXX” -> void* sizeof = 8 alignof = 8
libodb-2.3.0.tar.bz2
./configure CC=clang CXX=clang++ && make && sudo make install
OK
libodb-sqlite-2.3.0.tar.bz2
./configure CC=clang CXX=clang++ && make && sudo make install
OK
MacBook-Pro-de-OSX:hello osx$ pwd
/tmp/odb-examples-2.3.0/hello
MacBook-Pro-de-OSX:hello osx$ ../../odb-2.3.0-i686-macosx/bin/odb -d sqlite -q -s person.hxx
../../odb-2.3.0-i686-macosx/bin/odb: error: unable to extract profile paths
This error tells me that MAYBE yosemite has a problem. So I’ll try on my host “Maverick”.
----------
➜ local git:(master) pwd
/usr/local
➜ local git:(master) ls bin/ include/ lib/
perl5/
clang -v
Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin13.4.0
Thread model: posix
$ wget -O- -q http://www.codesynthesis.com/download/odb/2.3/libodb-2.3.0.tar.gz | tar -zx
$ cd libodb-2.3.0
$ ./configure CC=clang CXX=clang++
$ make && sudo make install
$ wget -O- -q http://www.codesynthesis.com/download/odb/2.3/libodb-sqlite-2.3.0.tar.gz | tar -zx
$ cd libodb-sqlite-2.3.0
$ ./configure CC=clang CXX=clang++
$ make && sudo make install
$ wget -O- -q http://www.codesynthesis.com/download/odb/2.3/odb-2.3.0-i686-macosx.tar.bz2 | tar -jx
These are OK.
$ wget -O- -q http://www.codesynthesis.com/download/odb/2.3/odb-examples-2.3.0.tar.gz | tar -zx
$ cd odb-examples-2.3.0/hello
$ ../../odb-2.3.0-i686-macosx/bin/odb -d sqlite -q -s person.hxx
clang++ -c person-odb.cxx
clang++ -DDATABASE_SQLITE -c driver.cxx
// clang++ -o driver driver.o person-odb.o -lodb-mysql -lodb // I haven’t done this one
clang++ -o driver driver.o person-odb.o -lodb-sqlite -lodb
$ ./driver
Hello, John Doe!
Hello, Jane Doe!
count : 3
min age: 31
max age: 33
Exact same output for me.
So, for me, everything works pretty smoothly. Can you try these exact
steps and see if they work for you?
It also works. -_-'
----------
My project had some compilation issues, but this thread was about an error got only while querying relationships.

So my idea will be to compile the models file, and the entire project to see what error I have.
$ pwd
/Users/Max13/Dev/System/LGC/Desktop/apps/LGC/src/Models/Category
$ cd Category
$ /tmp/odb-2.3.0-i686-macosx/bin/odb -x -F/Users/Max13/Qt/5.3/clang_64/lib -x -I/Users/Max13/Qt/5.3/clang_64/lib/QtCore.framework/Headers -x -I/usr/local/include -d sqlite -p qt -q -s Category.hpp
Category.xml: info: initializing changelog with base version 1
$ cd ../Provider
/tmp/odb-2.3.0-i686-macosx/bin/odb -x -F/Users/Max13/Qt/5.3/clang_64/lib -x -I/Users/Max13/Qt/5.3/clang_64/lib/QtCore.framework/Headers -x -I/usr/local/include -d sqlite -p qt -q -s Provider.hpp
Provider.xml: info: initializing changelog with base version 1
$ cd ../Product
/tmp/odb-2.3.0-i686-macosx/bin/odb -x -F/Users/Max13/Qt/5.3/clang_64/lib -x -I/Users/Max13/Qt/5.3/clang_64/lib/QtCore.framework/Headers -x -I/usr/local/include -d sqlite -p qt -q -s Product.hpp
Product.xml: info: initializing changelog with base version 1
      odb::access::object_traits_impl<Category, (odb::database_id)1>::erase_query(odb::database&, odb::sqlite::query_base const&) in Category-odb.o
      odb::access::object_traits_impl<Provider, (odb::database_id)1>::erase_query(odb::database&, odb::sqlite::query_base const&) in Provider-odb.o
      odb::access::object_traits_impl<Product, (odb::database_id)1>::erase_query(odb::database&, odb::sqlite::query_base const&) in Product-odb.o
      odb::access::object_traits_impl<Offer, (odb::database_id)1>::erase_query(odb::database&, odb::sqlite::query_base const&) in Offer-odb.o
      odb::access::object_traits_impl<Category, (odb::database_id)1>::query(odb::database&, odb::sqlite::query_base const&) in Category-odb.o
      odb::access::object_traits_impl<Provider, (odb::database_id)1>::query(odb::database&, odb::sqlite::query_base const&) in Provider-odb.o
      odb::access::object_traits_impl<Product, (odb::database_id)1>::query(odb::database&, odb::sqlite::query_base const&) in Product-odb.o
      odb::access::object_traits_impl<Offer, (odb::database_id)1>::query(odb::database&, odb::sqlite::query_base const&) in Offer-odb.o
      MasterController::checkEnv() in MasterController.o
ld: symbol(s) not found for architecture x86_64
From here, it seems to be project related. But, without touching my project, I’ve recompiled “libodb” + “libodb-sqlite” with gcc-4.9 (not by homebrew, but with CC and CXX flags) and by projects compiles normally without a single warning. In case of you could have an idea, I’ve attached my Category.hpp (one of the models, independent) and the generated files. I don’t attach the .cpp because it’s only getters and setters, no other calls.

Something still strange is that my project crashed because of this error, only when querying an object with relations. It crashed again today, I’ve recompiled the libs with gcc-4.9 and project with clang, it’s now working.

I think I’ll create another VM with Maverick and restart again the whole process with a sample project. I don’t understand ...
--
Cordialement, Adnan RIHAN.
Directeur-Gérant de Eolis-Software, société de services informatiques.

GPG: 5675-62BA (https://keybase.io/max13/key.asc)
-> Si vous n'utilisez pas GPG mais souhaitez quand même m’envoyer un e-mail chiffré: (https://encrypt.to/0x567562BA).
Boris Kolpackov
2014-10-25 05:58:40 UTC
Permalink
Hi Adnan,
../../odb-2.3.0-i686-macosx/bin/odb: error: unable to extract
profile paths
This error tells me that MAYBE yosemite has a problem. So I’ll
try on my host “Maverick”.
Yes, this looks like the same problem we had with the beta. I will
have to look into this when I get access to Yosemite.
Ok, so you have compiled the ODB runtimes and example with clang
and everything works fine. Then you tried to use the same runtime
builds from Qt-Creator and you got this linker error. To me this
sounds like Qt-Creator:

1. Either builds the project with another compiler. Maybe it uses
its own clang or gcc?

2. Or it builds using system clang but with some options that make
it incompatible with the default build of the ODB runtimes.

In either case we need to get the exact clang command line, with
the executable name and all the options, that is executed by
Qt-Creator. Ideally, I would like to see the complete list of
commands that Qt-Creator executes to build your project (i.e.,
both the C++ compilation and the link command that fails).

Boris
Christian Sell
2014-10-25 09:20:18 UTC
Permalink
hers what comes to my mind from recent painful experience:

- command line build links against libc++
- qt build links against libstdc++ (for reason of some OSX backwards
compatibility)

both libs are NOT compatible. Sometimes you get linker errors, other times it's
app crashes.

HTH
Christian
Post by Boris Kolpackov
Hi Adnan,
../../odb-2.3.0-i686-macosx/bin/odb: error: unable to extract
profile paths
This error tells me that MAYBE yosemite has a problem. So I’ll
try on my host “Maverick”.
Yes, this looks like the same problem we had with the beta. I will
have to look into this when I get access to Yosemite.
Ok, so you have compiled the ODB runtimes and example with clang
and everything works fine. Then you tried to use the same runtime
builds from Qt-Creator and you got this linker error. To me this
1. Either builds the project with another compiler. Maybe it uses
its own clang or gcc?
2. Or it builds using system clang but with some options that make
it incompatible with the default build of the ODB runtimes.
In either case we need to get the exact clang command line, with
the executable name and all the options, that is executed by
Qt-Creator. Ideally, I would like to see the complete list of
commands that Qt-Creator executes to build your project (i.e.,
both the C++ compilation and the link command that fails).
Boris
Boris Kolpackov
2014-10-27 06:49:28 UTC
Permalink
Hi Christian,
Post by Christian Sell
- command line build links against libc++
- qt build links against libstdc++ (for reason of some OSX backwards
compatibility)
Thanks for sharing! This will definitely explain what we are seeing.
BTW, how did you resolve this? Did you force QtCreator to use libc++
or did you re-build the ODB runtimes to use libstdc++? In the latter
case I wonder if Qt uses the system libstdc++ (found in /usr/lib on
my machine) or ships its own version (which will be a yet another
level of pain in the butt).

In the meantime I've tried to rebuild the ODB runtimes to use system
libstdc++. For some reason passing -stdlib=libstdc++ to clang is not
enough, one also has to explicitly link to -lstdc++:

clang -stdlib=libstdc++ sizeof_funds.cxx -L/usr/lib -lstdc++

[That -L/usr/lib is necessary in my case because I have another
libstdc++ in /usr/local/lib.]

With that knowledge I was able to re-build the runtimes to use
libstdc++:

make distclean
./configure CC=clang CXX="clang++ -stdlib=libstdc++" LDFLAGS=-L/usr/lib LIBS=-lstdc++
make
sudo make install

And then the example:

clang++ -stdlib=libstdc++ -c person-odb.cxx
clang++ -stdlib=libstdc++ -c -DDATABASE_SQLITE driver.cxx
clang++ -stdlib=libstdc++ -o driver person-odb.o driver.o -lodb-sqlite -lodb -L/usr/lib -lstdc++

otool -L ./driver
./driver:
/usr/local/lib/libodb-sqlite-2.3.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/local/lib/libodb-2.3.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 60.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)

Boris
Christian Sell
2014-10-27 08:18:17 UTC
Permalink
Post by Boris Kolpackov
BTW, how did you resolve this? Did you force QtCreator to use libc++
or did you re-build the ODB runtimes to use libstdc++? In the latter
case I wonder if Qt uses the system libstdc++ (found in /usr/lib on
my machine) or ships its own version (which will be a yet another
level of pain in the butt).
we encountered this with boost and OxOrm, not with ODB. At that time, we
resolved it by forcing the libraries onto libstdc++. We have now turned to
configuring QMake to use libc++ (qmake.conf, something along the lines of
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.9, not 10.7). Just spent half a day recently
since I didnt know this change had been done by a colleague..

No, I think Qt uses the system libstdc++

regards,
Christian
Adnan RIHAN
2014-10-27 13:49:05 UTC
Permalink
Hi there,

I saw your messages about libc++ and libstdc++.

What/How do you want me to check Qt or compiled app are using which lib? otool is enough, but maybe you want me to check some things?
--
Cordialement, Adnan RIHAN.
Directeur-Gérant de Eolis-Software, société de services informatiques.

GPG: 5675-62BA (https://keybase.io/max13/key.asc)
-> Si vous n’utilisez pas GPG mais souhaitez quand même m’envoyer un e-mail chiffré: (https://encrypt.to/0x567562BA).
Boris Kolpackov
2014-10-27 14:26:32 UTC
Permalink
Hi Adnan,
Post by Adnan RIHAN
What/How do you want me to check Qt or compiled app are using which lib?
You can try to rebuild the ODB runtimes to use libstdc++ as I described
in my previous email and then see if that helps your application that
is built from QtCreator.

Boris
Adnan RIHAN
2014-10-27 18:21:39 UTC
Permalink
Post by Boris Kolpackov
You can try to rebuild the ODB runtimes to use libstdc++ as I described
in my previous email and then see if that helps your application that
is built from QtCreator.
~ % otool -L /usr/local/lib/libodb{,-sqlite,-qt}.dylib
/usr/local/lib/libodb-2.3.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.0.0)
/usr/local/lib/libodb-sqlite-2.3.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/local/lib/libodb-2.3.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/lib/libsqlite3.dylib (compatibility version 9.0.0, current version 158.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.0.0)
/usr/local/lib/libodb-qt-2.3.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/local/lib/libodb-2.3.dylib (compatibility version 0.0.0, current version 0.0.0)
/Users/Max13/Qt/5.3/clang_64/lib/QtCore.framework/Versions/5/QtCore (compatibility version 5.3.0, current version 5.3.2)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.0.0)
./configure CC=clang CXX=clang++\ -stdlib=libstdc++ LDFLAGS=-L/usr/lib LIBS=-lstdc++
~ % otool -L /usr/local/lib/libodb{,-sqlite,-qt}.dylib
/usr/local/lib/libodb-2.3.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 60.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)
/usr/local/lib/libodb-sqlite-2.3.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/local/lib/libodb-2.3.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/lib/libsqlite3.dylib (compatibility version 9.0.0, current version 158.0.0)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 60.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)
/usr/local/lib/libodb-qt-2.3.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/local/lib/libodb-2.3.dylib (compatibility version 0.0.0, current version 0.0.0)
/Users/Max13/Qt/5.3/clang_64/lib/QtCore.framework/Versions/5/QtCore (compatibility version 5.3.0, current version 5.3.2)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 60.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)
➜ src % otool -L /Users/Max13/Dev/System/LGC/build/Desktop_Qt_5_3_2_clang_64bit-Debug/apps/LGC/src/LGC.app/Contents/MacOS/LGC 
/usr/local/lib/libodb-qt-2.3.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/local/lib/libodb-sqlite-2.3.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/local/lib/libodb-2.3.dylib (compatibility version 0.0.0, current version 0.0.0)
/Users/Max13/Qt/5.3/clang_64/lib/QtSvg.framework/Versions/5/QtSvg (compatibility version 5.3.0, current version 5.3.2)
/Users/Max13/Qt/5.3/clang_64/lib/QtWidgets.framework/Versions/5/QtWidgets (compatibility version 5.3.0, current version 5.3.2)
/Users/Max13/Qt/5.3/clang_64/lib/QtGui.framework/Versions/5/QtGui (compatibility version 5.3.0, current version 5.3.2)
/Users/Max13/Qt/5.3/clang_64/lib/QtCore.framework/Versions/5/QtCore (compatibility version 5.3.0, current version 5.3.2)
/System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0)
/System/Library/Frameworks/AGL.framework/Versions/A/AGL (compatibility version 1.0.0, current version 1.0.0)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 60.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)
I’ve done something which would crash, and it doesn’t show “libc++abi uncaught exception” anymore, now my exception are correctly caught by odb::exception !
Many thanks :) !
--
Cordialement, Adnan RIHAN.
Directeur-Gérant de Eolis-Software, société de services informatiques.

GPG: 5675-62BA (https://keybase.io/max13/key.asc)
-> Si vous n'utilisez pas GPG mais souhaitez quand même m’envoyer un e-mail chiffré: (https://encrypt.to/0x567562BA).
Loading...