Developer forums (C::B DEVELOPMENT STRICTLY!) > Development
Build C::B against wx3.02 with gcc 5.2 under Windows
ollydbg:
--- Quote from: mageia on November 09, 2015, 07:55:56 am ---
--- Quote ---C:\localusr\wxWidgets\include\wx\filefn.h|522|undefined reference to `wxMSLU__wstat(wchar_t const*, _stat64*)'|
||error: ld returned 1 exit status|
--- End quote ---
MSLU ,wx use it on win9.x not later,isn't it,error happen when link codeblocks.dll,and i use nuwen's mingw64 to build wx3.02 and codeblocks 10561,enough information or not?
--- End quote ---
Show us the full build log please. See:FAQ-Compiling (errors) - CodeBlocks
ollydbg:
--- Quote from: ollydbg on November 09, 2015, 06:11:55 am ---...
OK.
I have done the patches, which let some plugins link to the static library. So the symbols in those static libraries are not exported from the codeblocks.dll, see the patches here: Link
--- End quote ---
I see a crash here with the above patches:
--- Code: ---[debug]> bt 30
[debug]#0 0x004c2f21 in sq_getprintfunc (v=0x0) at F:\cb_sf_git\trunk\src\sdk\scripting\squirrel\sqapi.cpp:1256
[debug]#1 0x0049e1cc in ScriptConsole::ScriptConsole (this=0x74587d8, parent=0x5a0bd00, id=-1) at F:\cb_sf_git\trunk\src\src\scriptconsole.cpp:116
[debug]#2 0x00451844 in MainFrame::CreateIDE (this=0x5a0bd00) at F:\cb_sf_git\trunk\src\src\main.cpp:756
[debug]#3 0x0044f847 in MainFrame::MainFrame (this=0x5a0bd00, parent=0x0) at F:\cb_sf_git\trunk\src\src\main.cpp:602
[debug]#4 0x00402a56 in CodeBlocksApp::InitFrame (this=0x587d4c0) at F:\cb_sf_git\trunk\src\src\app.cpp:489
[debug]#5 0x0040407b in CodeBlocksApp::OnInit (this=0x587d4c0) at F:\cb_sf_git\trunk\src\src\app.cpp:697
[debug]#6 0x004fb06e in wxAppConsoleBase::CallOnInit (this=0x587d4c0) at D:\wx3\include\wx\app.h:93
[debug]#7 0x6a00fbf0 in wxEntryReal (argc=@0x6abe53f8: 9, argv=0x587d150) at D:\wx3\src\common\init.cpp:479
[debug]#8 0x6a094b98 in wxEntry (argc=@0x6abe53f8: 9, argv=0x587d150) at D:\wx3\src\msw\main.cpp:197
[debug]#9 0x6a094e86 in wxEntry (hInstance=0x400000, nCmdShow=10) at D:\wx3\src\msw\main.cpp:415
[debug]#10 0x0040224d in WinMain@16 (hInstance=0x400000, hPrevInstance=0x0, nCmdShow=10) at F:\cb_sf_git\trunk\src\src\app.cpp:322
[debug]#11 0x0052ac9d in main ()
[debug]>>>>>>cb_gdb:
--- End code ---
Here:
--- Code: ---ScriptConsole::ScriptConsole(wxWindow* parent,wxWindowID id)
{
//(*Initialize(ScriptConsole)
wxBoxSizer* BoxSizer2;
wxBoxSizer* BoxSizer1;
Create(parent, id, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _T("id"));
BoxSizer1 = new wxBoxSizer(wxVERTICAL);
txtConsole = new wxTextCtrl(this, ID_TEXTCTRL1, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY|wxHSCROLL, wxDefaultValidator, _T("ID_TEXTCTRL1"));
wxFont txtConsoleFont(10,wxFONTFAMILY_MODERN,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_NORMAL,false,wxEmptyString,wxFONTENCODING_DEFAULT);
txtConsole->SetFont(txtConsoleFont);
BoxSizer1->Add(txtConsole, 1, wxALL|wxEXPAND, 0);
Panel1 = new wxPanel(this, ID_PANEL1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _T("ID_PANEL1"));
Panel1->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));
BoxSizer2 = new wxBoxSizer(wxHORIZONTAL);
lblCommand = new wxStaticText(Panel1, ID_STATICTEXT1, _("Command:"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT1"));
BoxSizer2->Add(lblCommand, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5);
txtCommand = new wxComboBox(Panel1, ID_COMBOBOX1, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, 0, wxCB_DROPDOWN|wxTE_PROCESS_ENTER, wxDefaultValidator, _T("ID_COMBOBOX1"));
wxFont txtCommandFont(10,wxFONTFAMILY_MODERN,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_NORMAL,false,wxEmptyString,wxFONTENCODING_DEFAULT);
txtCommand->SetFont(txtCommandFont);
BoxSizer2->Add(txtCommand, 1, wxALL|wxALIGN_CENTER_VERTICAL, 0);
btnExecute = new wxBitmapButton(Panel1, ID_BITMAPBUTTON1, wxArtProvider::GetBitmap(wxART_MAKE_ART_ID_FROM_STR(_T("wxART_EXECUTABLE_FILE")),wxART_BUTTON), wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW, wxDefaultValidator, _T("ID_BITMAPBUTTON1"));
btnExecute->SetToolTip(_("Execute current command"));
BoxSizer2->Add(btnExecute, 0, wxALIGN_CENTER_VERTICAL, 5);
btnLoad = new wxBitmapButton(Panel1, ID_BITMAPBUTTON2, wxArtProvider::GetBitmap(wxART_MAKE_ART_ID_FROM_STR(_T("wxART_FILE_OPEN")),wxART_BUTTON), wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW, wxDefaultValidator, _T("ID_BITMAPBUTTON2"));
btnLoad->SetDefault();
btnLoad->SetToolTip(_("Load from file"));
BoxSizer2->Add(btnLoad, 0, wxALL|wxALIGN_CENTER_VERTICAL, 0);
btnClear = new wxBitmapButton(Panel1, ID_BITMAPBUTTON3, wxArtProvider::GetBitmap(wxART_MAKE_ART_ID_FROM_STR(_T("wxART_DELETE")),wxART_BUTTON), wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW, wxDefaultValidator, _T("ID_BITMAPBUTTON3"));
btnClear->SetDefault();
btnClear->SetToolTip(_("Clear output window"));
BoxSizer2->Add(btnClear, 0, wxALL|wxALIGN_CENTER_VERTICAL, 0);
Panel1->SetSizer(BoxSizer2);
BoxSizer2->Fit(Panel1);
BoxSizer2->SetSizeHints(Panel1);
BoxSizer1->Add(Panel1, 0, wxALL|wxEXPAND, 0);
SetSizer(BoxSizer1);
BoxSizer1->Fit(this);
BoxSizer1->SetSizeHints(this);
Connect(ID_COMBOBOX1,wxEVT_COMMAND_TEXT_ENTER,(wxObjectEventFunction)&ScriptConsole::OnbtnExecuteClick);
Connect(ID_BITMAPBUTTON1,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&ScriptConsole::OnbtnExecuteClick);
Connect(ID_BITMAPBUTTON2,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&ScriptConsole::OnbtnLoadClick);
Connect(ID_BITMAPBUTTON3,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&ScriptConsole::OnbtnClearClick);
//*)
txtCommand->Append(wxEmptyString);
if (!s_Console)
{
s_Console = this;
s_OldPrintFunc = sq_getprintfunc(SquirrelVM::GetVMPtr());
sq_setprintfunc(SquirrelVM::GetVMPtr(), ScriptConsolePrintFunc);
}
Log(_("Welcome to the script console!"));
}
--- End code ---
I see that SquirrelVM::GetVMPtr() is 0 here.
ollydbg:
--- Quote from: ollydbg on November 11, 2015, 03:33:31 pm ---...
I see that SquirrelVM::GetVMPtr() is 0 here.
--- End quote ---
I debugged for a while, and I found that the SquirrelVM::_VM is a static variable of the class.
--- Code: ---class SquirrelVM
{
friend class SquirrelObject;
friend struct SquirrelError;
public:
// C::B patch: Add additional initilisation flags
static void Init(SquirrelInitFlags flags = sqifAll);
static BOOL_T IsInitialized(){return _VM == NULL?FALSE:TRUE;}
static void Shutdown();
static void Cleanup();
static BOOL_T Update(); //debugger and maybe GC later
static SquirrelObject CompileScript(const SQChar *s);
static SquirrelObject CompileBuffer(const SQChar *s,const SQChar * debugInfo=sqT("console_buffer"));
static SquirrelObject RunScript(const SquirrelObject &o,SquirrelObject *_this = NULL);
static void PrintFunc(HSQUIRRELVM v,const SQChar* s,...);
static BOOL_T BeginCall(const SquirrelObject &func);
static BOOL_T BeginCall(const SquirrelObject &func,SquirrelObject &_this);
static void PushParam(const SquirrelObject &o);
static void PushParam(const SQChar *s);
static void PushParam(SQInteger n);
static void PushParam(SQFloat f);
static void PushParam(SQUserPointer up);
static void PushParamNull();
static SquirrelObject EndCall();
static SquirrelObject CreateString(const SQChar *s);
static SquirrelObject CreateTable();
static SquirrelObject CreateArray(SQInteger size);
static SquirrelObject CreateInstance(SquirrelObject &oclass); // oclass is an existing class. Create an 'instance' (OT_INSTANCE) of oclass.
static SquirrelObject CreateFunction(SQFUNCTION func);
static SquirrelObject CreateUserData(SQInteger size);
static const SquirrelObject &GetRootTable();
static HSQUIRRELVM GetVMPtr() { return _VM; }
#if 0
static void SetVMPtr(HSQUIRRELVM v) {
_VM = v;
} // setVMPtr
#endif
static void GetVMSys(SquirrelVMSys & vmSys) {
vmSys._VM = _VM;
vmSys._root = _root;
} // GetVMSys
static void SetVMSys(const SquirrelVMSys & vmSys) {
_VM = vmSys._VM;
_root = vmSys._root;
} // SetVMSys
static void PushValue(INT_T val) {
sq_pushinteger(_VM,val);
} // PushValue
static void PushValue(FLOAT_T val) {
sq_pushfloat(_VM,val);
} // PushValue
static void PushValue(bool val) { // Compiler treats SQBool as INT_T.
sq_pushbool(_VM,val);
} // PushValue
static void PushValue(SQChar * val) {
sq_pushstring(_VM,val,-1);
} // PushValue
static void PushValue(SQUserPointer val) {
sq_pushuserpointer(_VM,val);
} // PushValue
static void PushValue(const SQChar * val) {
sq_pushstring(_VM,val,-1);
} // PushValue
static void PushObject(SquirrelObject & so) {
sq_pushobject(_VM,so._o);
} // PushObject
static void Pop(SQInteger nelemstopop) {
sq_pop(_VM,nelemstopop);
} // Pop
static void PushRootTable(void);
// Create/bind a function on the table currently on the stack.
static SquirrelObject CreateFunction(SQFUNCTION func,const SQChar * scriptFuncName,const SQChar * typeMask=0);
// Create/bind a function on the table so. typeMask: standard Squirrel types plus: no typemask means no args, "*" means any type of args.
static SquirrelObject CreateFunction(SquirrelObject & so,SQFUNCTION func,const SQChar * scriptFuncName,const SQChar * typeMask=0);
// Create/bind a function to the root table. typeMask: standard Squirrel types plus: no typemask means no args, "*" means any type of args.
static SquirrelObject CreateFunctionGlobal(SQFUNCTION func,const SQChar * scriptFuncName,const SQChar * typeMask=0);
private:
static HSQUIRRELVM _VM;
static SQInteger _CallState;
static SquirrelObject * _root;
};
--- End code ---
I see two instance of the SquirrelVM::_VM exists. The first one is initialized inside the sdk target, and the other instance is inside the src target. It looks like the first one get initialized correctly, but the second one is not, so the second one's value is 0, and we get a crash. Is it by design of the compiler? I mean this time, SquirrelVM library is a static library, and its source are copied to both sdk and src...
So, I think we still need the "old" way, I mean that we should have only one instance of the SquirrelVM::_VM, and we need to export the symbols from the sdk.
EDIT: Is the issue mentioned here: c++ - Initializing private static members - Stack Overflow, each cpp include the class will have a copy of the static member variable?
ollydbg:
--- Quote from: ollydbg on November 11, 2015, 04:11:42 pm ---...
I see two instance of the SquirrelVM::_VM exists. The first one is initialized inside the sdk target, and the other instance is inside the src target. It looks like the first one get initialized correctly, but the second one is not, so the second one's value is 0, and we get a crash. Is it by design of the compiler? I mean this time, SquirrelVM library is a static library, and its source are copied to both sdk and src...
So, I think we still need the "old" way, I mean that we should have only one instance of the SquirrelVM::_VM, and we need to export the symbols from the sdk.
EDIT: Is the issue mentioned here: c++ - Initializing private static members - Stack Overflow, each cpp include the class will have a copy of the static member variable?
--- End quote ---
OK, this is the actual issue to my problem: c++ - Using static members across Static Lib and DLL - member value is resetting - Stack Overflow, the static lib which contains some static member should only be linked to one dll.
mageia:
--- Quote from: ollydbg on November 09, 2015, 08:24:54 am ---
--- Quote from: mageia on November 09, 2015, 07:55:56 am ---
--- Quote ---C:\localusr\wxWidgets\include\wx\filefn.h|522|undefined reference to `wxMSLU__wstat(wchar_t const*, _stat64*)'|
||error: ld returned 1 exit status|
--- End quote ---
MSLU ,wx use it on win9.x not later,isn't it,error happen when link codeblocks.dll,and i use nuwen's mingw64 to build wx3.02 and codeblocks 10561,enough information or not?
--- End quote ---
Show us the full build log please. See:FAQ-Compiling (errors) - CodeBlocks
--- End quote ---
sorry,here it is.it is huge,so i post a 7z file
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version