arguments << "-c" << "ifconfig wlan0 | grep 'inet ' | awk '{print $2}' | sed 's/addr://'";
// or arguments << "-c" << "ifconfig eth1 | grep 'inet ' | awk '{print $2}' | sed 's/addr://'";
QProcess* process = new QProcess(this);
process->start(prog , arguments);
process->waitForFinished();
QString tmp = process->readAll();
//qDebug() << tmp;
ui->label_ip->setText(tmp);
Showing posts with label Qt. Show all posts
Showing posts with label Qt. Show all posts
03/05/2012
08/08/2011
Install AnalogWidget in Ubuntu / Gumstix
Install in Ubuntu:
System spec:
Ubuntu 10.04 (lucid)
2.30.2 (Ubuntu 2010-06-25)
2.6.32-33-generic (#70-Ubuntu SMP Thu Jul 7 21:13:52 UTC 2011)
4.4.3 (x86_64-linux-gnu)
AnalogWidgets_234.zip
Download from here:
http://qt-apps.org/content/show.php?content=87780&forumpage=0
unzip it.
$ cd /home/czhang/Downloads/AnalogWidgets
$ qmake AnalogWidgets.pro
$ make
$ sudo make install
Install in Gumstix:
unzip Analogwidget.zip under:
/build/czhang/qt-everywhere-opensource-src-4.7.0/projects
$ qmake AnalogWidgets.pro
$ make
got some error messages according to file:
/build/czhang/AnalogWidgets/analogwidgets/code/chart/channel.cpp
/build/czhang/AnalogWidgets/analogwidgets/code/scriptwidget.cpp
I edited these two files:
in channel.cpp
in scriptwidget.cpp:
void ScriptWidget::setScript(const QString & s)
{
m_script = s;
qDebug("ScriptWidget::setScript() %s",qPrintable(m_script));
try
{
QFile file(m_script);
if (file.open( QIODevice::ReadOnly ))
{
QString src = QString(file.readAll());
QScriptValue widget = m_engine->newQObject(this);
m_engine->globalObject().setProperty(objectName(),widget);
m_engine->evaluate(src);
QScriptValue v = m_engine->uncaughtException();
if (v.isValid())
qDebug("Error %s",qPrintable(v.toString()));
}
}
//catch (std::exception & e)
//{
// qDebug("Wyjatek %s",e.what());
//}
}// setScript
$ scp /build/czhang/qt-everywhere-opensource-src-4.7.0/projects/AnalogWidgets/analogwidgets/libanalogwidgets_plugin.so root@10.0.0.146://usr/lib
System spec:
Ubuntu 10.04 (lucid)
2.30.2 (Ubuntu 2010-06-25)
2.6.32-33-generic (#70-Ubuntu SMP Thu Jul 7 21:13:52 UTC 2011)
4.4.3 (x86_64-linux-gnu)
AnalogWidgets_234.zip
Download from here:
http://qt-apps.org/content/show.php?content=87780&forumpage=0
unzip it.
$ cd /home/czhang/Downloads/AnalogWidgets
$ qmake AnalogWidgets.pro
$ make
$ sudo make install
$ cp /home/czhang/Downloads/AnalogWidgets/analogwidgets/libanalogwidgets_plugin.so /home/czhang/QtSDK/QtCreator/lib/qtcreator/plugins/designer/libanalogwidgets_plugin.so
In .pro file, added:
LIBS += /home/czhang/Downloads/AnalogWidgets/analogwidgets/libanalogwidgets_plugin.soINCLUDEPATH += /home/czhang/Downloads/AnalogWidgets/analogwidgets/analogwidgetsInstall in Gumstix:
unzip Analogwidget.zip under:
/build/czhang/qt-everywhere-opensource-src-4.7.0/projects
$ qmake AnalogWidgets.pro
$ make
got some error messages according to file:
/build/czhang/AnalogWidgets/analogwidgets/code/chart/channel.cpp
/build/czhang/AnalogWidgets/analogwidgets/code/scriptwidget.cpp
I edited these two files:
in channel.cpp
void Channel::setType(unsigned int i)
{
//if (i!=Line && i!=Dots)
// throw "Bledny typ";
m_type = i;
}
{
//if (i!=Line && i!=Dots)
// throw "Bledny typ";
m_type = i;
}
in scriptwidget.cpp:
void ScriptWidget::setScript(const QString & s)
{
m_script = s;
qDebug("ScriptWidget::setScript() %s",qPrintable(m_script));
try
{
QFile file(m_script);
if (file.open( QIODevice::ReadOnly ))
{
QString src = QString(file.readAll());
QScriptValue widget = m_engine->newQObject(this);
m_engine->globalObject().setProperty(objectName(),widget);
m_engine->evaluate(src);
QScriptValue v = m_engine->uncaughtException();
if (v.isValid())
qDebug("Error %s",qPrintable(v.toString()));
}
}
//catch (std::exception & e)
//{
// qDebug("Wyjatek %s",e.what());
//}
}// setScript
$ scp /build/czhang/qt-everywhere-opensource-src-4.7.0/projects/AnalogWidgets/analogwidgets/libanalogwidgets_plugin.so root@10.0.0.146://usr/lib
18/05/2011
Summary of Installation All Necessary Libraries for Qt programming
1) Serial port communication lib:
http://oestudyard.blogspot.com/2009/09/add-serial-port-communication-lib-in-qt.html?zx=b682084f36b1c11d
2) quazip lib:
3) qwt 2D plot lib:
ubuntu: http://oestudyard.blogspot.co.nz/2010/10/install-qwt-in-ubuntu.html
fedora: http://oestudyard.blogspot.com/2011/05/install-qwt-in-fedora-14.html
gunstix: http://oestudyard.blogspot.com/2010/11/install-qwt-for-gumstix.html
4) sqlite3 database lib:
ubuntu: apt-get install sqlite3
gunstix: http://oestudyard.blogspot.com/2011/02/install-sqlite3-library-in-gumstix-for.html
5) SVN subversion control:
http://oestudyard.blogspot.com/2010/10/subversion-control-svn.html
6) AnalogWidget lib:
http://oestudyard.blogspot.com/2009/09/add-serial-port-communication-lib-in-qt.html?zx=b682084f36b1c11d
2) quazip lib:
3) qwt 2D plot lib:
ubuntu: http://oestudyard.blogspot.co.nz/2010/10/install-qwt-in-ubuntu.html
fedora: http://oestudyard.blogspot.com/2011/05/install-qwt-in-fedora-14.html
gunstix: http://oestudyard.blogspot.com/2010/11/install-qwt-for-gumstix.html
4) sqlite3 database lib:
ubuntu: apt-get install sqlite3
gunstix: http://oestudyard.blogspot.com/2011/02/install-sqlite3-library-in-gumstix-for.html
5) SVN subversion control:
http://oestudyard.blogspot.com/2010/10/subversion-control-svn.html
6) AnalogWidget lib:
11/05/2011
Install QWT in Fedora 14
yum install libQtGTL
yum install libQtGTL-devel
yum install gcc-c++
yum install qt-devel
1. Install Qt programm (Will be installed in /home/czhang/QtDSK)
2. Download qwt-6.0.0.tar.bz2
3. cp qwt-6.0.0.tar.bz2 /home/czhang/
4. tar -xjvf qwt-6.0.0.tar.bz2
5. qmake-qt4
6. make
7. sudo make install
8. sudo cp /home/czhang/qwt-6.0.0/designer/plugins/designer/libqwt_designer_plugin.so /home/czhang/QtSDK/QtCreator/lib/qtcreator/plugins/designer
9 cp -a /home/czhang/qwt-6.0.0/lib/* /usr/lib64 // copy all libqwt.so libqwt.so.6 etc.
10 Add following codes in the end of .pro file in Qt, before build
LIBS += -L/usr/local/lib -lQtSvg
INCLUDEPATH += /usr/local/qwt-6.0.0/include
LIBS += -L/usr/local/qwt-6.0.0-rc5/lib -lqwt
yum install libQtGTL-devel
yum install gcc-c++
yum install qt-devel
1. Install Qt programm (Will be installed in /home/czhang/QtDSK)
2. Download qwt-6.0.0.tar.bz2
3. cp qwt-6.0.0.tar.bz2 /home/czhang/
4. tar -xjvf qwt-6.0.0.tar.bz2
5. qmake-qt4
6. make
7. sudo make install
8. sudo cp /home/czhang/qwt-6.0.0/designer/plugins/designer/libqwt_designer_plugin.so /home/czhang/QtSDK/QtCreator/lib/qtcreator/plugins/designer
9 cp -a /home/czhang/qwt-6.0.0/lib/* /usr/lib64 // copy all libqwt.so libqwt.so.6 etc.
10 Add following codes in the end of .pro file in Qt, before build
LIBS += -L/usr/local/lib -lQtSvg
INCLUDEPATH += /usr/local/qwt-6.0.0/include
LIBS += -L/usr/local/qwt-6.0.0-rc5/lib -lqwt
25/03/2011
Linux library link configuration (libquazip.so)
In Linux system, understanding of how system or application library works is very important. Many applications you download are source files which need to be compiled. for example: qmake, make, make install.
After "make" the source file (typically lib), the lib files will be created, such as:
ln -s libquazip.so.1.0.0 libquazip.so
ln -s libquazip.so.1.0.0 libquazip.so.1
ln -s libquazip.so.1.0.0 libquazip.so.1.0
but these lib file are not installed in Linux system.
After "make install", all lib files has been installed in Linux system.
ln -f -s "libquazip.so.1.0.0" "/usr/local/lib/libquazip.so"
ln -f -s "libquazip.so.1.0.0" "/usr/local/lib/libquazip.so.1"
ln -f -s "libquazip.so.1.0.0" "/usr/local/lib/libquazip.so.1.0"
However, even you "make install" lib files, you may still get error message when you run Qt application. for example, I "make install" QuaZIP package, and successfully compile a test.pro which come with this package, but i still got error message when i run the program:
Starting /home/czhang/quazip-0.3/test/zip-build-desktop/zip...
/home/czhang/quazip-0.3/test/zip-build-desktop/zip: error while loading shared libraries: libquazip.so.1: cannot open shared object file: No such file or directory
/home/czhang/quazip-0.3/test/zip-build-desktop/zip exited with code 127
Why?!! I have been struggling on this problem for long time.
Here is what i understand and solve the problem.
First of all, take a look at "ldconfig" - configure dynamic linker run-time bindings
$ man ldconfig
All applications, if they need lib to run, will check from here first /etc/ld.so.conf
take a look ld.so.conf:
$ cat /etc/ld.so.conf
include /etc/ld.so.conf.d/*.conf
It re-direct to /etc/ld.so.conf.d and all .conf file will be checked through.
Let's take a look at ld.so.conf.d folder
$ ls /etc/ld.so.conf.d
GL.conf libasound2.conf x86_64-linux-gnu.conf
lib32asound2.conf libc.conf Qtlib.conf
in here, we can see a Qtlib.conf file. If you take a look at it, you will see all Qt lib is setting in
/home/czhang/qtsdk-2010.04/lib
When I "make install" QuaZip package, I got message like:
ln -f -s "libquazip.so.1.0.0" "/usr/local/lib/libquazip.so"
ln -f -s "libquazip.so.1.0.0" "/usr/local/lib/libquazip.so.1"
ln -f -s "libquazip.so.1.0.0" "/usr/local/lib/libquazip.so.1.0"
This means all QuaZip libs are stored in /usr/local/lib/
So, I create a new .conf file which call qauzip.conf
$ gedit qauzip.conf
add "/usr/local/lib" in it.
From now on, when Qt tries to use QuaZip lib, it can be found.
Re-compile my "test.pro", and run it, works! :)
Happy end.
$ sudo cp -a /home/czhang/quazip-0.3/quazip libquazip* /usr/lib64
=================================================
EDIT:
when i compile my own program which including QuaZip, i got error messages:
error: undefined reference to `QuaZip::QuaZip(QString const&)'
error: undefined reference to `QuaZip::open(QuaZip::Mode, zlib_filefunc_def_s*)'
...
Then I took a look .pro file,
Actually, I don't really understand the -L. After doing some studies, i learned:
INCLUDEPATH:
This variable specifies the #include (normally header file) directories which should be searched when compiling the project.
LIBS:
This variable contains a list of libraries to be linked into the project. You can use the Unix -l (library) and -L (library path) flags and qmake will do the correct thing with these libraries on Windows (namely this means passing the full path of the library to the linker). The only limitation to this is the library must exist, for qmake to find which directory a -l lib lives in.
Therefore, my .pro file should be like:
After "make" the source file (typically lib), the lib files will be created, such as:
ln -s libquazip.so.1.0.0 libquazip.so
ln -s libquazip.so.1.0.0 libquazip.so.1
ln -s libquazip.so.1.0.0 libquazip.so.1.0
but these lib file are not installed in Linux system.
After "make install", all lib files has been installed in Linux system.
ln -f -s "libquazip.so.1.0.0" "/usr/local/lib/libquazip.so"
ln -f -s "libquazip.so.1.0.0" "/usr/local/lib/libquazip.so.1"
ln -f -s "libquazip.so.1.0.0" "/usr/local/lib/libquazip.so.1.0"
However, even you "make install" lib files, you may still get error message when you run Qt application. for example, I "make install" QuaZIP package, and successfully compile a test.pro which come with this package, but i still got error message when i run the program:
Starting /home/czhang/quazip-0.3/test/zip-build-desktop/zip...
/home/czhang/quazip-0.3/test/zip-build-desktop/zip: error while loading shared libraries: libquazip.so.1: cannot open shared object file: No such file or directory
/home/czhang/quazip-0.3/test/zip-build-desktop/zip exited with code 127
Why?!! I have been struggling on this problem for long time.
Here is what i understand and solve the problem.
First of all, take a look at "ldconfig" - configure dynamic linker run-time bindings
$ man ldconfig
All applications, if they need lib to run, will check from here first /etc/ld.so.conf
take a look ld.so.conf:
$ cat /etc/ld.so.conf
include /etc/ld.so.conf.d/*.conf
It re-direct to /etc/ld.so.conf.d and all .conf file will be checked through.
Let's take a look at ld.so.conf.d folder
$ ls /etc/ld.so.conf.d
GL.conf libasound2.conf x86_64-linux-gnu.conf
lib32asound2.conf libc.conf Qtlib.conf
in here, we can see a Qtlib.conf file. If you take a look at it, you will see all Qt lib is setting in
/home/czhang/qtsdk-2010.04/lib
When I "make install" QuaZip package, I got message like:
ln -f -s "libquazip.so.1.0.0" "/usr/local/lib/libquazip.so"
ln -f -s "libquazip.so.1.0.0" "/usr/local/lib/libquazip.so.1"
ln -f -s "libquazip.so.1.0.0" "/usr/local/lib/libquazip.so.1.0"
This means all QuaZip libs are stored in /usr/local/lib/
So, I create a new .conf file which call qauzip.conf
$ gedit qauzip.conf
add "/usr/local/lib" in it.
From now on, when Qt tries to use QuaZip lib, it can be found.
Re-compile my "test.pro", and run it, works! :)
Happy end.
EDIT:
or, just simply$ sudo cp -a /home/czhang/quazip-0.3/quazip libquazip* /usr/lib64
=================================================
EDIT:
when i compile my own program which including QuaZip, i got error messages:
error: undefined reference to `QuaZip::QuaZip(QString const&)'
error: undefined reference to `QuaZip::open(QuaZip::Mode, zlib_filefunc_def_s*)'
...
Then I took a look .pro file,
INCLUDEPATH += /home/czhang/quazip-0.3/quazipLIBS += -L -lquazipActually, I don't really understand the -L. After doing some studies, i learned:
INCLUDEPATH:
This variable specifies the #include (normally header file) directories which should be searched when compiling the project.
LIBS:
This variable contains a list of libraries to be linked into the project. You can use the Unix -l (library) and -L (library path) flags and qmake will do the correct thing with these libraries on Windows (namely this means passing the full path of the library to the linker). The only limitation to this is the library must exist, for qmake to find which directory a -l lib lives in.
Therefore, my .pro file should be like:
INCLUDEPATH += /home/czhang/quazip-0.3/quazipLIBS += -L/home/czhang/quazip-0.3/quazip -lquazipOr:INCLUDEPATH += /home/czhang/quazip-0.3/quazipLIBS += -lquazip
$ rsync -av czhang@10.0.1.202://build/czhang/qt-everywhere-op
ensource-src-4.7.0/projects/quazip-0.3/quazip/libquazip.so* /usr/lib
ensource-src-4.7.0/projects/quazip-0.3/quazip/libquazip.so* /usr/lib
08/03/2011
some Qt hints
1)
Pushbotton toggled slot:
To make the pushbotton toggled slot working, two parameters need to setup:
Pushbotton toggled slot:
To make the pushbotton toggled slot working, two parameters need to setup:
btn2->setCheckable(TRUE);
btn2->setChecked(TRUE); 2)ListView application:
In QListView, i need to display all files in a directory, and pass the file name when i click a file from list. QDirModel *dirModel = new QDirModel;
ui->listView->setModel(dirModel);
ui->listView->setRootIndex(dirModel->index(QString(QApplication::applicationDirPath()).append("/db")));
connect(ui->listView,SIGNAL(clicked(const QModelIndex &)),this,SLOT(selectionChanged(const QModelIndex &)));
QString hiscDialog::selectionChanged(const QModelIndex & index)
{
ui->label_db->setText(index.data().toString());
dbFile = QString(QApplication::applicationDirPath()).append("/db/" + index.data().toString());
return dbFile;
}
3)QSqlTableModel: After i define a model, and try to read out record from the database, I can only get 256 records each time. It looks like the Qt has some buffer to protect the database. To get all records from database, i can
while (cDmodel->canFetchMore())
cDmodel->fetchMore();
4)Read array from .ini file:
To define syntax in .ini file, the first field in each entry is the index, the second the name of the value, and the value itself comes after an equal sign. also need the size attribute.
This defines a 6-element array called StageNum, where each element has a value called "cycle1" (test.ini):[StageNum]
size = 6
0/cycle1 = 7
1/cycle1 = 22/cycle1 = 53/cycle1 = 24/cycle1 = 35/cycle1 = 0To read array from .ini file:
QSettings m4Settings("test.ini", QSettings::IniFormat);
int arySize = m4Settings.beginReadArray("StageNum");
for (int vL = 0; vL < arySize; vL ++)
{
m4Settings.setArrayIndex(vL);
cycleStageNum[vL] = m4Settings.value("cycle1","0").toInt(); }
m4Settings.endArray();
both read and write:#include
#include
#include
int data[] = { 3, 1, 4, 1, 5, 9 };
int main(int argc, char *argv[])
{
QCoreApplication app(argc, argv);
QSettings m4Settings("test.ini", QSettings::IniFormat);
// Write a test file
m4Settings.beginWriteArray("StageNum");
for (unsigned int i = 0; i < sizeof(data)/sizeof(int); ++i) {
m4Settings.setArrayIndex(i);
m4Settings.setValue("cy1", data[i]);
}
m4Settings.endArray();
// read it back
int arySize = m4Settings.beginReadArray("StageNum");
qDebug() << "arySize =" << arySize;
for (int vL = 0; vL < arySize; vL ++)
{
m4Settings.setArrayIndex(vL);
qDebug()
<< "index =" << vL
<< "cy1 =" << m4Settings.value("cy1", "0").toInt();
}
m4Settings.endArray();
return app.exec();
}
5) Increment label id in loop For()
in my program, i have 10 labels, which indicate 10 led lights.
I can change the color for each label by using
ui->label_led_1->setPixmap(picLedRed);ui->label_led_2->setPixmap(picLedRed);...
To simplify this code by using a loop:
for (int i = 1; i <= 10; i++)
{
QLabel *label = qFindChild(this, "label_led_" + QString::number(i));
if (label) label->setPixmap(picLedRed);
}
23/02/2011
Install sqlite3 library in Gumstix for Qt application
My Qt program will create a database by using sqlite3 plugin app.
The program is working happily in ubuntu, meanwhile, i can use command line to do all sqlite3 command in gumstix. but i got error message when i run it in gumstix.
the error message shows on my touch screen as:
take a look my program:
This indicate that 'mydb' has not been able to created.
The following message is shown in on gumstix prompt.
used 'strace' command to track the error message, and compare stack content between ubuntu and gumstix.
in my ubuntu:
in gumstix:
$ strace -o /home/root/test ./mypro
here is the problem. the Qt in gumstix can not locate the sqlite library interface at directory /home/root/sqldrivers.
"The Qt plugins should be deployed in one of the locations that Qt looks when it needs a plugin: look for Deploying Plugins in Assistant. In the case of the Qsqlite driver you could deploy it in a sub directory "sqldrivers" of the directory containing the program executable or in a plugins/sqldrivers directory of central Qt installation. Similar locations exist for other plugin types."
ok, create a dirctory in gumstix
$ mkdir /home/root/sqldrivers
$ scp czhang@x.x.x.x:/build/czhang/qt-everywhere-opensource-src-4.7.0/plugins/sqldrivers/libqsqlite.so .
Done!
The program is working happily in ubuntu, meanwhile, i can use command line to do all sqlite3 command in gumstix. but i got error message when i run it in gumstix.
the error message shows on my touch screen as:
"Unable to open database, An error occurred while opening the connection."
take a look my program:
// create new database
QDate sDate = QDate::currentDate();
QString dbName;
dbName = QString(QApplication::applicationDirPath()).append("/database/I-" + sDate.toString("MMyyyy") + ".db");
mydb = QSqlDatabase::addDatabase("QSQLITE");
mydb.setDatabaseName(dbName);
if (!QFile::exists(dbName))
{
mydb.open();
QSqlQuery query;
query.exec("create table c1Params (ID int primary key unique, "
"Time QString, Status int, Spare QByteArray)");
mydb.close();
}
if (!mydb.open())
{
QMessageBox::warning(this, tr("Unable to open database"), tr("An error occurred while "
"opening the connection: ") + m4db.lastError().text());
return;
}This indicate that 'mydb' has not been able to created.
The following message is shown in on gumstix prompt.
root@overo:~# ./mypro -qws
Trying to open File
Opened File succesfully
QSqlDatabase: QSQLITE driver not loaded
QSqlDatabase: available drivers:
QSqlQuery::exec: database not open
QSqlQuery::exec: database not open
Segmentation fault
root@overo:~#
used 'strace' command to track the error message, and compare stack content between ubuntu and gumstix.
in my ubuntu:
$ strace -o /home/czhang/Desktop/test ./mypro
.
..
stat("/etc/xdg/Trolltech.conf", 0x7fff4c33bec0) = -1 ENOENT (No such file or directory)
stat("/etc/xdg/Trolltech.conf", 0xec71c8) = -1 ENOENT (No such file or directory)
stat("/usr/lib/kde4/plugins/sqldrivers/.", 0xec7348) = -1 ENOENT (No such file or directory)
lstat("/usr/lib/kde4/plugins/sqldrivers/.", 0x7fff4c33c2a0) = -1 ENOENT (No such file or directory)
stat("/usr/lib/qt4/plugins/sqldrivers/.", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
open("/usr/lib/qt4/plugins/sqldrivers", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 22
statfs("/usr/lib/qt4/plugins/sqldrivers", {f_type="EXT2_SUPER_MAGIC", f_bsize=4096, f_blocks=9612197, f_bfree=7908029, f_bavail=7419748, f_files=2444624, f_ffree=2135156, f_fsid={490287925, 258803822}, f_namelen=255, f_frsize=4096}) = 0
getdents(22, /* 4 entries */, 32768) = 128
stat("/usr/lib/qt4/plugins/sqldrivers/libqsqlmysql.so", {st_mode=S_IFREG|0644, st_size=73432, ...}) = 0
stat("/etc/xdg/Trolltech.conf", 0xec71c8) = -1 ENOENT (No such file or directory)
stat("/usr/lib/kde4/plugins/sqldrivers/.", 0xec7348) = -1 ENOENT (No such file or directory)
lstat("/usr/lib/kde4/plugins/sqldrivers/.", 0x7fff4c33c2a0) = -1 ENOENT (No such file or directory)
stat("/usr/lib/qt4/plugins/sqldrivers/.", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
open("/usr/lib/qt4/plugins/sqldrivers", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 22
statfs("/usr/lib/qt4/plugins/sqldrivers", {f_type="EXT2_SUPER_MAGIC", f_bsize=4096, f_blocks=9612197, f_bfree=7908029, f_bavail=7419748, f_files=2444624, f_ffree=2135156, f_fsid={490287925, 258803822}, f_namelen=255, f_frsize=4096}) = 0
getdents(22, /* 4 entries */, 32768) = 128
stat("/usr/lib/qt4/plugins/sqldrivers/libqsqlmysql.so", {st_mode=S_IFREG|0644, st_size=73432, ...}) = 0
..
.in gumstix:
$ strace -o /home/root/test ./mypro
.
..
stat64("/etc/xdg/Trolltech.conf", 0xbe916208) = -1 ENOENT (No such file or directory)
stat64("/etc/xdg/Trolltech.conf", 0x205ad0) = -1 ENOENT (No such file or directory)
stat64("/home/root/sqldrivers/.", 0x1ef1b8) = -1 ENOENT (No such file or directory)
lstat64("/home/root/sqldrivers/.", 0xbe916400) = -1 ENOENT (No such file or directory)
write(2, "QSqlDatabase: QSQLITE driver not"..., 40) = 40
write(2, "QSqlDatabase: available drivers:"..., 34) = 34
stat64("/etc/xdg/Trolltech.conf", 0x205ad0) = -1 ENOENT (No such file or directory)
stat64("/home/root/sqldrivers/.", 0x1ef1b8) = -1 ENOENT (No such file or directory)
lstat64("/home/root/sqldrivers/.", 0xbe916400) = -1 ENOENT (No such file or directory)
write(2, "QSqlDatabase: QSQLITE driver not"..., 40) = 40
write(2, "QSqlDatabase: available drivers:"..., 34) = 34
..
.
here is the problem. the Qt in gumstix can not locate the sqlite library interface at directory /home/root/sqldrivers.
"The Qt plugins should be deployed in one of the locations that Qt looks when it needs a plugin: look for Deploying Plugins in Assistant. In the case of the Qsqlite driver you could deploy it in a sub directory "sqldrivers" of the directory containing the program executable or in a plugins/sqldrivers directory of central Qt installation. Similar locations exist for other plugin types."
ok, create a dirctory in gumstix
$ mkdir /home/root/sqldrivers
$ scp czhang@x.x.x.x:/build/czhang/qt-everywhere-opensource-src-4.7.0/plugins/sqldrivers/libqsqlite.so .
Done!
17/02/2011
Qt display ° (temperature degree) character in Linux
In my Qt program, I would like to display ° character for temperature.
For example:
QLabel *tempLabel = new QLabel("37°C");
Although the ° character will ouput correctly on Windows, it gives strange things instead on Linux.
This is what I found from Qt forum:
"QString by default assumes a conversion from C Strings using a local 8 bit encoding which is different for different systems. Therefore what works on Windows will not work on Linux. You need to explicitely set what encoding should be used either by QTextCodec::setCodecForCStrings() or by explicitely saying which codec to use for a particular conversion, for instance QString::fromUtf8()."
Here is my new code:
QLabel *tempLabel = new QLabel("37" + QString::fromUtf8("°") + "C");
For example:
QLabel *tempLabel = new QLabel("37°C");
Although the ° character will ouput correctly on Windows, it gives strange things instead on Linux.
This is what I found from Qt forum:
"QString by default assumes a conversion from C Strings using a local 8 bit encoding which is different for different systems. Therefore what works on Windows will not work on Linux. You need to explicitely set what encoding should be used either by QTextCodec::setCodecForCStrings() or by explicitely saying which codec to use for a particular conversion, for instance QString::fromUtf8()."
Here is my new code:
QLabel *tempLabel = new QLabel("37" + QString::fromUtf8("°") + "C");
20/10/2010
Install Qwt in Ubuntu
(link to Install Qwt in Gumstix)
System info:
Ubuntu 10.04 (lucid)
Kernel 2.6.32-26-generic
Qwt: 5.21
Qwt library contains lots of GUI components, such as 2D plot widget.
Download .tar.gz file, extract it. go to that folder:
(PS: qwt-6.0.0-rc3 is quite buggy, use qwt-5.2.1)
$ cd qwt-6.0.0-rc3
$ qmake
$ make
Then, error occurs:
cd src/ && /usr/bin/qmake /home/czhang/qtsdk-2010.04/qwt-6.0.0-rc3/src/src.pro -unix -o Makefile
cd src/ && make -f Makefile
make[1]: Entering directory `/home/czhang/qtsdk-2010.04/qwt-6.0.0-rc3/src'
compiling qwt_abstract_scale_draw.cpp
In file included from qwt_abstract_scale_draw.h:13,
from qwt_abstract_scale_draw.cpp:10:
qwt_global.h:13:21: error: qglobal.h: No such file or directory
In file included from qwt_scale_div.h:14,
from qwt_abstract_scale_draw.h:14,
from qwt_abstract_scale_draw.cpp:10:
qwt_interval.h:15:20: error: qdebug.h: No such file or directory
In file included from qwt_abstract_scale_draw.h:14,
from qwt_abstract_scale_draw.cpp:10:
qwt_scale_div.h:15:19: error: qlist.h: No such file or directory
In file included from qwt_abstract_scale_draw.h:15,
from qwt_abstract_scale_draw.cpp:10:
qwt_text.h:14:21: error: qstring.h: No such file or directory
qwt_text.h:15:19: error: qsize.h: No such file or directory
qwt_text.h:16:19: error: qfont.h: No such file or directory
In file included from qwt_abstract_scale_draw.cpp:11:
qwt_math.h:26:20: error: qpoint.h: No such file or directory
qwt_math.h:27:19: error: qmath.h: No such file or directory
...
When I installed Qt4 creator, it didn't install qt library and source files into the Ubuntu library system. When I use qt creator to compile a program, it uses it's own library files, not the system library files. When I "make" qwt, it is looking for the system library files (and head files .h)
Search the qt4 development installation files, which will install all qt4 library file and source file into system library.
$ apt-cache search qt4-dev
libqwt5-qt4-dev - Qt4 widgets library for technical applications (development)
libsmokeqt4-dev - development files for Qt 4 Smoke library
pyqt4-dev-tools - Development tools for PyQt4
python-qt4-dev - Development files for PyQt4
freecad-doc - FreeCAD documentation
libntrack-qt4-dev - Development package for libntrack-qt4
libqglviewer-qt4-dev - an OpenGL 3D viewer library based on Qt4 - development files
libqwtplot3d-qt4-dev - 3D plotting library based on Qt4/OpenGL (development)
libsoqt4-dev - Qt4 GUI component toolkit for Inventor - development
libsource-highlight-qt4-dev - Syntax highlighting library for Qt (development files)
libtelepathy-qt4-dev - Qt 4 Telepathy library (headers and static library)
libtulip-qt4-dev - Tulip graph library - Qt/OpenGL GUI development files
libvtk5-qt4-dev - Visualization Toolkit - A high level 3D visualization library
libavahi-qt4-dev - Development headers for the Avahi Qt 4 integration library
libpoppler-qt4-dev - PDF rendering library -- development files (Qt 4 interface)
libqt4-dev - Qt 4 development files
libqt4-qt3support - Qt 3 compatibility library for Qt 4
libqt4-sql - Qt 4 SQL module
qt4-dev-tools - Qt 4 development tools
qt4-doc - Qt 4 API documentation
qt4-doc-html - Qt 4 API documentation (HTML format)
$ sudo apt-get install libqt4-dev
then try install again:
$ qmake qwt.pro
$ make
$ sudo make install
done!
run Qt4 creator, no qwt widget!
google a round, need to copy libqwt lib file to Qt plugin folder:
$ cp /home/czhang/qtsdk-2010.04/qwt-6.0.0-rc3/designer/plugins/designer/libqwt_designer_plugin.so /home/czhang/qtsdk-2010.04/bin/designer
run Qt4 creator, still no new widget!
$ cd /home/czhang/qtsdk-2010.04/qwt-6.0.0-rc3/designer/plugins/designer
$ ldd libqwt_designer_plugin.so
linux-vdso.so.1 => (0x00007fff92bff000)
libqwt.so.6 => not found
libQtScript.so.4 => /home/czhang/qtsdk-2010.04/lib/libQtScript.so.4 (0x00007f4205968000)
libQtXml.so.4 => /home/czhang/qtsdk-2010.04/lib/libQtXml.so.4 (0x00007f420571b000)
libQtGui.so.4 => /home/czhang/qtsdk-2010.04/lib/libQtGui.so.4 (0x00007f42049a1000)
libQtCore.so.4 => /home/czhang/qtsdk-2010.04/lib/libQtCore.so.4 (0x00007f42044cb000)
libQtDesigner.so.4 => /home/czhang/qtsdk-2010.04/lib/libQtDesigner.so.4 (0x00007f4203c76000)
libpthread.so.0 => /lib/libpthread.so.0 (0x00007f4203a59000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007f4203745000)
libm.so.6 => /lib/libm.so.6 (0x00007f42034c1000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00007f42032aa000)
libc.so.6 => /lib/libc.so.6 (0x00007f4202f27000)
libgthread-2.0.so.0 => /usr/lib/libgthread-2.0.so.0 (0x00007f4202d21000)
librt.so.1 => /lib/librt.so.1 (0x00007f4202b19000)
libglib-2.0.so.0 => /lib/libglib-2.0.so.0 (0x00007f420283b000)
libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x00007f42025b4000)
libgobject-2.0.so.0 => /usr/lib/libgobject-2.0.so.0 (0x00007f420236c000)
libSM.so.6 => /usr/lib/libSM.so.6 (0x00007f4202163000)
libICE.so.6 => /usr/lib/libICE.so.6 (0x00007f4201f47000)
libXrender.so.1 => /usr/lib/libXrender.so.1 (0x00007f4201d3d000)
libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0x00007f4201b08000)
libz.so.1 => /lib/libz.so.1 (0x00007f42018f0000)
libXext.so.6 => /usr/lib/libXext.so.6 (0x00007f42016de000)
libX11.so.6 => /usr/lib/libX11.so.6 (0x00007f42013a8000)
libdl.so.2 => /lib/libdl.so.2 (0x00007f42011a3000)
/lib64/ld-linux-x86-64.so.2 (0x00007f4206076000)
libpcre.so.3 => /lib/libpcre.so.3 (0x00007f4200f75000)
libuuid.so.1 => /lib/libuuid.so.1 (0x00007f4200d6f000)
libexpat.so.1 => /lib/libexpat.so.1 (0x00007f4200b46000)
libxcb.so.1 => /usr/lib/libxcb.so.1 (0x00007f420092a000)
libXau.so.6 => /usr/lib/libXau.so.6 (0x00007f4200725000)
libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0x00007f420051f000)
this means the libqwt lib files (libqwt.so.6 libqwt.so.6.0 etc) has not been installed in system library, which is in /usr/lib64 (I am using 64bit Ubuntu)
$ sudo cp -a /home/czhang/qtsdk-2010.04/qwt-6.0.0-rc3/lib/* /usr/lib64
$ ldd /home/czhang/qtsdk-2010.04/bin/designer/libqwt_designer_plugin.so
linux-vdso.so.1 => (0x00007fff823ff000)
libqwt.so.6 => /usr/lib/libqwt.so.6 (0x00007f38ab037000)
libQtScript.so.4 => /home/czhang/qtsdk-2010.04/lib/libQtScript.so.4 (0x00007f38aab6e000)
libQtXml.so.4 => /home/czhang/qtsdk-2010.04/lib/libQtXml.so.4 (0x00007f38aa921000)
libQtGui.so.4 => /home/czhang/qtsdk-2010.04/lib/libQtGui.so.4 (0x00007f38a9ba7000)
libQtCore.so.4 => /home/czhang/qtsdk-2010.04/lib/libQtCore.so.4 (0x00007f38a96d1000)
libQtDesigner.so.4 => /home/czhang/qtsdk-2010.04/lib/libQtDesigner.so.4 (0x00007f38a8e7c000)
libpthread.so.0 => /lib/libpthread.so.0 (0x00007f38a8c5f000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007f38a894b000)
libm.so.6 => /lib/libm.so.6 (0x00007f38a86c7000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00007f38a84b0000)
libc.so.6 => /lib/libc.so.6 (0x00007f38a812d000)
libQtSvg.so.4 => /home/czhang/qtsdk-2010.04/lib/libQtSvg.so.4 (0x00007f38a7ecd000)
libgthread-2.0.so.0 => /usr/lib/libgthread-2.0.so.0 (0x00007f38a7cc8000)
librt.so.1 => /lib/librt.so.1 (0x00007f38a7abf000)
libglib-2.0.so.0 => /lib/libglib-2.0.so.0 (0x00007f38a77e1000)
libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x00007f38a755b000)
libgobject-2.0.so.0 => /usr/lib/libgobject-2.0.so.0 (0x00007f38a7312000)
libSM.so.6 => /usr/lib/libSM.so.6 (0x00007f38a7109000)
libICE.so.6 => /usr/lib/libICE.so.6 (0x00007f38a6eee000)
libXrender.so.1 => /usr/lib/libXrender.so.1 (0x00007f38a6ce3000)
libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0x00007f38a6aae000)
libz.so.1 => /lib/libz.so.1 (0x00007f38a6897000)
libXext.so.6 => /usr/lib/libXext.so.6 (0x00007f38a6684000)
libX11.so.6 => /usr/lib/libX11.so.6 (0x00007f38a634e000)
libdl.so.2 => /lib/libdl.so.2 (0x00007f38a614a000)
/lib64/ld-linux-x86-64.so.2 (0x00007f38ab569000)
libpcre.so.3 => /lib/libpcre.so.3 (0x00007f38a5f1b000)
libuuid.so.1 => /lib/libuuid.so.1 (0x00007f38a5d16000)
libexpat.so.1 => /lib/libexpat.so.1 (0x00007f38a5aec000)
libxcb.so.1 => /usr/lib/libxcb.so.1 (0x00007f38a58d0000)
libXau.so.6 => /usr/lib/libXau.so.6 (0x00007f38a56cc000)
libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0x00007f38a54c5000)
run Qt4 creator, sweat, see them!
After add a Qwt widget, built project, get some error messages:
error: undefined reference to 'QGraphicsItemPrivate::height() const' libQtSvg.so.4
error: undefined reference to 'QListData::detach(int)' libQtSvg.so.4
error: undefined reference to 'QGraphicsItemPrivate::setWidth(double)' libQtSvg.so.4
error: undefined reference to 'QGraphicsItemPrivate::width() const' libQtSvg.so.4
error: undefined reference to 'QGraphicsItemPrivate::setHeight(double)' libQtSvg.so.4
error: undefined reference to 'QGraphicsItemPrivate::resetHeight()' libQtSvg.so.4
error: undefined reference to 'QGraphicsItemPrivate::resetWidth()' libQtSvg.so.4
error: undefined reference to 'QListData::detach_grow(int*, int)' libQtSvg.so.4
error: collect2: ld returned 1 exit status
google around, found i need to add link to QtSvg in .pro file
LIBS += -L/usr/local/lib -lQtSvg
build program, good.
*==============================*
"anyone needs fully operational qwt install guide on qwt?? I made one! I'm ready to share with all of you my 2 day nervebraking job. In the end: this whole thing is so easy, when you have right information! The only thing, that above tutorial is missing is the "sudo apt-get install libqt4-dev" command. We need to make sure that this package is installed, otherwise the MAKE command was failing for me, and i think for some other people. This package is not installed automatically with QT4, so we need to finish it manually."
Post your opinions on above steps. I would like to hear them!
*==============================*
5. apt-cache search qt4-dev //Unnecessary, just to see 12. cd /etc/ld.so.conf.d/13. sudo gedit qwt.conf //After opening GEdit write following, in the end save the file and close:/usr/local/qwt-6.0.0-rc5/lib14. sudo ldconfig15. ldconfig -p | grep qwt16. sudo cp /home/tulga/qwt-6.0.0-rc5/designer/plugins/designer/libqwt_designer_plugin.so /home/tulga/qtsdk-2010.05/bin/designer/
===============================
The following installation guide from Uwe.
1) Download qwt-5.2.1.tar.bz2
2) tar xfj qwt-5.2.1.tar.bz2
3) cd qwt-5.2.1
4) qmake
5) make
6) su -c "make install" ( Boys, what's so hard about doing this ? )
Now the designer plugin should be copied into the plugins/designer directory of your Qt install directory. All other files can be found in /usr/local/qwt-5.2.1.
The following steps are Linux or Qt basics:
7) The Qwt designer plugin ( or any application using Qwt ) needs to see the Qwt library. Read about ldconfig or LD_LIBRARY_PATH how to do so. Don't continue before "ldd/plugins/designer/libqwt_designer_plugin.so" shows a valid path for libqwt.so.
When using LD_LIBRARY_PATH note, that an environment variable is only valid for the process itsself and its child processes. Until you have understood what this means better start the designer/creator manually from the shell, where you have set LD_LIBRARY_PATH.
8) Add the following to your application project file
System info:
Ubuntu 10.04 (lucid)
Kernel 2.6.32-26-generic
Qwt: 5.21
Qwt library contains lots of GUI components, such as 2D plot widget.
Download .tar.gz file, extract it. go to that folder:
(PS: qwt-6.0.0-rc3 is quite buggy, use qwt-5.2.1)
$ cd qwt-6.0.0-rc3
$ qmake
$ make
Then, error occurs:
cd src/ && /usr/bin/qmake /home/czhang/qtsdk-2010.04/qwt-6.0.0-rc3/src/src.pro -unix -o Makefile
cd src/ && make -f Makefile
make[1]: Entering directory `/home/czhang/qtsdk-2010.04/qwt-6.0.0-rc3/src'
compiling qwt_abstract_scale_draw.cpp
In file included from qwt_abstract_scale_draw.h:13,
from qwt_abstract_scale_draw.cpp:10:
qwt_global.h:13:21: error: qglobal.h: No such file or directory
In file included from qwt_scale_div.h:14,
from qwt_abstract_scale_draw.h:14,
from qwt_abstract_scale_draw.cpp:10:
qwt_interval.h:15:20: error: qdebug.h: No such file or directory
In file included from qwt_abstract_scale_draw.h:14,
from qwt_abstract_scale_draw.cpp:10:
qwt_scale_div.h:15:19: error: qlist.h: No such file or directory
In file included from qwt_abstract_scale_draw.h:15,
from qwt_abstract_scale_draw.cpp:10:
qwt_text.h:14:21: error: qstring.h: No such file or directory
qwt_text.h:15:19: error: qsize.h: No such file or directory
qwt_text.h:16:19: error: qfont.h: No such file or directory
In file included from qwt_abstract_scale_draw.cpp:11:
qwt_math.h:26:20: error: qpoint.h: No such file or directory
qwt_math.h:27:19: error: qmath.h: No such file or directory
...
When I installed Qt4 creator, it didn't install qt library and source files into the Ubuntu library system. When I use qt creator to compile a program, it uses it's own library files, not the system library files. When I "make" qwt, it is looking for the system library files (and head files .h)
Search the qt4 development installation files, which will install all qt4 library file and source file into system library.
$ apt-cache search qt4-dev
libqwt5-qt4-dev - Qt4 widgets library for technical applications (development)
libsmokeqt4-dev - development files for Qt 4 Smoke library
pyqt4-dev-tools - Development tools for PyQt4
python-qt4-dev - Development files for PyQt4
freecad-doc - FreeCAD documentation
libntrack-qt4-dev - Development package for libntrack-qt4
libqglviewer-qt4-dev - an OpenGL 3D viewer library based on Qt4 - development files
libqwtplot3d-qt4-dev - 3D plotting library based on Qt4/OpenGL (development)
libsoqt4-dev - Qt4 GUI component toolkit for Inventor - development
libsource-highlight-qt4-dev - Syntax highlighting library for Qt (development files)
libtelepathy-qt4-dev - Qt 4 Telepathy library (headers and static library)
libtulip-qt4-dev - Tulip graph library - Qt/OpenGL GUI development files
libvtk5-qt4-dev - Visualization Toolkit - A high level 3D visualization library
libavahi-qt4-dev - Development headers for the Avahi Qt 4 integration library
libpoppler-qt4-dev - PDF rendering library -- development files (Qt 4 interface)
libqt4-dev - Qt 4 development files
libqt4-qt3support - Qt 3 compatibility library for Qt 4
libqt4-sql - Qt 4 SQL module
qt4-dev-tools - Qt 4 development tools
qt4-doc - Qt 4 API documentation
qt4-doc-html - Qt 4 API documentation (HTML format)
$ sudo apt-get install libqt4-dev
then try install again:
$ qmake qwt.pro
$ make
$ sudo make install
done!
run Qt4 creator, no qwt widget!
google a round, need to copy libqwt lib file to Qt plugin folder:
$ cp /home/czhang/qtsdk-2010.04/qwt-6.0.0-rc3/designer/plugins/designer/libqwt_designer_plugin.so /home/czhang/qtsdk-2010.04/bin/designer
run Qt4 creator, still no new widget!
$ cd /home/czhang/qtsdk-2010.04/qwt-6.0.0-rc3/designer/plugins/designer
$ ldd libqwt_designer_plugin.so
linux-vdso.so.1 => (0x00007fff92bff000)
libqwt.so.6 => not found
libQtScript.so.4 => /home/czhang/qtsdk-2010.04/lib/libQtScript.so.4 (0x00007f4205968000)
libQtXml.so.4 => /home/czhang/qtsdk-2010.04/lib/libQtXml.so.4 (0x00007f420571b000)
libQtGui.so.4 => /home/czhang/qtsdk-2010.04/lib/libQtGui.so.4 (0x00007f42049a1000)
libQtCore.so.4 => /home/czhang/qtsdk-2010.04/lib/libQtCore.so.4 (0x00007f42044cb000)
libQtDesigner.so.4 => /home/czhang/qtsdk-2010.04/lib/libQtDesigner.so.4 (0x00007f4203c76000)
libpthread.so.0 => /lib/libpthread.so.0 (0x00007f4203a59000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007f4203745000)
libm.so.6 => /lib/libm.so.6 (0x00007f42034c1000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00007f42032aa000)
libc.so.6 => /lib/libc.so.6 (0x00007f4202f27000)
libgthread-2.0.so.0 => /usr/lib/libgthread-2.0.so.0 (0x00007f4202d21000)
librt.so.1 => /lib/librt.so.1 (0x00007f4202b19000)
libglib-2.0.so.0 => /lib/libglib-2.0.so.0 (0x00007f420283b000)
libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x00007f42025b4000)
libgobject-2.0.so.0 => /usr/lib/libgobject-2.0.so.0 (0x00007f420236c000)
libSM.so.6 => /usr/lib/libSM.so.6 (0x00007f4202163000)
libICE.so.6 => /usr/lib/libICE.so.6 (0x00007f4201f47000)
libXrender.so.1 => /usr/lib/libXrender.so.1 (0x00007f4201d3d000)
libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0x00007f4201b08000)
libz.so.1 => /lib/libz.so.1 (0x00007f42018f0000)
libXext.so.6 => /usr/lib/libXext.so.6 (0x00007f42016de000)
libX11.so.6 => /usr/lib/libX11.so.6 (0x00007f42013a8000)
libdl.so.2 => /lib/libdl.so.2 (0x00007f42011a3000)
/lib64/ld-linux-x86-64.so.2 (0x00007f4206076000)
libpcre.so.3 => /lib/libpcre.so.3 (0x00007f4200f75000)
libuuid.so.1 => /lib/libuuid.so.1 (0x00007f4200d6f000)
libexpat.so.1 => /lib/libexpat.so.1 (0x00007f4200b46000)
libxcb.so.1 => /usr/lib/libxcb.so.1 (0x00007f420092a000)
libXau.so.6 => /usr/lib/libXau.so.6 (0x00007f4200725000)
libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0x00007f420051f000)
this means the libqwt lib files (libqwt.so.6 libqwt.so.6.0 etc) has not been installed in system library, which is in /usr/lib64 (I am using 64bit Ubuntu)
$ sudo cp -a /home/czhang/qtsdk-2010.04/qwt-6.0.0-rc3/lib/* /usr/lib64
$ ldd /home/czhang/qtsdk-2010.04/bin/designer/libqwt_designer_plugin.so
linux-vdso.so.1 => (0x00007fff823ff000)
libqwt.so.6 => /usr/lib/libqwt.so.6 (0x00007f38ab037000)
libQtScript.so.4 => /home/czhang/qtsdk-2010.04/lib/libQtScript.so.4 (0x00007f38aab6e000)
libQtXml.so.4 => /home/czhang/qtsdk-2010.04/lib/libQtXml.so.4 (0x00007f38aa921000)
libQtGui.so.4 => /home/czhang/qtsdk-2010.04/lib/libQtGui.so.4 (0x00007f38a9ba7000)
libQtCore.so.4 => /home/czhang/qtsdk-2010.04/lib/libQtCore.so.4 (0x00007f38a96d1000)
libQtDesigner.so.4 => /home/czhang/qtsdk-2010.04/lib/libQtDesigner.so.4 (0x00007f38a8e7c000)
libpthread.so.0 => /lib/libpthread.so.0 (0x00007f38a8c5f000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007f38a894b000)
libm.so.6 => /lib/libm.so.6 (0x00007f38a86c7000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00007f38a84b0000)
libc.so.6 => /lib/libc.so.6 (0x00007f38a812d000)
libQtSvg.so.4 => /home/czhang/qtsdk-2010.04/lib/libQtSvg.so.4 (0x00007f38a7ecd000)
libgthread-2.0.so.0 => /usr/lib/libgthread-2.0.so.0 (0x00007f38a7cc8000)
librt.so.1 => /lib/librt.so.1 (0x00007f38a7abf000)
libglib-2.0.so.0 => /lib/libglib-2.0.so.0 (0x00007f38a77e1000)
libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x00007f38a755b000)
libgobject-2.0.so.0 => /usr/lib/libgobject-2.0.so.0 (0x00007f38a7312000)
libSM.so.6 => /usr/lib/libSM.so.6 (0x00007f38a7109000)
libICE.so.6 => /usr/lib/libICE.so.6 (0x00007f38a6eee000)
libXrender.so.1 => /usr/lib/libXrender.so.1 (0x00007f38a6ce3000)
libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0x00007f38a6aae000)
libz.so.1 => /lib/libz.so.1 (0x00007f38a6897000)
libXext.so.6 => /usr/lib/libXext.so.6 (0x00007f38a6684000)
libX11.so.6 => /usr/lib/libX11.so.6 (0x00007f38a634e000)
libdl.so.2 => /lib/libdl.so.2 (0x00007f38a614a000)
/lib64/ld-linux-x86-64.so.2 (0x00007f38ab569000)
libpcre.so.3 => /lib/libpcre.so.3 (0x00007f38a5f1b000)
libuuid.so.1 => /lib/libuuid.so.1 (0x00007f38a5d16000)
libexpat.so.1 => /lib/libexpat.so.1 (0x00007f38a5aec000)
libxcb.so.1 => /usr/lib/libxcb.so.1 (0x00007f38a58d0000)
libXau.so.6 => /usr/lib/libXau.so.6 (0x00007f38a56cc000)
libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0x00007f38a54c5000)
run Qt4 creator, sweat, see them!
After add a Qwt widget, built project, get some error messages:
error: undefined reference to 'QGraphicsItemPrivate::height() const' libQtSvg.so.4
error: undefined reference to 'QListData::detach(int)' libQtSvg.so.4
error: undefined reference to 'QGraphicsItemPrivate::setWidth(double)' libQtSvg.so.4
error: undefined reference to 'QGraphicsItemPrivate::width() const' libQtSvg.so.4
error: undefined reference to 'QGraphicsItemPrivate::setHeight(double)' libQtSvg.so.4
error: undefined reference to 'QGraphicsItemPrivate::resetHeight()' libQtSvg.so.4
error: undefined reference to 'QGraphicsItemPrivate::resetWidth()' libQtSvg.so.4
error: undefined reference to 'QListData::detach_grow(int*, int)' libQtSvg.so.4
error: collect2: ld returned 1 exit status
google around, found i need to add link to QtSvg in .pro file
LIBS += -L/usr/local/lib -lQtSvg
build program, good.
*==============================*
The following QWT installation guide is contributed by Tulga. After a long struggle on fighting with QWT, Tulga installed QWT successfully on Ubuntu :) good job!
"anyone needs fully operational qwt install guide on qwt?? I made one! I'm ready to share with all of you my 2 day nervebraking job. In the end: this whole thing is so easy, when you have right information! The only thing, that above tutorial is missing is the "sudo apt-get install libqt4-dev" command. We need to make sure that this package is installed, otherwise the MAKE command was failing for me, and i think for some other people. This package is not installed automatically with QT4, so we need to finish it manually."
QWT installation on QT steps (in 7 minutes!):
sudo apt-get install libqt4-core libqt4-dev libqt4-gui
sudo apt-get install build-essential libqt4-dev zlib1g zlib1g-dev qt4-dev-tools
By Tulga:
1. Install QT programm (and make sure that all dependencies are installed --> will ask during setup) (Will be installed in /home/tulga/)
2. Download qwt-6.0.0-rc5.tar.bz2
3. cp qwt-6.0.0-rc5.tar.bz2 /home/tulga/
4. tar -xjvf qwt-6.0.0-rc5.tar.bz2
5. apt-cache search qt4-dev //Unnecessary, just to see
6. sudo apt-get install libqt4-dev //This is vital part of successful MAKE
7. qmake
8. make
9. sudo make install
10. sudo cp /home/tulga/qwt-6.0.0-rc5/designer/plugins/designer/libqwt_designer_plugin.so /home/tulga/qtsdk-2010.05/bin/designer/
11. ldd libqwt_designer_plugin.so //Unnecessary, just to see
12. cd /etc/ld.so.conf.d/
13. sudo gedit qwt.conf //After opening GEdit write following, in the end save the file and close:
/usr/local/qwt-6.0.0-rc5/lib
14. sudo ldconfig
15. ldconfig -p | grep qwt
16. sudo cp /home/tulga/qwt-6.0.0-rc5/designer/plugins/designer/libqwt_designer_plugin.so /home/tulga/qtsdk-2010.05/bin/designer/
17. Add following codes in the end of .pro file in Qt, before build
LIBS += -L/usr/local/lib -lQtSvg
INCLUDEPATH += /usr/local/qwt-6.0.0-rc5/include
LIBS += -L/usr/local/qwt-6.0.0-rc5/lib -lqwt
18. EnjoY! QWT Designer plugin is in QT Designer.
sudo apt-get install libqt4-core libqt4-dev libqt4-gui
sudo apt-get install build-essential libqt4-dev zlib1g zlib1g-dev qt4-dev-tools
By Tulga:
1. Install QT programm (and make sure that all dependencies are installed --> will ask during setup) (Will be installed in /home/tulga/)
2. Download qwt-6.0.0-rc5.tar.bz2
3. cp qwt-6.0.0-rc5.tar.bz2 /home/tulga/
4. tar -xjvf qwt-6.0.0-rc5.tar.bz2
5. apt-cache search qt4-dev //Unnecessary, just to see
6. sudo apt-get install libqt4-dev //This is vital part of successful MAKE
7. qmake
8. make
9. sudo make install
10. sudo cp /home/tulga/qwt-6.0.0-rc5/designer/plugins/designer/libqwt_designer_plugin.so /home/tulga/qtsdk-2010.05/bin/designer/
11. ldd libqwt_designer_plugin.so //Unnecessary, just to see
12. cd /etc/ld.so.conf.d/
13. sudo gedit qwt.conf //After opening GEdit write following, in the end save the file and close:
/usr/local/qwt-6.0.0-rc5/lib
14. sudo ldconfig
15. ldconfig -p | grep qwt
16. sudo cp /home/tulga/qwt-6.0.0-rc5/designer/plugins/designer/libqwt_designer_plugin.so /home/tulga/qtsdk-2010.05/bin/designer/
17. Add following codes in the end of .pro file in Qt, before build
LIBS += -L/usr/local/lib -lQtSvg
INCLUDEPATH += /usr/local/qwt-6.0.0-rc5/include
LIBS += -L/usr/local/qwt-6.0.0-rc5/lib -lqwt
18. EnjoY! QWT Designer plugin is in QT Designer.
Post your opinions on above steps. I would like to hear them!
*==============================*
After tried Tulga's method, some steps need to be correct. Meanwhile, I am still using qwt.5.2.1, because qwt.6.0.0 has made some changes. For example, qwt_data.h is changed to be QwtSeriesData.h. I don't want to change my code which based on qwt-5.2.1.
Here is Tulga's method version 2:
sudo apt-get install libqt4-core libqt4-dev libqt4-gui
sudo apt-get install build-essential libqt4-dev zlib1g zlib1g-dev qt4-dev-tools
1. Install QT programm (and make sure that all dependencies are installed --> will ask during setup) (Will be installed in /home/tulga/)
2. Download qwt-5.2.1.tar.bz2
3. cp qwt-5.2.1.tar.bz2 /home/tulga/
4. tar -xjvf qwt-5.2.1.tar.bz2
6. sudo apt-get install libqt4-dev //This is vital part of successful MAKE
7. qmake
8. make
9. sudo make install
10. sudo cp /home/tulga/qwt-5.2.1/designer/plugins/designer/libqwt_designer_plugin.so /home/tulga/qtsdk-2010.05/bin/designer/
11. ldd libqwt_designer_plugin.so //Unnecessary, just to see
(add:
$ sudo cp -a /home/czhang/qwt-5.2.1/lib/* /usr/lib64
$ ldd /home/czhang/qwt-5.2.1/designer/plugins/designer/libqwt_designer_plugin.so)
17. Add following codes in the end of .pro file in Qt, before build
LIBS += -L/usr/local/lib -lQtSvg
INCLUDEPATH += /usr/local/qwt-5.2.1/include
LIBS += -L/usr/local/qwt-5.2.1/lib -lqwt
18. EnjoY! QWT Designer plugin is in QT Designer.
===============================
The following installation guide from Uwe.
1) Download qwt-5.2.1.tar.bz2
2) tar xfj qwt-5.2.1.tar.bz2
3) cd qwt-5.2.1
4) qmake
5) make
6) su -c "make install" ( Boys, what's so hard about doing this ? )
Now the designer plugin should be copied into the plugins/designer directory of your Qt install directory. All other files can be found in /usr/local/qwt-5.2.1.
The following steps are Linux or Qt basics:
7) The Qwt designer plugin ( or any application using Qwt ) needs to see the Qwt library. Read about ldconfig or LD_LIBRARY_PATH how to do so. Don't continue before "ldd
When using LD_LIBRARY_PATH note, that an environment variable is only valid for the process itsself and its child processes. Until you have understood what this means better start the designer/creator manually from the shell, where you have set LD_LIBRARY_PATH.
8) Add the following to your application project file
INCLUDEPATH += /usr/local/qwt-5.2.1/include
LIB += -L/usr/local/qwt-5.2.1/lib -lqwt11/10/2010
Touch Screen (Gumstix)
Calibrate the screen:
$ cd /usr/bin
$ ts_calibrate
when I run my Qt project, the mouse curse is still incorrect. That's because the Qt does know which touch screen library can be used.
//$ export QWS_DISPLAY="VNC:LinuxFB"
$ export QWS_MOUSE_PROTO="tslib:/dev/input/touchscreen0"
Hint 1: in /~ directory, ".profile" contains commands to be executed after log on.
Therefore, I can add these two export files in ".profile" to load these two command lines automatically when I log in. Alternative, ".bashrc" file does the same job as ".profile" does.
Hint 2: In almost Linux system (except Ubuntu), system checks /etc/inittab file first when start pc. You can tell which run level is the default from it. Normally rc5 is the default run level. You can add you own applications in rc5.d/S99xxx. The system will run these applications automatically (before log in step).
EDIT:
system will run rcS.d first, then rc5.d
a) applications should be added after "rm nologin"
#! /bin/sh
#
# rmnologin This script removes the /etc/nologin file as the last
# step in the boot process.
#
# Version: @(#)rmnologin 1.00 22-Jun-1998 miquels@cistron.nl
#
if test -f /etc/nologin.boot
then
rm -f /etc/nologin /etc/nologin.boot
fi
export QWS_MOUSE_PROTO="tslib:/dev/input/touchscreen0"
/home/czhang/m4 -qws &
: exit 0
b) applications should followed by '&' to make sure they all run on the background, and not affect the login step.
/home/czhang/m4 -qws &
Note: Qt has a build in vnc. we can remotely view the program running on gumstix screen.
I installed vncviewer on my ubuntu machine, and run as:
$ vncviewer 10.0.0.xx (gumstix IP address)
$ cd /usr/bin
$ ts_calibrate
when I run my Qt project, the mouse curse is still incorrect. That's because the Qt does know which touch screen library can be used.
//$ export QWS_DISPLAY="VNC:LinuxFB"
$ export QWS_MOUSE_PROTO="tslib:/dev/input/touchscreen0"
Hint 1: in /~ directory, ".profile" contains commands to be executed after log on.
Therefore, I can add these two export files in ".profile" to load these two command lines automatically when I log in. Alternative, ".bashrc" file does the same job as ".profile" does.
Hint 2: In almost Linux system (except Ubuntu), system checks /etc/inittab file first when start pc. You can tell which run level is the default from it. Normally rc5 is the default run level. You can add you own applications in rc5.d/S99xxx. The system will run these applications automatically (before log in step).
EDIT:
system will run rcS.d first, then rc5.d
a) applications should be added after "rm nologin"
#! /bin/sh
#
# rmnologin This script removes the /etc/nologin file as the last
# step in the boot process.
#
# Version: @(#)rmnologin 1.00 22-Jun-1998 miquels@cistron.nl
#
if test -f /etc/nologin.boot
then
rm -f /etc/nologin /etc/nologin.boot
fi
# add from here
export QWS_DISPLAY="VNC:LinuxFB"export QWS_MOUSE_PROTO="tslib:/dev/input/touchscreen0"
/home/czhang/m4 -qws &
: exit 0
b) applications should followed by '&' to make sure they all run on the background, and not affect the login step.
/home/czhang/m4 -qws &
Note: Qt has a build in vnc. we can remotely view the program running on gumstix screen.
I installed vncviewer on my ubuntu machine, and run as:
$ vncviewer 10.0.0.xx (gumstix IP address)
----------------------------
To use standard USB mouse in gumstix, use following command:
$ export QWS_MOUSE_PROTO= AutoRemove Title Bar from Qt Application
in each window program, add
This code need to add each window which need to remove title bar.
// remove window frame
Qt::WindowFlags flags = windowFlags();
if (flags.testFlag(Qt::FramelessWindowHint))
return;
flags |= Qt::FramelessWindowHint;
setWindowFlags(flags);
Qt::WindowFlags flags = windowFlags();
if (flags.testFlag(Qt::FramelessWindowHint))
return;
flags |= Qt::FramelessWindowHint;
setWindowFlags(flags);
//show();
This code need to add each window which need to remove title bar.
08/10/2010
Running Qt in Gumstix
first of all, make sure your can create a bootable microSD card. Follow the instruction:
http://www.gumstix.net/Overo/view/Overo-Setup-and-Programming/Creating-a-bootable-microSD-card/115.html
http://www.gumstix.org/create-a-bootable-microsd-card.html
Overo and verdex pro COMs will boot directly from a properly prepared microSD card. This section will outline how to partition and format a bootable microSD card.
To create a bootable microSD, compatible with the·OMAP3 boot ROM, set a special geometry using the·fdisk "Expert mode". These steps also work for verdex pro COMs.
Important Notes:
- When creating a bootable microSD card for an·Overo COM,·you MUST use expert mode. This sets the correct cylinders, heads and sectors for the microSD card before you partition it.
- Gumstix recommends using a microSDHC card for Overo COMs. Only use microSD cards for verdex pro COMs.
The example below shows the steps required to set up a new microSD card of any size. The numbers shown are given for a particular 2GB microSD card. You will be directed to make a simple calculation to determine the correct values for your microSD card.
First, insert your card into the development machine's flash card slot. You may need to use a microSD to SD card adaptor to fit your slot. example the device name will be /dev/sde. Please substitute the proper device name for your machine. You can use 'mount' or 'df' to see where the card mounts on your machine. Let's unmount the device's existing file system before we get started with fdisk:
$ sudo umount /dev/sde1
Partitioning the Card
Now, launch fdisk and create an empty partition table. Note that the argument for fdisk is the entire device (/dev/sde) not just a single partition (i.e. /dev/sde1):
# sudo fdisk /dev/sde
Command (m for help): o
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Let's first look at the current card information:
Command (m for help): p
Disk /dev/sde: 2032 MB, 2032664576 bytes
64 heads, 63 sectors/track, 984 cylinders
Units = cylinders of 4032 * 512 = 2064384 bytes
Disk identifier: 0x00aa8e5c
Device Boot Start End Blocks Id System
Note the card size in bytes. We will need it later in the process.
Now go into "Expert" mode:
Command (m for help): x
Next, set the geometry to 255 heads, 63 sectors and a calculated value for the number of cylinders required for the particular microSD card. To calculate the number of cylinders, take the 2032664576 bytes reported above by fdisk, divide by 255 heads, 63 sectors and 512 bytes per sector: 2032664576 / 255 / 63 / 512 = 247.12 which we round·down to 247 cylinders.
Expert command (m for help): h
Number of heads (1-256, default 4): 255
Expert command (m for help): s
Number of sectors (1-63, default 62): 63
Warning: setting sector offset for DOS compatiblity
Expert command (m for help): c
Number of cylinders (1-1048576, default 984): 247
Return to fdisk's main mode and create a new partition 32 MB FAT partition:
Expert command (m for help): r
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-247, default 1): 1
Last cylinder or +size or +sizeM or +sizeK (1-247, default 15): +32M
Change the partition type to FAT32:
Command (m for help): t
Selected partition 1
Hex code (type L to list codes): c
Changed system type of partition 1 to c (W95 FAT32 (LBA))
Mark it bootable:
Command (m for help): a
Partition number (1-4): 1
Now, create an ext3 partition for the rootfs:
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (6-247, default 6): 6
Last cylinder or +size or +sizeM or +sizeK (6-247, default 247): 247
To verify your work, print the partition info:
Command (m for help): p
Disk /dev/sde: 2032 MB, 2032664576 bytes
255 heads, 63 sectors/track, 247 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00aa8e5c
Device Boot Start End Blocks Id System
/dev/sde1 * 1 5 40131 c W95 FAT32 (LBA)
/dev/sde2 6 247 1943865 83 Linux
Finally, write the new partition table to the card and then exit:
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: If you have created or modified any DOS 6.x
partitions, please see the fdisk manual page for additional
information.
Syncing disks
Formatting the New Partitions
Format the first partition as an FAT file system (the -n parameter gives it a label of FAT). You can change or omit this if you like.
$ sudo mkfs.vfat -F 32 /dev/sde1 -n FAT
mkfs.vfat 2.11 (12 Mar 2005)
Format the second partition as an ext3 file system:
$ sudo mkfs.ext3 /dev/sde2
mke2fs 1.40.8 (13-Mar-2008)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
121920 inodes, 485966 blocks
24298 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=499122176
15 block groups
32768 blocks per group, 32768 fragments per group
8128 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: ^[done
This filesystem will be automatically checked every 36 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
Installing the Boot Files
There are three files required on the first (FAT) partition to boot your Overo.
1) MLO: the boot-loader loader - this small program is loaded into the OMAP3 processor's static RAM. It does some minimal configuration of system memory and I/O pins and then loads the second file.
2) u-boot.bin: the boot loader
3) uImage: the Linux kernel
Note: For verdex pro, MLO is not required.
You can build these yourself or download pre-built images. but these three files must be named as stated above.
After building or downloading these files, mount the FAT partition of your microSD card. The following example assumes you mount it at /media/card.
$ sudo mount /dev/sde1 /media/card
Due to constraints of the mask boot ROM in the OMAP processor, MLO MUST be written first.
$ sudo cp MLO-overo /media/card/MLO
Copy u-boot and the Linux kernel to the card:
$ sudo cp u-boot.bin /media/card/u-boot.bin
$ sudo cp uImage.bin /media/card/uImage
Now you can unmount the FAT partition.
$ sudo umount /dev/sde1
At this point you have a bootable FAT partition. Lastly, untar your desired root filesystem on the ext3 partition that you created above. Do not untar your COM rootfs onto your development machine! This example assumes that you have mounted it at /media/card:
$ sudo mount /dev/sde2 /media/card
Untar your desired rootfs.
$ cd /media/card
$ sudo tar xvaf /path/to/console-image.tar.bz2
Unmount the ext3 partition.
$ sudo umount /dev/sde2
U-boot Environment Refresh
U-boot comes with a default set of environment variables that can change as new versions are released. If you are updating u-boot, clear your current set of u-boot environment variables the first time you boot with the new version. Do this by breaking into u-boot and typing the following commands. (Overo ONLY).
$ nand erase 240000 20000
$ reset
To make additional changes to the environment, break into u-boot again, make the changes and type 'saveenv' to save. This also eliminates the "*** Warning - bad CRC or NAND, using default environment".
====================================================================
PS! The order you copy MLO, u-boot and uImage to microSD FAT partition is very important. Otherwise, you may not boot from microSD card successfully.
Then, copy two files from your build directory to microSD card:
directory: /build/czhang/overo-oe/tmp/deploy/glibc/images/overo
files: uImage-2.6.34-r90-overo.bin
Angstrom-omap3-console-image-glibc-ipk-2010.7-test-20101005-overo.rootfs.tar.bz2 (extract to sd card)
****************************************************************************
Problem occur:
after boot from microSD card (which contain pre-make overo image from internet), Ethernet does not work, because i cannot see the light turns on after i plugged Ethernet cable.
in Overo kernel, check the loaded module
$ lsmod
Module Size Used by
libertas_sdio 13860 0
libertas 168952 1 libertas_sdio
lib80211 6848 1 libertas
ipv6 238492 16
ads7846 10328 0
Hmm, eth0 module hasn't been loaded.
try
$ modprobe smsc911x
smsc911x: Driver version 2008-10-21.
smsc911x-mdio: probed
eth0: attached PHY driver [Generic PHY] (mii_bus:phy_addr=ffffffff:01, irq=-1)
net eth0: MAC Address: 00:15:c9:28:c3:60
net eth0: SMSC911x/921x identified at 0xd0c3a000, IRQ: 336
great, loaded. right, i need to add eth0 module while the overo booting.
$ cd /etc
$ cat modules
### This file is automatically generated by update-modules"
#
# Please do not edit this file directly. If you want to change or add
# anything please take a look at the files in /etc/modutils and read
# the manpage for update-modules.
#
### update-modules: start processing /etc/modutils/ipv6
ipv6
### update-modules: end processing /etc/modutils/ipv6
$ cd /etc/modutils
$ cat > smsc911x ; create a eth0 module file
$ cat smsc911x ; add command in this file
smsc911x
(Ctrl+D to save it)
$ update-modules
reboot gumstix, done!
copy my own build overo image to microSD card, boot gumstix, the eth0 still not work!!
the reason is that the latest version of bb recipes includes the smsc911x in kernal, not a module. take a look in:
$ cd /etc/network
$ cat interfaces
#auto eth0
#iface eth0 inet dhcp
#iface eth1 inet dhcp
(eth0 has been disabled)
$ vi interfaces ; learn how to drive vi, un-comment eth0
auto eth0
iface eth0 inet dhcp
#iface eth1 inet dhcp ; gumstix does not have eth1
reboot gumstix, done.
Note: sometimes, the eth0 will down after I stopped program. To enable the eth0 manually, try:
or
sometimes "udhcpc" does not work.
I am using
to enable the Ethernet.
take a look if the kernel has "rsync", because i need use it to copy Qt arm-lib files from my build machine.
try if you can install "rsync" with opkg command, which is similar to yum or apt-get
$ opkg install rsync
can't install rsync
try
$ opkg update
$ opkg install rsync
still can't install.
go back to build machine, build rsync package myself.
$ cd /build/czhang/overo-oe
$ source build/profile
$ bitbake rsync
after that, i should be able to see a rsync.ipk file in:
/build/czhang/overo-oe/tmp/deploy/glibc/ipk/armv7a/rsync_3.0.6-r0.6_armv7a.ipk
Go to Gumstix, copy this package to /~
Then
$ cd ~
$ opkg install rsync_3.0.6-r0.6_armv7a.ipk
Then copy all Qt ARM-lib file to gumstix lib folder
$ rsync -av czhang@10.0.1.202://build/czhang/qt-everywhere-opensource-src-4.7.0/lib/* /usr/lib
copy my Qt executable file to gumstix
$ cd ~
$ scp czhang@10.0.1.202:/build/czhang/qt-everywhere-opensource-src-4.7.0/projects/m4_arm/m4/m4 .
$ pwd
/home/root
$ /home/root/m4
error while loading shared libraries: libqextserialport.so.1: cannoy
ok, need to copy serial port arm-lib to gumstix
$ rsync -av czhang@10.0.1.202://build/czhang/qt-everywhere-opensource-src-4.7.0/projects/qextserialport/build/libqextserialport* /usr/lib
run again
$ /home/root/m4
great, see my program on the touch screen.
next step is to calibrate the touch screen and import some pictures.
http://www.gumstix.org/create-a-bootable-microsd-card.html
Overo and verdex pro COMs will boot directly from a properly prepared microSD card. This section will outline how to partition and format a bootable microSD card.
To create a bootable microSD, compatible with the·OMAP3 boot ROM, set a special geometry using the·fdisk "Expert mode". These steps also work for verdex pro COMs.
Important Notes:
- When creating a bootable microSD card for an·Overo COM,·you MUST use expert mode. This sets the correct cylinders, heads and sectors for the microSD card before you partition it.
- Gumstix recommends using a microSDHC card for Overo COMs. Only use microSD cards for verdex pro COMs.
The example below shows the steps required to set up a new microSD card of any size. The numbers shown are given for a particular 2GB microSD card. You will be directed to make a simple calculation to determine the correct values for your microSD card.
First, insert your card into the development machine's flash card slot. You may need to use a microSD to SD card adaptor to fit your slot. example the device name will be /dev/sde. Please substitute the proper device name for your machine. You can use 'mount' or 'df' to see where the card mounts on your machine. Let's unmount the device's existing file system before we get started with fdisk:
$ sudo umount /dev/sde1
Partitioning the Card
Now, launch fdisk and create an empty partition table. Note that the argument for fdisk is the entire device (/dev/sde) not just a single partition (i.e. /dev/sde1):
# sudo fdisk /dev/sde
Command (m for help): o
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Let's first look at the current card information:
Command (m for help): p
Disk /dev/sde: 2032 MB, 2032664576 bytes
64 heads, 63 sectors/track, 984 cylinders
Units = cylinders of 4032 * 512 = 2064384 bytes
Disk identifier: 0x00aa8e5c
Device Boot Start End Blocks Id System
Note the card size in bytes. We will need it later in the process.
Now go into "Expert" mode:
Command (m for help): x
Next, set the geometry to 255 heads, 63 sectors and a calculated value for the number of cylinders required for the particular microSD card. To calculate the number of cylinders, take the 2032664576 bytes reported above by fdisk, divide by 255 heads, 63 sectors and 512 bytes per sector: 2032664576 / 255 / 63 / 512 = 247.12 which we round·down to 247 cylinders.
Expert command (m for help): h
Number of heads (1-256, default 4): 255
Expert command (m for help): s
Number of sectors (1-63, default 62): 63
Warning: setting sector offset for DOS compatiblity
Expert command (m for help): c
Number of cylinders (1-1048576, default 984): 247
Return to fdisk's main mode and create a new partition 32 MB FAT partition:
Expert command (m for help): r
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-247, default 1): 1
Last cylinder or +size or +sizeM or +sizeK (1-247, default 15): +32M
Change the partition type to FAT32:
Command (m for help): t
Selected partition 1
Hex code (type L to list codes): c
Changed system type of partition 1 to c (W95 FAT32 (LBA))
Mark it bootable:
Command (m for help): a
Partition number (1-4): 1
Now, create an ext3 partition for the rootfs:
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (6-247, default 6): 6
Last cylinder or +size or +sizeM or +sizeK (6-247, default 247): 247
To verify your work, print the partition info:
Command (m for help): p
Disk /dev/sde: 2032 MB, 2032664576 bytes
255 heads, 63 sectors/track, 247 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00aa8e5c
Device Boot Start End Blocks Id System
/dev/sde1 * 1 5 40131 c W95 FAT32 (LBA)
/dev/sde2 6 247 1943865 83 Linux
Finally, write the new partition table to the card and then exit:
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: If you have created or modified any DOS 6.x
partitions, please see the fdisk manual page for additional
information.
Syncing disks
Formatting the New Partitions
Format the first partition as an FAT file system (the -n parameter gives it a label of FAT). You can change or omit this if you like.
$ sudo mkfs.vfat -F 32 /dev/sde1 -n FAT
mkfs.vfat 2.11 (12 Mar 2005)
Format the second partition as an ext3 file system:
$ sudo mkfs.ext3 /dev/sde2
mke2fs 1.40.8 (13-Mar-2008)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
121920 inodes, 485966 blocks
24298 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=499122176
15 block groups
32768 blocks per group, 32768 fragments per group
8128 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: ^[done
This filesystem will be automatically checked every 36 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
Installing the Boot Files
There are three files required on the first (FAT) partition to boot your Overo.
1) MLO: the boot-loader loader - this small program is loaded into the OMAP3 processor's static RAM. It does some minimal configuration of system memory and I/O pins and then loads the second file.
2) u-boot.bin: the boot loader
3) uImage: the Linux kernel
Note: For verdex pro, MLO is not required.
You can build these yourself or download pre-built images. but these three files must be named as stated above.
After building or downloading these files, mount the FAT partition of your microSD card. The following example assumes you mount it at /media/card.
$ sudo mount /dev/sde1 /media/card
Due to constraints of the mask boot ROM in the OMAP processor, MLO MUST be written first.
$ sudo cp MLO-overo /media/card/MLO
Copy u-boot and the Linux kernel to the card:
$ sudo cp u-boot.bin /media/card/u-boot.bin
$ sudo cp uImage.bin /media/card/uImage
Now you can unmount the FAT partition.
$ sudo umount /dev/sde1
At this point you have a bootable FAT partition. Lastly, untar your desired root filesystem on the ext3 partition that you created above. Do not untar your COM rootfs onto your development machine! This example assumes that you have mounted it at /media/card:
$ sudo mount /dev/sde2 /media/card
Untar your desired rootfs.
$ cd /media/card
$ sudo tar xvaf /path/to/console-image.tar.bz2
Unmount the ext3 partition.
$ sudo umount /dev/sde2
U-boot Environment Refresh
U-boot comes with a default set of environment variables that can change as new versions are released. If you are updating u-boot, clear your current set of u-boot environment variables the first time you boot with the new version. Do this by breaking into u-boot and typing the following commands. (Overo ONLY).
$ nand erase 240000 20000
$ reset
To make additional changes to the environment, break into u-boot again, make the changes and type 'saveenv' to save. This also eliminates the "*** Warning - bad CRC or NAND, using default environment".
====================================================================
PS! The order you copy MLO, u-boot and uImage to microSD FAT partition is very important. Otherwise, you may not boot from microSD card successfully.
Then, copy two files from your build directory to microSD card:
directory: /build/czhang/overo-oe/tmp/deploy/glibc/images/overo
files: uImage-2.6.34-r90-overo.bin
Angstrom-omap3-console-image-glibc-ipk-2010.7-test-20101005-overo.rootfs.tar.bz2 (extract to sd card)
****************************************************************************
Problem occur:
after boot from microSD card (which contain pre-make overo image from internet), Ethernet does not work, because i cannot see the light turns on after i plugged Ethernet cable.
in Overo kernel, check the loaded module
$ lsmod
Module Size Used by
libertas_sdio 13860 0
libertas 168952 1 libertas_sdio
lib80211 6848 1 libertas
ipv6 238492 16
ads7846 10328 0
Hmm, eth0 module hasn't been loaded.
try
$ modprobe smsc911x
smsc911x: Driver version 2008-10-21.
smsc911x-mdio: probed
eth0: attached PHY driver [Generic PHY] (mii_bus:phy_addr=ffffffff:01, irq=-1)
net eth0: MAC Address: 00:15:c9:28:c3:60
net eth0: SMSC911x/921x identified at 0xd0c3a000, IRQ: 336
great, loaded. right, i need to add eth0 module while the overo booting.
$ cd /etc
$ cat modules
### This file is automatically generated by update-modules"
#
# Please do not edit this file directly. If you want to change or add
# anything please take a look at the files in /etc/modutils and read
# the manpage for update-modules.
#
### update-modules: start processing /etc/modutils/ipv6
ipv6
### update-modules: end processing /etc/modutils/ipv6
$ cd /etc/modutils
$ cat > smsc911x ; create a eth0 module file
$ cat smsc911x ; add command in this file
smsc911x
(Ctrl+D to save it)
$ update-modules
reboot gumstix, done!
copy my own build overo image to microSD card, boot gumstix, the eth0 still not work!!
the reason is that the latest version of bb recipes includes the smsc911x in kernal, not a module. take a look in:
$ cd /etc/network
$ cat interfaces
#auto eth0
#iface eth0 inet dhcp
#iface eth1 inet dhcp
(eth0 has been disabled)
$ vi interfaces ; learn how to drive vi, un-comment eth0
auto eth0
iface eth0 inet dhcp
#iface eth1 inet dhcp ; gumstix does not have eth1
reboot gumstix, done.
Note: sometimes, the eth0 will down after I stopped program. To enable the eth0 manually, try:
$ ifconfig eth0 up
$ ifconfig eth0 10.0.0.xxx netmask 255.255.255.0
or
$ udhcpc
sometimes "udhcpc" does not work.
I am using
$ifdown eth0
$ifup eth0
to enable the Ethernet.
take a look if the kernel has "rsync", because i need use it to copy Qt arm-lib files from my build machine.
try if you can install "rsync" with opkg command, which is similar to yum or apt-get
$ opkg install rsync
can't install rsync
try
$ opkg update
$ opkg install rsync
still can't install.
go back to build machine, build rsync package myself.
$ cd /build/czhang/overo-oe
$ source build/profile
$ bitbake rsync
after that, i should be able to see a rsync.ipk file in:
/build/czhang/overo-oe/tmp/deploy/glibc/ipk/armv7a/rsync_3.0.6-r0.6_armv7a.ipk
Go to Gumstix, copy this package to /~
Then
$ cd ~
$ opkg install rsync_3.0.6-r0.6_armv7a.ipk
Then copy all Qt ARM-lib file to gumstix lib folder
$ rsync -av czhang@10.0.1.202://build/czhang/qt-everywhere-opensource-src-4.7.0/lib/* /usr/lib
copy my Qt executable file to gumstix
$ cd ~
$ scp czhang@10.0.1.202:/build/czhang/qt-everywhere-opensource-src-4.7.0/projects/m4_arm/m4/m4 .
$ pwd
/home/root
$ /home/root/m4
error while loading shared libraries: libqextserialport.so.1: cannoy
ok, need to copy serial port arm-lib to gumstix
$ rsync -av czhang@10.0.1.202://build/czhang/qt-everywhere-opensource-src-4.7.0/projects/qextserialport/build/libqextserialport* /usr/lib
run again
$ /home/root/m4
great, see my program on the touch screen.
next step is to calibrate the touch screen and import some pictures.
31/08/2010
Qt commands
Convert QString to int
QString num="123";
int n = num.toInt();
Convert Int to QString
int num = 123;
QString str= QString::number(num);
23/02/2010
Qt 4.6.1 Latest Version Bug: Error of FT_Select_Size
just download latest version of Qt 4.6.1
I got an error when i built my program.
Running build steps for project mypro...
Configuration unchanged, skipping QMake step.
Starting: /usr/bin/make -w
make: Entering directory `/home/czhang/mypro/mypro'
/home/czhang/qtsdk-2010.01/qt/bin/qmake -spec ../../qtsdk-2010.01/qt/mkspecs/linux-g++ -unix CONFIG+=debug -o Makefile mypro.pro
make: Leaving directory `/home/czhang/mypro/mypro'
make: Entering directory `/home/czhang/mypro/mypro'
g++ -Wl,-rpath,/home/czhang/qtsdk-2010.01/qt/lib -o mypro main.o mainwindow.o pwdialog.o globVar.o prefenencedialog.o dbeditdialog.o dbdialog.o dbsearchdialog.o newrecorddialog.o moc_mainwindow.o moc_pwdialog.o moc_prefenencedialog.o moc_dbeditdialog.o moc_dbdialog.o moc_dbsearchdialog.o moc_newrecorddialog.o -L/home/czhang/qtsdk-2010.01/qt/lib -lqextserialport -lQtSql -L/home/czhang/qtsdk-2010.01/qt/lib -lQtGui -L/usr/X11R6/lib -lQtCore -lpthread
make: Leaving directory `/home/czhang/mypro/mypro'
/usr/lib/libfontconfig.so.1: undefined reference to `FT_Select_Size'
collect2: ld returned 1 exit status
make: *** [mypro] Error 1
Exited with code 2.
Error while building project mypro
When executing build step 'Make'
I was struggling on this error for a few days.
I had not such problem before I updated Qt creator.
Uninstall Qt (go to the folder where the Qt was installed, click "uninstall"),
Install old version.
Program built fine! :)
I got an error when i built my program.
Running build steps for project mypro...
Configuration unchanged, skipping QMake step.
Starting: /usr/bin/make -w
make: Entering directory `/home/czhang/mypro/mypro'
/home/czhang/qtsdk-2010.01/qt/bin/qmake -spec ../../qtsdk-2010.01/qt/mkspecs/linux-g++ -unix CONFIG+=debug -o Makefile mypro.pro
make: Leaving directory `/home/czhang/mypro/mypro'
make: Entering directory `/home/czhang/mypro/mypro'
g++ -Wl,-rpath,/home/czhang/qtsdk-2010.01/qt/lib -o mypro main.o mainwindow.o pwdialog.o globVar.o prefenencedialog.o dbeditdialog.o dbdialog.o dbsearchdialog.o newrecorddialog.o moc_mainwindow.o moc_pwdialog.o moc_prefenencedialog.o moc_dbeditdialog.o moc_dbdialog.o moc_dbsearchdialog.o moc_newrecorddialog.o -L/home/czhang/qtsdk-2010.01/qt/lib -lqextserialport -lQtSql -L/home/czhang/qtsdk-2010.01/qt/lib -lQtGui -L/usr/X11R6/lib -lQtCore -lpthread
make: Leaving directory `/home/czhang/mypro/mypro'
/usr/lib/libfontconfig.so.1: undefined reference to `FT_Select_Size'
collect2: ld returned 1 exit status
make: *** [mypro] Error 1
Exited with code 2.
Error while building project mypro
When executing build step 'Make'
I was struggling on this error for a few days.
I had not such problem before I updated Qt creator.
Uninstall Qt (go to the folder where the Qt was installed, click "uninstall"),
Install old version.
Program built fine! :)
30/09/2009
Add Serial Port Communication Lib in Qt
Down load "qextserialport", unzip it.
Two ways to compile it. It depends on the source code I download.
1) qmake // or qmake-qt4 in fedora
2) make
3) Open project (qextserialport.pro) in Qt, build it.
After compile the files, I got four files in 'build' folder:
libqextserialport.so
libqextserialport.so.1
libqextserialport.so.1.0
libqextserialport.so.1.0.0
copy all link files to /usr/lib
Add the lib in .pro file:
Two ways to compile it. It depends on the source code I download.
1) qmake // or qmake-qt4 in fedora
2) make
3) Open project (qextserialport.pro) in Qt, build it.
After compile the files, I got four files in 'build' folder:
libqextserialport.so
libqextserialport.so.1
libqextserialport.so.1.0
libqextserialport.so.1.0.0
copy all link files to /usr/lib
$ cp -a libq* /usr/lib
Add the lib in .pro file:
LIBS += -lqextserialport
Publish Post
unix:DEFINES = _TTY_POSIX_
win32:DEFINES = _TTY_WIN_ \
QWT_DLL \
QT_DLL
QT_DLL
INCLUDEPATH += /home/czhang/Documents/software/qextserialport
Subscribe to:
Posts (Atom)