# Can not compile qt4 with clang



## miracle20003 (Jun 24, 2012)

```
FreeBSD Setp-By-Setp 9.0-RELEASE FreeBSD 9.0-RELEASE #0 r237264M: Wed Jun 20 16:50:20 CST 2012     
root@Setp-By-Setp:/usr/obj/usr/src_9/sys/XXXXX  i386
```
error.log

```
clang++ -c -O2 -pipe -fno-strict-aliasing -I../../include/QtCore -I../../include/QtGui -I../../include/Qt
 -I../../include -I. -I/usr/local/include -D_REENTRANT -I/usr/local/include/glib-2.0 -O2
 -fvisibility=hidden -fvisibility-inlines-hidden -Wall -W -I/usr/local/include
 -I/usr/local/include/freetype2 -fPIC -DQT_SHARED -DQT_BUILD_GUI_LIB -DQT_NO_USING_NAMESPACE
 -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT3_SUPPORT -DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER
 -DQT_NO_OPENTYPE -DQT_NO_STYLE_MAC -DQT_NO_STYLE_WINDOWSVISTA -DQT_NO_STYLE_WINDOWSXP
 -DQT_NO_STYLE_WINDOWSCE -DQT_NO_STYLE_WINDOWSMOBILE -DQT_NO_STYLE_S60 -DQ_INTERNAL_QAPP_SRC
 -DQT_NO_DEBUG -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE
 -I/usr/local/share/qt4/mkspecs/freebsd-clang -I. -I../../include/QtCore -I../../include
 -I../../include/QtGui -I.rcc/release-shared -I../3rdparty/xorg -Iimage -I/usr/local/include/freetype2
 -I../3rdparty/harfbuzz/src -Idialogs -I.moc/release-shared -I/usr/local/include -I.uic/release-shared
 -I/usr/local/include/qt4 -I/usr/local/include -o .obj/release-shared/qpicture.o image/qpicture.cpp
In file included from image/qimage.cpp:57:
In file included from ../../include/QtGui/private/qdrawhelper_p.h:1:
In file included from ../../include/QtGui/private/../../../src/gui/painting/qdrawhelper_p.h:65:
In file included from ../../include/QtCore/private/qsimd_p.h:1:
In file included from ../../include/QtCore/private/../../../src/corelib/tools/qsimd_p.h:203:
In file included from /usr/include/clang/3.0/mm3dnow.h:27:
/usr/include/clang/3.0/mmintrin.h:28:2: error: #error "MMX instruction set not enabled"
#error "MMX instruction set not enabled"
 ^
In file included from image/qimage.cpp:57:
In file included from ../../include/QtGui/private/qdrawhelper_p.h:1:
In file included from ../../include/QtGui/private/../../../src/gui/painting/qdrawhelper_p.h:65:
In file included from ../../include/QtCore/private/qsimd_p.h:1:
In file included from ../../include/QtCore/private/../../../src/corelib/tools/qsimd_p.h:203:
/usr/include/clang/3.0/mm3dnow.h:36:19: error: unknown type name '__m64'
static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
                  ^
/usr/include/clang/3.0/mm3dnow.h:36:25: error: expected unqualified-id
static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
                        ^
In file included from image/qbitmap.cpp:47:
In file included from ../../include/QtGui/private/qgraphicssystem_p.h:1:
In file included from ../../include/QtGui/private/../../../src/gui/painting/qgraphicssystem_p.h:58:
In file included from ../../include/QtGui/private/qpaintengine_blitter_p.h:1:
In file included from ../../include/QtGui/private/../../../src/gui/painting/qpaintengine_blitter_p.h:45:
In file included from ../../include/QtGui/private/qpaintengine_raster_p.h:1:
In file included from ../../include/QtGui/private/../../../src/gui/painting/qpaintengine_raster_p.h:59:
In file included from ../../include/QtGui/private/qdrawhelper_p.h:1:
In file included from ../../include/QtGui/private/../../../src/gui/painting/qdrawhelper_p.h:65:
In file included from ../../include/QtCore/private/qsimd_p.h:1:
In file included from ../../include/QtCore/private/../../../src/corelib/tools/qsimd_p.h:203:
In file included from /usr/include/clang/3.0/mm3dnow.h:27:
/usr/include/clang/3.0/mmintrin.h:28:2: error: #error "MMX instruction set not enabled"
#error "MMX instruction set not enabled"
 ^
In file included from image/qbitmap.cpp:47:
In file included from ../../include/QtGui/private/qgraphicssystem_p.h:1:
In file included from ../../include/QtGui/private/../../../src/gui/painting/qgraphicssystem_p.h:58:
In file included from ../../include/QtGui/private/qpaintengine_blitter_p.h:1:
In file included from ../../include/QtGui/private/../../../src/gui/painting/qpaintengine_blitter_p.h:45:
In file included from ../../include/QtGui/private/qpaintengine_raster_p.h:1:
In file included from ../../include/QtGui/private/../../../src/gui/painting/qpaintengine_raster_p.h:59:
In file included from ../../include/QtGui/private/qdrawhelper_p.h:1:
In file included from ../../include/QtGui/private/../../../src/gui/painting/qdrawhelper_p.h:65:
In file included from ../../include/QtCore/private/qsimd_p.h:1:
In file included from ../../include/QtCore/private/../../../src/corelib/tools/qsimd_p.h:203:
/usr/include/clang/3.0/mm3dnow.h:36:19: error: unknown type name '__m64'
static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
                  ^
/usr/include/clang/3.0/mm3dnow.h:36:25: error: expected unqualified-id
static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
                        ^
In file included from image/qimage.cpp:68:
In file included from ../../include/QtGui/private/qpaintengine_raster_p.h:1:
../../include/QtGui/private/../../../src/gui/painting/qpaintengine_raster_p.h:287:10: warning:
 'QRasterPaintEngine::updateState' hides overloaded virtual function [-Woverloaded-virtual]
    void updateState();
         ^
../../include/QtGui/private/../../../src/gui/painting/qpaintengineex_p.h:205:18: note: hidden overloaded
 virtual function 'QPaintEngineEx::updateState' declared here
    virtual void updateState(const QPaintEngineState &state);
                 ^
In file included from image/qbitmap.cpp:47:
In file included from ../../include/QtGui/private/qgraphicssystem_p.h:1:
In file included from ../../include/QtGui/private/../../../src/gui/painting/qgraphicssystem_p.h:58:
In file included from ../../include/QtGui/private/qpaintengine_blitter_p.h:1:
In file included from ../../include/QtGui/private/../../../src/gui/painting/qpaintengine_blitter_p.h:45:
In file included from ../../include/QtGui/private/qpaintengine_raster_p.h:1:
../../include/QtGui/private/../../../src/gui/painting/qpaintengine_raster_p.h:287:10: warning:
 'QRasterPaintEngine::updateState' hides overloaded virtual function [-Woverloaded-virtual]
    void updateState();
         ^
../../include/QtGui/private/../../../src/gui/painting/qpaintengineex_p.h:205:18: note: hidden overloaded
 virtual function 'QPaintEngineEx::updateState' declared here
    virtual void updateState(const QPaintEngineState &state);
                 ^
1 warning and 3 errors generated.
1 warning and 3 errors generated.
*** Error code 1
*** Error code 1
2 errors
*** Error code 1

Stop in /work/ports/x11-toolkits/qt4-gui.
*** Error code 1

Stop in /work/ports/accessibility/qt4-accessible.
*** Error code 1

Stop in /work/ports/devel/qt4.
*** Error code 1

Stop in /work/ports/devel/qt4.
```


----------



## kpa (Jun 24, 2012)

You could try setting CPUTYPE in /etc/make.conf to something that matches your CPU. For example if you have a core2 or similar Intel CPU:


```
CPUTYPE?=core2
```


----------



## miracle20003 (Jun 24, 2012)

Thanks for your reply!
Here is my /etc/make.conf

```
# added by use.perl 2012-06-16 17:14:40
#FETCH_CMD = aria2c -s 4
.if ${.CURDIR:M/usr/src} || ${.CURDIR:M/usr/src/*} || ${.CURDIR:M/usr/obj} || ${.CURDIR:M/usr/obj/*} || ${.CURDIR:M/sys} || ${.CURDIR:M/sys/*}
CFLAGS+= -D_FORTIFY_SOURCE=2
.if !defined(CPP) || ${CPP} == "cpp"
CPP=clang-cpp
.endif
.endif

.if !defined(CC) || ${CC} == "cc"
CC=clang
.endif
.if !defined(CXX) || ${CXX} == "c++"
CXX=clang++
.endif
WITH_CLANG=YES
WITH_CLANG_EXTRAS=YES 
#CC=clang
#CXX=clang++
#CPP=clang-cpp
WITH_BIND_LIBS=YES
WITH_BIND_SIGCHASE=YES
WITH_BIND_LARGE_FILE=YES 
WITH_IDEA=YES
WITH_HESIOD=YES 
NO_WERROR=
WERROR=
WITH_LIBCPLUSPLUS=yes
NO_FSCHG=

CPUTYPE?=athlon64
#KERNCONF=Kernel
#CPUTYPE?=
MAKE_JOBS_NUMBER=4


FETCH_CMD = axel 
FETCH_BEFORE_ARGS = -n 8 -a 
FETCH_AFTER_ARGS =  
DISABLE_SIZE = yes
#FETCH_ENV=http_proxy=http://proxy2.zsu.edu.cn:3128
#FETCH_ENV=ftp_proxy=http://proxy2.zsu.edu.cn:3128


PERL_VERSION=5.12.4
```

But still have same errors!


----------



## kpa (Jun 24, 2012)

Oh, you're on 9.0-RELEASE. Clang on that version is not very usable for compiling ports in my experience. If you must use clang(1) to compile ports update to latest 9-STABLE.


----------

