FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Trying to build on Mac OS X

 
Post new topic   Reply to topic     Forum Index -> QtD
View previous topic :: View next topic  
Author Message
jaddison



Joined: 25 Aug 2009
Posts: 8

PostPosted: Tue Aug 25, 2009 3:14 am    Post subject: Trying to build on Mac OS X Reply with quote

I'm having trouble building on Mac OS X. I'm completely unfamiliar with cmake, so there might be a simple configuration fix. Any help will be very much appreciated.

cmake seems to complete fine. make fails with:

Code:
...
-- Looking for Q_WS_MAC - found
-- Looking for QT_MAC_USE_COCOA
-- Looking for QT_MAC_USE_COCOA - not found.
-- Found Qt-Version 4.5.0
-- Configuring done
CMake Error in CMakeLists.txt:
  Cannot find source file "ArrayOps_shell.cpp".  Tried extensions .c .C .c++
  .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp .hxx .in .txx


-- Build files have been written to: /Users/jra/src/qtd/build_dir/build
make[2]: *** [main] Error 1
make[1]: *** [CMakeFiles/main.dir/all] Error 2
make: *** [all] Error 2


I find ArrayOpsPrimitive files in the tree:
Code:
$ find . -name "*ArrayOps*"
./cpp/qt_qtd/ArrayOpsPrimitive_shell.cpp
./include/ArrayOpsPrimitive.h
./qt/qtd/ArrayOpsPrimitive.d



and these references in CMakeLists.txt files:
Code:
$ find . -name CMakeLists.txt -print -exec grep ArrayOps {} \;
./CMakeLists.txt
   foreach(d_source ${package}/ArrayOps2 ${d_generated_files})
   set(classes ArrayOps ${classes})
./generator/CMakeLists.txt
set(dgen_impl ${out_dir}/cpp/qt_core/ArrayOps_shell.cpp)


I'm using
* Qt 4.5.0 as it came with the QtCreator SDK for the Mac.
* gcc 4.0.1 came with XCode
* cmake 2.6 from fink packages
* dmd v2.031
* qtd rev 268 from svn repo

Code:
$ qmake -v
QMake version 2.01a
Using Qt version 4.5.0 in /Library/Frameworks

$ gcc -v
Using built-in specs.
Target: i686-apple-darwin9
Configured with: /var/tmp/gcc/gcc-5493~1/src/configure --disable-checking -enable-werror --prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/$/-4.0/ --with-gxx-include-dir=/include/c++/4.0.0 --with-slibdir=/usr/lib --build=i686-apple-darwin9 --with-arch=apple --with-tune=generic --host=i686-apple-darwin9 --target=i686-apple-darwin9
Thread model: posix
gcc version 4.0.1 (Apple Inc. build 5493)

$ cmake --version
cmake version 2.6-patch 4
Back to top
View user's profile Send private message
jaddison



Joined: 25 Aug 2009
Posts: 8

PostPosted: Thu Aug 27, 2009 2:06 am    Post subject: Reply with quote

I got QtD r268 working on Linux (Kubuntu 9.04, dmd v2.031, Qt 4.5.0, gcc 4.3.3) without any problems, except when I tried to build the examples:

Code:
...

Scanning dependencies of target dockwidgets                                                   
[ 97%] Generate dockwidgets.qrc                                                               
[ 97%] Linking dockwidgets                                                                   
[ 98%] Built target dockwidgets                                                               
Scanning dependencies of target hellogl                                                       
Internal error: ../ztc/cod4.c 354                                                             
make[5]: *** [examples/opengl/hellogl/CMakeFiles/hellogl.dir/hellogl0.o] Error 1             
make[4]: *** [examples/opengl/hellogl/CMakeFiles/hellogl.dir/all] Error 2                     
make[3]: *** [all] Error 2                                                                   
make[2]: *** [main] Error 2                                                                   
make[1]: *** [CMakeFiles/main.dir/all] Error 2                                               
make: *** [all] Error 2                                                                       


I'm not really worried about this; it looks like most of the examples built OK.

What I was really looking for is where the makes for OS X and Linux diverged ... kind of taking the big hammer approach. They diverged at the QtD Generator step:

Linux (good):

Code:
...

<<SOME WARNINGS>>

...

[ 98%] Generating binding...
Running the QtD Generator. Please wait while source files are being generated...
Classes in typesystem: 536
Generated:
  - d.........: 527 (527)
  - cpp-impl..: 503 (503)
  - cpp-h.....: 398 (398)
  - meta-info.: 28 (28)
  - pri.......: 7 (7)

Done, 126 warnings (611 known issues)
[100%] Built target dgen
Scanning dependencies of target main
-- The CXX compiler identification is GNU

...

[100%] Building CXX object tools/duic/CMakeFiles/duic.dir/main.cpp.o
Linking CXX executable duic
[100%] Built target duic
Scanning dependencies of target tools
[100%] Built target tools
[100%] Built target main


OS X (bad):

Code:
...

<<LOTS AND LOTS OF WARNINGS>>

...

[ 98%] Generating binding...
Running the QtD Generator. Please wait while source files are being generated...
Classes in typesystem: 0
Generated:
  - d.........: 0 (0)
  - cpp-impl..: 0 (0)
  - cpp-h.....: 0 (0)
  - meta-info.: 0 (0)
  - pri.......: 0 (0)

Done, 988 warnings (27 known issues)
[100%] Built target dgen
Scanning dependencies of target main
-- The CXX compiler identification is GNU

...

-- Found Qt-Version 4.5.0
-- Configuring done
CMake Error in CMakeLists.txt:
  Cannot find source file "ArrayOps_shell.cpp".  Tried extensions .c .C .c++
  .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp .hxx .in .txx


-- Build files have been written to: /Users/jra/usr/src/src/qtd/bld/build
make[2]: *** [main] Error 1
make[1]: *** [CMakeFiles/main.dir/all] Error 2
make: *** [all] Error 2


Unless someone can give me some direction, I'll spend some time learning about the generator in order to figure out what the trouble is on OS X.

Thanks
Back to top
View user's profile Send private message
jaddison



Joined: 25 Aug 2009
Posts: 8

PostPosted: Thu Aug 27, 2009 1:11 pm    Post subject: Reply with quote

I think that I've found part of the problem. The qtjambi_masterinclude.h file is trying to include things like <QtCore/QtCore> though my Qt installation is installed using OS X frameworks so that file is this file:

/Library/Frameworks/QtCore.framework/Versions/4/Headers/QtCore

When I replaced, in qtjambi_masterinclude.h,
Code:
#include <QtCore/QtCore>

with
Code:
#include "/Library/Frameworks/QtCore.framework/Versions/4/Headers/QtCore"

I got:
Code:
...
QString::arg: Argument missing: ArrayOps2.d, qt_xml
Classes in typesystem: 86
Generated:
  - d.........: 79 (79)
  - cpp-impl..: 74 (74)
  - cpp-h.....: 53 (53)
  - meta-info.: 12 (12)
  - pri.......: 3 (3)

Done, 826 warnings (223 known issues)
[100%] Built target dgen
...


instead of all 0s, which seems promising.

Does anyone know what is the right way to fix this? If generator can handle --framework switches that might be good. Conditional compilation and hard coding the include paths doesn't seem like a good option.

Apologies if everyone here is already aware of these issues. I haven't gotten any feedback, so I'm assuming this is new territory and that I'm on the right path so far as you guys know. Again, if anyone has any direction or tips I would appreciate them very much.

Thanks
Back to top
View user's profile Send private message
michaelp



Joined: 27 Jul 2008
Posts: 114

PostPosted: Thu Aug 27, 2009 1:45 pm    Post subject: Reply with quote

For your second post:
Code:
Internal error: ../ztc/cod4.c 354

That might be a compiler error. Maybe you should check what is on line 354 of cod4.c in the DMD source. Or search bugzilla reports.
I've never tried Qt, or QtD, so I can't really help you with your other questions.
Back to top
View user's profile Send private message
jaddison



Joined: 25 Aug 2009
Posts: 8

PostPosted: Sat Aug 29, 2009 12:07 am    Post subject: Reply with quote

Thank you michaelp for your response. I'm not very concerned with the error you addressed. It is only an example program that did not build, while most of the examples did build without error. Also, this error occurred on a Linux system. I only mentioned it in case it might be a concern for another user.

My main goal here is to build QtD under OS X using a Qt install that uses the framework system.
Back to top
View user's profile Send private message
jaddison



Joined: 25 Aug 2009
Posts: 8

PostPosted: Sat Aug 29, 2009 12:37 am    Post subject: Reply with quote

An update on my efforts ...

The Qt Jambi, of which generator is a part, installation documentation states that, on OS X, Qt must be installed with -no-framework. I think that this explains some of the difficulty.

Continuing with the strategy I noted in a previous post, I made the following edits to qtjambi_masterinclude.h so that the Qt headers would be found:

Code:
// #include <QtCore/QtCore>
// #include <QtGui/QtGui>
// #include <QtNetwork/QtNetwork>
// #include <QtSql/QtSql>
// #include <QtSvg/QtSvg>
// #include <QtXml/QtXml>

// #ifndef QT_NO_XMLPATTERNS
// #  include <QtXmlPatterns/QtXmlPatterns>
// #endif

// #ifndef QT_NO_WEBKIT
// #  include <QtWebKit/QtWebKit>
// #endif

// #ifndef QT_NO_PHONON
// #  include <phonon/phonon>
// #endif

#include "/Library/Frameworks/QtCore.framework/Versions/4/Headers/QtCore"
#include "/Library/Frameworks/QtGui.framework/Versions/4/Headers/QtGui"
#include "/Library/Frameworks/QtNetwork.framework/Versions/4/Headers/QtNetwork"
#include "/Library/Frameworks/QtSql.framework/Versions/4/Headers/QtSql"
#include "/Library/Frameworks/QtSvg.framework/Versions/4/Headers/QtSvg"
#include "/Library/Frameworks/QtXml.framework/Versions/4/Headers/QtXml"

#ifndef QT_NO_XMLPATTERNS
#  include "/Library/Frameworks/QtXmlPatterns.framework/Versions/4/Headers/QtXmlPatterns"
#endif

#ifndef QT_NO_WEBKIT
#  include "/Library/Frameworks/QtWebKit.framework/Versions/4/Headers/QtWebKit"
#endif

#ifndef QT_NO_PHONON
#  include "/Library/Frameworks/phonon.framework/Versions/4/Headers/phonon"
#endif


This seems to help a great deal. I now get

Code:
Classes in typesystem: 525
Generated:
  - d.........: 518 (518)
  - cpp-impl..: 495 (495)
  - cpp-h.....: 391 (391)
  - meta-info.: 24 (24)
  - pri.......: 6 (6)


On the working Linux install I get 536 Classes in typesystem. I'm hoping that this means only 11 to go!

The builds diverge when the OS X reports:

Code:
WARNING(MetaJavaBuilder) :: skipping function 'QTextCodec::ConverterState', unmatched return type 'Q_CORE_EXPORT'
WARNING(MetaJavaBuilder) :: horribly broken type ''
WARNING(MetaJavaBuilder) :: skipping function 'QFuture::operator T', unmatched return type ''


I think that these messages come when encountering qtextcodec.h. Here is snippet for that file:

Code:
...
class QTextDecoder;
class QTextEncoder;

class Q_CORE_EXPORT QTextCodec
{
    Q_DISABLE_COPY(QTextCodec)
public:
    static QTextCodec* codecForName(const QByteArray &name);
...


Can anyone tell me how to work with generator to fix this?

Thanks
Back to top
View user's profile Send private message
jaddison



Joined: 25 Aug 2009
Posts: 8

PostPosted: Fri Sep 04, 2009 3:36 pm    Post subject: Working (fixed?) Reply with quote

I was able to get QtD working on Mac OS X.

The key was to use a no-frameworks install of Qt. I had been trying to use the Qt installed with a pre-built QtCreator which was installed using frameworks. I'm sure that there is a way to make this work, but I took the easy way out (for now).

note: in order to use the Cocoa and/or 64-bit version of Qt on OS X you need to use a frameworks install.

I wrote up how I got it working and put it on the QtD wiki:

http://www.dsource.org/projects/qtd/wiki/MacCaseStudy

Good luck!
Back to top
View user's profile Send private message
michaelp



Joined: 27 Jul 2008
Posts: 114

PostPosted: Fri Sep 04, 2009 8:06 pm    Post subject: Reply with quote

But now, 2.032 is out!
You check to see if it works with that. Razz
Back to top
View user's profile Send private message
eldar



Joined: 14 Jun 2008
Posts: 101
Location: Ufa, Russia

PostPosted: Sat Sep 05, 2009 12:17 am    Post subject: Reply with quote

jaddison
I am sorry that I wasn't able to help you, I didn't check the forum for quite long and only today saw the update to the wiki. Thank you very much for the efforts you made!
About that error you get, true, it is a compiler error, specific to D2, you may be able to use new dmd 2.032 and check whether it is fixed there.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> QtD All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group