Discussion:
Hello World app under MAC OS X cocoa
stepasite
2014-03-24 12:14:54 UTC
Permalink
Hello,

when I try to run Hello World
(http://docs.wxwidgets.org/trunk/overview_helloworld.html) application with
wxWidgets-3.0.0 under MAC OS X 10.9 (Cocoa port), I get the following
error:

dyld: Symbol not found: _dataroot
Referenced from: myHelloWorldApp
Expected in: flat namespace

Any clarification or help why my app does not run correctly would be much
appreciated. I googled a lot, but could not find any mention of "_dataroot"
symbol anywhere.

Thanks in advance,
Pavel
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users
Vadim Zeitlin
2014-03-24 13:03:22 UTC
Permalink
On Mon, 24 Mar 2014 05:14:54 -0700 (PDT) stepasite wrote:

s> when I try to run Hello World
s> (http://docs.wxwidgets.org/trunk/overview_helloworld.html) application with
s> wxWidgets-3.0.0 under MAC OS X 10.9 (Cocoa port), I get the following
s> error:
s>
s> dyld: Symbol not found: _dataroot
s> Referenced from: myHelloWorldApp
s> Expected in: flat namespace

I've never seen this before neither. How did you compile the library and
your application exactly? Also, can you use nm (or otool?) to check where
is this symbol referenced from exactly?

Regards,
VZ
--
TT-Solutions: wxWidgets consultancy and technical support
http://www.tt-solutions.com/
stepasite
2014-03-25 15:21:35 UTC
Permalink
Thanks for the quick reply.

I built and linked the wxWidgets by myself, but being sure I did not make a
mistake, I also built it by standard means (configure, make). I will try to
use otool or nm to locate the symbol, thanks for suggestion.

In the meantime I tried to play with compiler settings, configure settings
and macro definitions. Now when I run
HelloWorldApp I simply get some info into command line:

"
Page Faults: 3732, Page Ins: 1538, COW Faults: 530 Ports: 39
Res NonSpec: 0 B Res Spec: 0 B Dirty: 0 B Copied: 0 B
Swapped: 0 B
Wired: 0 B, KMEM: 244 kB
Malloc data unavailable
User CPU Time: 0.073627 sec, System CPU Time: 0.039926 over 4 threads
"
and application then terminates.

Being unsuccessful with building wxWidgets using command-line tools, I
tried to use xcode projects that come with the wxWidgets distribution. I
followed this guideline:

http://wiki.wxwidgets.org/Creating_Xcode_projects_for_wxWidgets_applications

wxWidgets compiled without problem, minimal_cocoa application as well. Then
when I run it, I get the following error:

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libstdc++.6.dylib 0x00007fff95fd608a
std::basic_string<wchar_t, std::char_traits<wchar_t>,
std::allocator<wchar_t> >::_Rep::_M_grab(std::allocator<wchar_t> const&,
std::allocator<wchar_t> const&) + 4
1 libstdc++.6.dylib 0x00007fff95fd68a1
std::basic_string<wchar_t, std::char_traits<wchar_t>,
std::allocator<wchar_t> >::assign(std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> > const&) + 39
2 libwx_osx_cocoa.dylib 0x00000001095a58ff
wxString::operator=(wxString const&) + 47 (string.h:1883)
3 libwx_osx_cocoa.dylib 0x000000010973709f
wxWindowBase::SetName(wxString const&) + 47 (window.h:208)
4 libwx_osx_cocoa.dylib 0x00000001097382e6
wxNonOwnedWindow::Create(wxWindow*, int, wxPoint const&, wxSize const&,
long, wxString const&) + 118 (nonownedwnd_osx.cpp:115)
5 libwx_osx_cocoa.dylib 0x000000010973ec78
wxTopLevelWindowMac::Create(wxWindow*, int, wxString const&, wxPoint
const&, wxSize const&, long, wxString const&) + 104 (toplevel_osx.cpp:75)
6 libwx_osx_cocoa.dylib 0x00000001097c3b67
wxFrame::Create(wxWindow*, int, wxString const&, wxPoint const&, wxSize
const&, long, wxString const&) + 103 (frame.cpp:52)
7 org.wxwidgets.samples.final 0x000000010958182c
wxFrame::wxFrame(wxWindow*, int, wxString const&, wxPoint const&, wxSize
const&, long, wxString const&) + 140 (frame.h:35)
8 org.wxwidgets.samples.final 0x0000000109580ecf
MyFrame::MyFrame(wxString const&) + 127 (minimal.cpp:147)
9 org.wxwidgets.samples.final 0x0000000109580e3d
MyFrame::MyFrame(wxString const&) + 29 (minimal.cpp:175)
10 org.wxwidgets.samples.final 0x0000000109580d84 MyApp::OnInit() +
100 (minimal.cpp:128)
11 libwx_osx_cocoa.dylib 0x000000010972ff1f
wxApp::CallOnInit() + 95 (utils.mm:336)
12 libwx_osx_cocoa.dylib 0x000000010963d01d wxEntry(int&,
wchar_t**) + 205 (init.cpp:479)
13 libwx_osx_cocoa.dylib 0x000000010963d1ff wxEntry(int&,
char**) + 63 (init.cpp:507)
14 org.wxwidgets.samples.final 0x0000000109580c96 main + 38
(minimal.cpp:109)
15 libdyld.dylib 0x00007fff943075fd start + 1

I am out of luck with getting wxWidgets running. Is any of the errors above
familiar to you?

Thanks in advance for any help.
Post by Vadim Zeitlin
s> when I try to run Hello World
s> (http://docs.wxwidgets.org/trunk/overview_helloworld.html) application with
s> wxWidgets-3.0.0 under MAC OS X 10.9 (Cocoa port), I get the following
s>
s> dyld: Symbol not found: _dataroot
s> Referenced from: myHelloWorldApp
s> Expected in: flat namespace
I've never seen this before neither. How did you compile the library and
your application exactly? Also, can you use nm (or otool?) to check where
is this symbol referenced from exactly?
Regards,
VZ
--
TT-Solutions: wxWidgets consultancy and technical support
http://www.tt-solutions.com/
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users
David Connet
2014-03-25 15:53:28 UTC
Permalink
That looks similar to something I was getting. The only way I have been able to compile/run on 10.9 is to specifically use libc++ and the 10.9 sdk (and target 10.7 or higher). Never been able to get a successful program on 10.8 (I statically link). It always crashes with a malloc error. (haven't found a sample that crashes like that yet, just my program) It always looks like it's because of a static initialization. (At one point I could run when I got rid of all my static wx-based globals, but then the malloc error came back... sigh)

This link (http://permalink.gmane.org/gmane.comp.lib.wxwidgets.devel/153204) helped me figure out how to target libc.

Dave
________________________________
Sent: Tuesday, March 25, 2014 8:21 AM
Subject: Re: Hello World app under MAC OS X cocoa
Thanks for the quick reply.
I built and linked the wxWidgets by myself, but being sure I did not make a mistake, I also built it by standard means (configure, make). I will try to use otool or nm to locate the symbol, thanks for suggestion.
In the meantime I tried to play with compiler settings, configure settings and macro definitions. Now when I run
"
Page Faults:   3732, Page Ins:   1538, COW Faults: 530 Ports:   39
Res NonSpec: 0  B    Res Spec: 0  B    Dirty: 0  B    Copied: 0  B    Swapped: 0  B
Wired: 0  B, KMEM: 244 kB
Malloc data unavailable
User CPU Time: 0.073627 sec, System CPU Time: 0.039926 over 4 threads
"
and application then terminates.
http://wiki.wxwidgets.org/Creating_Xcode_projects_for_wxWidgets_applications
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libstdc++.6.dylib                 0x00007fff95fd608a std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::_Rep::_M_grab(std::allocator<wchar_t> const&, std::allocator<wchar_t> const&) + 4
1   libstdc++.6.dylib                 0x00007fff95fd68a1 std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::assign(std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&) + 39
2   libwx_osx_cocoa.dylib             0x00000001095a58ff wxString::operator=(wxString const&) + 47 (string.h:1883)
3   libwx_osx_cocoa.dylib             0x000000010973709f wxWindowBase::SetName(wxString const&) + 47 (window.h:208)
4   libwx_osx_cocoa.dylib             0x00000001097382e6 wxNonOwnedWindow::Create(wxWindow*, int, wxPoint const&, wxSize const&, long, wxString const&) + 118 (nonownedwnd_osx.cpp:115)
5   libwx_osx_cocoa.dylib             0x000000010973ec78 wxTopLevelWindowMac::Create(wxWindow*, int, wxString const&, wxPoint const&, wxSize const&, long, wxString const&) + 104 (toplevel_osx.cpp:75)
6   libwx_osx_cocoa.dylib             0x00000001097c3b67 wxFrame::Create(wxWindow*, int, wxString const&, wxPoint const&, wxSize const&, long, wxString const&) + 103 (frame.cpp:52)
7   org.wxwidgets.samples.final       0x000000010958182c wxFrame::wxFrame(wxWindow*, int, wxString const&, wxPoint const&, wxSize const&, long, wxString const&) + 140 (frame.h:35)
8   org.wxwidgets.samples.final       0x0000000109580ecf MyFrame::MyFrame(wxString const&) + 127 (minimal.cpp:147)
9   org.wxwidgets.samples.final       0x0000000109580e3d MyFrame::MyFrame(wxString const&) + 29 (minimal.cpp:175)
10  org.wxwidgets.samples.final       0x0000000109580d84 MyApp::OnInit() + 100 (minimal.cpp:128)
11  libwx_osx_cocoa.dylib             0x000000010972ff1f wxApp::CallOnInit() + 95 (utils.mm:336)
12  libwx_osx_cocoa.dylib             0x000000010963d01d wxEntry(int&, wchar_t**) + 205 (init.cpp:479)
13  libwx_osx_cocoa.dylib             0x000000010963d1ff wxEntry(int&, char**) + 63 (init.cpp:507)
14  org.wxwidgets.samples.final       0x0000000109580c96 main + 38 (minimal.cpp:109)
15  libdyld.dylib                     0x00007fff943075fd start + 1
I am out of luck with getting wxWidgets running. Is any of the errors above familiar to you?
Thanks in advance for any help.
Post by Vadim Zeitlin
s> when I try to run Hello World
s> (http://docs.wxwidgets.org/ trunk/overview_helloworld.html ) application with
s> wxWidgets-3.0.0 under MAC OS X 10.9 (Cocoa port), I get the following
s>
s> dyld: Symbol not found: _dataroot
s> Referenced from: myHelloWorldApp
s> Expected in: flat namespace
 I've never seen this before neither. How did you compile the library and
your application exactly? Also, can you use nm (or otool?) to check where
is this symbol referenced from exactly?
 Regards,
VZ
--
TT-Solutions: wxWidgets consultancy and technical support
               http://www.tt-solutions.com/
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.
 
or visit http://groups.google.com/group/wx-users
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users
Kobus Grobler
2014-03-26 07:16:59 UTC
Permalink
Strange, it has always worked for me.

Maybe if you and Pavel can tell us with which switches and g++ you build
wx, it would help.

This is what I use for static linking to wx on 10.9 (with g++ from the
latest XCode commandline tools):
Release build:
configure --prefix=/Users/kobus/work/libs/wxWidgets-3.0-static-release
--disable-shared --disable-debug --disable-debug_flag --disable-compat28
--without-liblzma --with-zlib=builtin --without-libiconv

Debug build:
configure --prefix=/Users/kobus/work/libs/wxWidgets-3.0-static-debug
--disable-shared --enable-debug --disable-compat28 --without-liblzma
--with-zlib=builtin --without-libiconv

Then you need to make sure that you build your apps with the SAME g++
compiler and linker switches as provided from wx-config, ie. CXX =
wx-config --cxx
etc.

By default this targets -mmacosx-version-min=10.5

Best
Kobus
Post by David Connet
That looks similar to something I was getting. The only way I have
been able to compile/run on 10.9 is to specifically use libc++ and the
10.9 sdk (and target 10.7 or higher). Never been able to get a
successful program on 10.8 (I statically link). It always crashes with
a malloc error. (haven't found a sample that crashes like that yet,
just my program) It always looks like it's because of a static
initialization. (At one point I could run when I got rid of all my
static wx-based globals, but then the malloc error came back... sigh)
This link
(http://permalink.gmane.org/gmane.comp.lib.wxwidgets.devel/153204)
helped me figure out how to target libc.
Dave
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users
Vadim Zeitlin
2014-03-25 21:55:41 UTC
Permalink
On Tue, 25 Mar 2014 08:21:35 -0700 (PDT) stepasite wrote:

s> Thanks for the quick reply.
s>
s> I built and linked the wxWidgets by myself, but being sure I did not make a
s> mistake, I also built it by standard means (configure, make). I will try to
s> use otool or nm to locate the symbol, thanks for suggestion.
s>
s> In the meantime I tried to play with compiler settings, configure settings
s> and macro definitions. Now when I run
s> HelloWorldApp I simply get some info into command line:
s>
s> "
s> Page Faults: 3732, Page Ins: 1538, COW Faults: 530 Ports: 39
s> Res NonSpec: 0 B Res Spec: 0 B Dirty: 0 B Copied: 0 B
s> Swapped: 0 B
s> Wired: 0 B, KMEM: 244 kB
s> Malloc data unavailable
s> User CPU Time: 0.073627 sec, System CPU Time: 0.039926 over 4 threads
s> "
s> and application then terminates.

I have absolutely no idea where could this be coming from. One thing I'm
sure about is that it has nothing to do with wx.

s> Being unsuccessful with building wxWidgets using command-line tools, I
s> tried to use xcode projects that come with the wxWidgets distribution. I
s> followed this guideline:
s>
s> http://wiki.wxwidgets.org/Creating_Xcode_projects_for_wxWidgets_applications
s>
s> wxWidgets compiled without problem, minimal_cocoa application as well. Then
s> when I run it, I get the following error:

This looks very much like a mismatch between different (and incompatible)
versions of C++ standard library, make sure you use either libstdc++ or
libc++ everywhere but not both.

Regards,
VZ
--
TT-Solutions: wxWidgets consultancy and technical support
http://www.tt-solutions.com/
stepasite
2014-03-26 14:15:10 UTC
Permalink
Thanks guys for the replies. Unifying libraries to libc++ or to libstdc++
did help. Now I am able to run HelloWorld application under MAC OS X 10.9.
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users
stepasite
2014-03-28 11:55:48 UTC
Permalink
Hi,

I am still not able to get minimal application (samples/minimal.cpp)
running. I double checked I specify -stdlib=libstdc++ and link against
-lstdc++.

When I run app from lldb, I get the following:

Process 18330 stopped
* thread #1: tid = 0x245d2, 0x00007fff8a5e5a1a
libsystem_kernel.dylib`mach_msg_trap + 10, queue = 'com.apple.main-thread,
stop reason = signal SIGSTOP
frame #0: 0x00007fff8a5e5a1a libsystem_kernel.dylib`mach_msg_trap + 10
libsystem_kernel.dylib`mach_msg_trap + 10:
-> 0x7fff8a5e5a1a: ret
0x7fff8a5e5a1b: nop

libsystem_kernel.dylib`mach_msg_overwrite_trap:
0x7fff8a5e5a1c: movq %rcx, %r10
0x7fff8a5e5a1f: movl $16777248, %eax

Is anyone familiar with this error? What could be the cause?

Thanks in advance for any help.
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users
stepasite
2014-03-28 13:57:07 UTC
Permalink
Hi,

I finally found what was the problem. Posting the solution.

It had nothing in common with wxWidgets. As I am a newbie in MAC OS X
programming, I was not aware that executable cannot be run standalone but
must reside inside application bundle.

Creating application did help.
Post by stepasite
Hi,
I am still not able to get minimal application (samples/minimal.cpp)
running. I double checked I specify -stdlib=libstdc++ and link against
-lstdc++.
Process 18330 stopped
* thread #1: tid = 0x245d2, 0x00007fff8a5e5a1a
libsystem_kernel.dylib`mach_msg_trap + 10, queue = 'com.apple.main-thread,
stop reason = signal SIGSTOP
frame #0: 0x00007fff8a5e5a1a libsystem_kernel.dylib`mach_msg_trap + 10
-> 0x7fff8a5e5a1a: ret
0x7fff8a5e5a1b: nop
0x7fff8a5e5a1c: movq %rcx, %r10
0x7fff8a5e5a1f: movl $16777248, %eax
Is anyone familiar with this error? What could be the cause?
Thanks in advance for any help.
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users
Loading...