Qt-interest Archive, July 2007
building universal binaries under darwin x86, for mac os x 10.4 and later ???
Message 1 in thread
Hi,
I know its not very much QT specific question, but there are probably people
in this list who can answer.
I myself have only few days experience with mac os x 10.4 (under pearpc
emulator).
So would it be possible to
1) install darwin 8.0.1 (
http://www.opensource.apple.com/darwinsource/images/ ) x86 on oridinary
x86 PC
2) build universal binary QT 4.3 application
3) package it to .dmg
4) install and run it on ppc/x86 mac os x 10.4 and later.
Message 2 in thread
sfniks sfinks wrote:
> So would it be possible to
> 1) install darwin 8.0.1 (
> http://www.opensource.apple.com/darwinsource/images/ ) x86 on
> oridinary x86 PC
> 2) build universal binary QT 4.3 application
I would be surprised if Qt4/MacX built on Darwin, or at least built a
full featured and binary compatible library. Darwin is badly lacking
massive parts of Mac OS X's libraries and userspace (even the kernel
these days).
I understand it to be possible to persuade Mac OS X/Intel to run under
VMWare, then use the developer tools shipped for the OS to build a
universal binary.
Failing that... if you want to develop for the Mac, you might just have
to stump up the cash for a Mac Mini (and endure the astounding compile
times) or something like that.
--
[ signature omitted ]
Message 3 in thread
On 7/12/07, Craig Ringer <craig@xxxxxxxxxxxxxxxxxxxxx> wrote:
> sfniks sfinks wrote:
>
> > So would it be possible to
> > 1) install darwin 8.0.1 (
> > http://www.opensource.apple.com/darwinsource/images/ ) x86 on
> > oridinary x86 PC
> > 2) build universal binary QT 4.3 application
>
> I would be surprised if Qt4/MacX built on Darwin, or at least built a
> full featured and binary compatible library. Darwin is badly lacking
> massive parts of Mac OS X's libraries and userspace (even the kernel
> these days).
Darwin has never included any of the OS X GUI (Aqua), so I think
building Qt on Darwin is a pretty definite "no". Perhaps one could
make a very minimal version (QCoreApplication only, no GUI stuff), but
it would probably be a lot of work for relatively little reward.
> I understand it to be possible to persuade Mac OS X/Intel to run under
> VMWare, then use the developer tools shipped for the OS to build a
> universal binary.
>
> Failing that... if you want to develop for the Mac, you might just have
> to stump up the cash for a Mac Mini (and endure the astounding compile
> times) or something like that.
So far as I know, Apple does not sell OS X Intel licenses (since every
Intel Mac shipped with 10.4, it would be pointless to retail OS X
Intel), so the only legitimate way to run OS X Intel is to run it on a
Mac.
--
[ signature omitted ]
Message 4 in thread
On 7/12/07, sfniks sfinks <sfinks2@xxxxxxxxx> wrote:
> So would it be possible to
> 1) install darwin 8.0.1 (
> http://www.opensource.apple.com/darwinsource/images/
> ) x86 on oridinary x86 PC
> 2) build universal binary QT 4.3 application
no, for a number of reasons:
1) no GUI libraries on darwin/x86 (and a number of other frameworks missing)
2) darwin/x86 is ABI-incompatible with Mac OS X 10.4/x86, a number of
kernel structures changed between the last darwin/x86 release and the
official Mac intel release.
Also, running OSX in an emulator (PearPC) is breaking the OSX EULA as
far as I'm aware, so you're not supposed to do that either. Your best
bet is to get a mac, or find a build farm system that you can try your
code out on.
--
[ signature omitted ]
Message 5 in thread
Platform: QT 4.3.0 Commercial, Windows
Given the following XML files:
xmlfile.xml
<?xml version="1.0" encoding="utf-8" standalone="no" ?>
<!DOCTYPE RES
[
<!ENTITY first SYSTEM ".\first.xml">
<!ENTITY second SYSTEM ".\second.xml">
]>
<RES name="foo" version="1">
&first;
&second;
</RES>
first.xml
<?xml version="1.0" encoding="utf-8"?>
<First name="foo">
<Hello></Hello>
</First>
second.xml
<?xml version="1.0" encoding="utf-8"?>
<Second name="bar">
<Goodbye></Goodbye>
</Second>
These represent an xml tree which, when the MSXML parser reads
xmlfile.xml, it includes the files, first.xml and second.xml into the
tree. There are some hints that the Sax Parser in QT might do this
but, i.e. there is the QXmlEntityResolver and several error messages
that indicate this should be possible.
I tried this with the QDomDocument class. setDocument does not
fail. It does not however seem to include the other files. What set
of classes do I use to accomplish this?
Thanks,
Michael
Message 6 in thread
Look into QXmlEntityResolver.
--
[ signature omitted ]
Message 7 in thread
Your response was equivalent to RTFM. I did. If you had read my
post, you would see that I mentioned QMxlEntityResolver. I've done
the homework. It is for SAX parsing. I want the same thing for
QDomDocument. Otherwise, I have to write a SAX parser and create my
own DOM. That would seem like recreating the wheel. I have studied
the XML package for ways to change the parser for Dom and there does
not appear to be a set parser method, although the documentation
infers that QDomDocument uses the SAX parser to do it's work.
M
I would rather not write a SAX parser to create a Dom document.
On Jul 17, 2007, at 5:57 AM, Chris Burke wrote:
> Look into QXmlEntityResolver.
>
> --
> chris burke
> phone: 617-621-0060 x195
> email: cburke@xxxxxxx
> skype: chris.burke0
>
>
>
> Michael Simpson wrote:
>> Platform: QT 4.3.0 Commercial, Windows
>>
>> Given the following XML files:
>>
>> xmlfile.xml
>>
>> <?xml version="1.0" encoding="utf-8" standalone="no" ?>
>> <!DOCTYPE RES
>> [
>> <!ENTITY first SYSTEM ".\first.xml">
>> <!ENTITY second SYSTEM ".\second.xml">
>> ]>
>> <RES name="foo" version="1">
>> &first;
>> &second;
>> </RES>
>>
>>
>> first.xml
>>
>> <?xml version="1.0" encoding="utf-8"?>
>> <First name="foo">
>> <Hello></Hello>
>> </First>
>>
>> second.xml
>>
>> <?xml version="1.0" encoding="utf-8"?>
>> <Second name="bar">
>> <Goodbye></Goodbye>
>> </Second>
>>
>> These represent an xml tree which, when the MSXML parser reads
>> xmlfile.xml, it includes the files, first.xml and second.xml into
>> the tree. There are some hints that the Sax Parser in QT might do
>> this but, i.e. there is the QXmlEntityResolver and several error
>> messages that indicate this should be possible.
>>
>> I tried this with the QDomDocument class. setDocument does not
>> fail. It does not however seem to include the other files. What
>> set of classes do I use to accomplish this?
>>
>> Thanks,
>> Michael
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx
> with "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
--
[ signature omitted ]
Message 8 in thread
> I tried this with the QDomDocument class. setDocument does not
> fail. It does not however seem to include the other files. What set
> of classes do I use to accomplish this?
AFAIK, QDom does not resolve entities by itself. However, it is not
particularly difficult to implement. The example below will read your
input file and write out a merged document.
Regards,
Bernd
#include <QtCore>
#include <QtXml>
int main(int, char**)
{
// read master XML file
QDomDocument masterDoc;
QFile masterFile("./xmlfile.xml");
if (!masterDoc.setContent(&masterFile)) {
qDebug() << "Error reading XML file";
exit(1);
}
// retrieve and remove entities
QMap<QString, QDomDocument> entityMap;
QDomNamedNodeMap nm = masterDoc.doctype().entities();
while (nm.count()) {
QDomEntity e = nm.item(0).toEntity();
QDomDocument d;
QFile f(e.systemId());
if (!d.setContent(&f)) {
qDebug() << "Error reading XML file" << e.systemId();
exit(1);
}
entityMap[e.nodeName()] = d;
masterDoc.doctype().removeChild(e);
}
// replace entity references (on top-level only!)
QDomNodeList nl = masterDoc.documentElement().childNodes();
for (int i = 0; i < nl.count(); i++) {
QDomEntityReference ref = nl.at(i).toEntityReference();
if (!ref.isNull()) {
QString entityName = ref.nodeName();
if (!entityMap.contains(entityName)) {
qDebug() << "Unknown entity:" << entityName;
exit(1);
}
QDomNode imported = masterDoc.importNode(
entityMap.value(entityName).documentElement(), true);
masterDoc.documentElement().insertAfter(imported, ref);
masterDoc.documentElement().removeChild(ref);
}
}
// write merged output file
QFile outFile("./merged.xml");
if (!outFile.open(QFile::WriteOnly | QFile::Text)) {
qDebug() << "Could not open output file";
exit(1);
}
QTextStream s(&outFile);
masterDoc.save(s, 1);
outFile.close();
return 0;
}
--
[ signature omitted ]
Message 9 in thread
Thank you. I will try this.
M
On Jul 17, 2007, at 12:10 PM, Bernd Brandstetter wrote:
>> I tried this with the QDomDocument class. setDocument does not
>> fail. It does not however seem to include the other files. What set
>> of classes do I use to accomplish this?
>
> AFAIK, QDom does not resolve entities by itself. However, it is not
> particularly difficult to implement. The example below will read your
> input file and write out a merged document.
>
> Regards,
> Bernd
>
>
> #include <QtCore>
> #include <QtXml>
>
> int main(int, char**)
> {
> // read master XML file
> QDomDocument masterDoc;
> QFile masterFile("./xmlfile.xml");
> if (!masterDoc.setContent(&masterFile)) {
> qDebug() << "Error reading XML file";
> exit(1);
> }
>
> // retrieve and remove entities
> QMap<QString, QDomDocument> entityMap;
> QDomNamedNodeMap nm = masterDoc.doctype().entities();
> while (nm.count()) {
> QDomEntity e = nm.item(0).toEntity();
> QDomDocument d;
> QFile f(e.systemId());
> if (!d.setContent(&f)) {
> qDebug() << "Error reading XML file" << e.systemId();
> exit(1);
> }
> entityMap[e.nodeName()] = d;
> masterDoc.doctype().removeChild(e);
> }
>
> // replace entity references (on top-level only!)
> QDomNodeList nl = masterDoc.documentElement().childNodes();
> for (int i = 0; i < nl.count(); i++) {
> QDomEntityReference ref = nl.at(i).toEntityReference();
> if (!ref.isNull()) {
> QString entityName = ref.nodeName();
> if (!entityMap.contains(entityName)) {
> qDebug() << "Unknown entity:" << entityName;
> exit(1);
> }
> QDomNode imported = masterDoc.importNode(
> entityMap.value(entityName).documentElement(), true);
> masterDoc.documentElement().insertAfter(imported, ref);
> masterDoc.documentElement().removeChild(ref);
> }
> }
>
> // write merged output file
> QFile outFile("./merged.xml");
> if (!outFile.open(QFile::WriteOnly | QFile::Text)) {
> qDebug() << "Could not open output file";
> exit(1);
> }
>
> QTextStream s(&outFile);
> masterDoc.save(s, 1);
> outFile.close();
>
> return 0;
> }
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx
> with "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
--
[ signature omitted ]