Can't build Qt on Mac - macos

I have just installed Qt Creator 3.2.2 on OSX 10.9.5, put line QMAKE_MAC_SDK = macosx10.9 into .pro file and changed the line QMAKE_MAC_SDK = macosx10.8 into QMAKE_MAC_SDK = macosx10.9 inside device.pri file. Now I'm trying to compile a very simple project. And it doesn't compile. It gives me the following output:
23:11:21: Starting: "/usr/bin/make" clean
rm -f main.o
rm -f *~ core *.core
23:11:21: The process "/usr/bin/make" exited normally.
23:11:21: Configuration unchanged, skipping qmake step.
23:11:21: Starting: "/usr/bin/make"
/Applications/Xcode 6.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -c -pipe -g -isysroot /Applications/Xcode 6.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -mFile Doesn't Exist, Will Create: /Applications/Xcode Invalid Arguments -version-min=10.6 -Wall -W -fPIE -DQT_CORE_LIB -I/Applications/QT/5.3/clang_64/mkspecs/macx-clang -I../Test -I/Applications/QT/5.3/clang_64/lib/QtCore.framework/Versions/5/Headers -I. -I. -F/Applications/QT/5.3/clang_64/lib -o main.o ../Test/main.cpp
/bin/sh: -c: line 0: unexpected EOF while looking for matching `''
/bin/sh: -c: line 1: syntax error: unexpected end of file
make: *** [main.o] Error 2
23:11:22: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project Test (kit: Desktop Qt 5.3 clang 64bit)
When executing step "Make"
23:11:22: Elapsed time: 00:00.
What's wrong here? How do I fix it?
EDIT. A part of Makefile:
MAKEFILE = Makefile
####### Compiler, tools and options
CC = /Applications/Xcode 6.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
CXX = /Applications/Xcode 6.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++
DEFINES = -DQT_CORE_LIB
CFLAGS = -pipe -g -isysroot /Applications/Xcode 6.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -mFile Doesn't Exist, Will Create: /Applications/Xcode Invalid Arguments -version-min=10.6 -Wall -W -fPIE $(DEFINES)
CXXFLAGS = -pipe -g -isysroot /Applications/Xcode 6.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -mFile Doesn't Exist, Will Create: /Applications/Xcode Invalid Arguments -version-min=10.6 -Wall -W -fPIE $(DEFINES)
INCPATH = -I/Applications/QT/5.3/clang_64/mkspecs/macx-clang -I../Test -I/Applications/QT/5.3/clang_64/lib/QtCore.framework/Versions/5/Headers -I. -I. -F/Applications/QT/5.3/clang_64/lib
LINK = /Applications/Xcode 6.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++
LFLAGS = -headerpad_max_install_names -Wl,-syslibroot,/Applications/Xcode 6.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -mFile Doesn't Exist, Will Create: /Applications/Xcode Invalid Arguments -version-min=10.6
LIBS = $(SUBLIBS) -F/Applications/QT/5.3/clang_64/lib -framework QtCore
AR = /Applications/Xcode 6.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar cq
RANLIB = /Applications/Xcode 6.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib -s
QMAKE = /Applications/QT/5.3/clang_64/bin/qmake
TAR = tar -cf
COMPRESS = gzip -9f
COPY = cp -f
SED = sed
COPY_FILE = cp -f
COPY_DIR = cp -f -R
STRIP =
INSTALL_FILE = $(COPY_FILE)
INSTALL_DIR = $(COPY_DIR)
INSTALL_PROGRAM = $(COPY_FILE)
DEL_FILE = rm -f
SYMLINK = ln -f -s
DEL_DIR = rmdir
MOVE = mv -f
CHK_DIR_EXISTS= test -d
MKDIR = mkdir -p

Related

Getting the error "cc1plus: error: unrecognized command line option "-std=c++11"" when I run code on Qt creator

I have taken the code from the following source on Github and am trying to run it from Qt on RHEL Red Hat 4.4.7-17:
https://github.com/neveraway/oclJPEGDecoder
I extracted the project folder and ran qmake -projectin it. I opened the files in Qt creator and further modified my .pro file to link OpenCL sources and add the CXX and CFLAGS.
My .pro file looks like this:
######################################################################
# Automatically generated by qmake (1.07a) Tue Mar 28 14:51:49 2017
######################################################################
TEMPLATE = app
DEPENDPATH += src \
/usr/local/cuda-7.0/lib64/
INCLUDEPATH += . src \
/usr/local/cuda-7.0/lib64/\
/usr/local/cuda-7.0/include/
# Input
HEADERS += src/bitstream.h \
src/bmp.h \
src/decoder.h \
src/huffman.h \
src/idct.h \
src/jpeg.h \
src/macro.h \
src/stdafx.h \
src/targetver.h \
src/zigzag.h
SOURCES += src/bitstream.cpp \
src/cpuIDCT8x8.cpp \
src/decoder.cpp \
src/huffman.cpp \
src/main.cpp \
src/oclDCT8x8.cpp \
src/parser.cpp \
src/stdafx.cpp \
src/main.cpp
LIBS += -L/usr/local/cuda-7.0/lib64/ -lOpenCL
QMAKE_CXXFLAGS += -std=c++11
QMAKE_CFLAGS += -std=c99
DISTFILES += \
src/idct8x8.cl \
oclJPEGDecoder.sln \
oclJPEGDecoder.vcxproj \
oclJPEGDecoder.vcxproj.filters \
README.md \
test/JPEG_example_JPG_RIP_050.jpg
When I clicked on Run qmake and then Build All, this is what I saw under "Compile Output":
18:08:23: Configuration unchanged, skipping qmake step.
18:08:23: Starting: "/usr/bin/make"
Makefile:634: warning: overriding commands for target `main.o'
Makefile:603: warning: ignoring old commands for target `main.o'
g++ -c -pipe -std=c++11 -g -std=gnu++0x -Wall -W -D_REENTRANT -fPIC -DQT_QML_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -I../oclJPEGDecoder-master -I. -I../oclJPEGDecoder-master -I../oclJPEGDecoder-master/src -I/usr/local/cuda-7.0/lib64 -I/usr/local/cuda-7.0/include -I/opt/Qt5.6.2/5.6/gcc_64/include -I/opt/Qt5.6.2/5.6/gcc_64/include/QtGui -I/opt/Qt5.6.2/5.6/gcc_64/include/QtCore -I. -I/opt/Qt5.6.2/5.6/gcc_64/mkspecs/linux-g++ -o bitstream.o ../oclJPEGDecoder-master/src/bitstream.cpp
cc1plus: error: unrecognized command line option "-std=c++11"
make: *** [bitstream.o] Error 1
18:08:23: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project oclJPEGDecoder-master (kit: Desktop Qt 5.6.2 GCC 64bit)
When executing step "Make"
18:08:23: Elapsed time: 00:00.
My Makefile has the following contents:
#############################################################################
# Makefile for building: oclJPEGDecoder-master
# Generated by qmake (3.0) (Qt 5.6.2)
# Project: ../oclJPEGDecoder-master/oclJPEGDecoder-master.pro
# Template: app
# Command: /opt/Qt5.6.2/5.6/gcc_64/bin/qmake -spec linux-g++ CONFIG+=debug CONFIG+=qml_debug -o Makefile ../oclJPEGDecoder-master/oclJPEGDecoder-master.pro
#############################################################################
MAKEFILE = Makefile
####### Compiler, tools and options
CC = gcc
CXX = g++
DEFINES = -DQT_QML_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB
CFLAGS = -pipe -g -Wall -W -D_REENTRANT -fPIC $(DEFINES)
CXXFLAGS = -pipe -std=c++11 -g -std=gnu++0x -Wall -W -D_REENTRANT -fPIC $(DEFINES)
INCPATH = -I../oclJPEGDecoder-master -I. -I../oclJPEGDecoder-master -I../oclJPEGDecoder-master/src -I/usr/local/cuda-7.0/lib64 -I/usr/local/cuda-7.0/include -I/opt/Qt5.6.2/5.6/gcc_64/include -I/opt/Qt5.6.2/5.6/gcc_64/include/QtGui -I/opt/Qt5.6.2/5.6/gcc_64/include/QtCore -I. -I/opt/Qt5.6.2/5.6/gcc_64/mkspecs/linux-g++
QMAKE = /opt/Qt5.6.2/5.6/gcc_64/bin/qmake
DEL_FILE = rm -f
CHK_DIR_EXISTS= test -d
MKDIR = mkdir -p
COPY = cp -f
COPY_FILE = cp -f
COPY_DIR = cp -f -R
INSTALL_FILE = install -m 644 -p
INSTALL_PROGRAM = install -m 755 -p
INSTALL_DIR = cp -f -R
DEL_FILE = rm -f
SYMLINK = ln -f -s
DEL_DIR = rmdir
MOVE = mv -f
TAR = tar -cf
COMPRESS = gzip -9f
DISTNAME = oclJPEGDecoder-master1.0.0
DISTDIR = /root/Downloads/build-oclJPEGDecoder-master-Desktop_Qt_5_6_2_GCC_64bit-Debug/.tmp/oclJPEGDecoder-master1.0.0
LINK = g++
LFLAGS = -Wl,-rpath,/opt/Qt5.6.2/5.6/gcc_64/lib
LIBS = $(SUBLIBS) -L/usr/local/cuda-7.0/lib64/ -lOpenCL -L/opt/Qt5.6.2/5.6/gcc_64/lib -lQt5Gui -L/usr/lib64 -lQt5Core -lGL -lpthread
AR = ar cqs
RANLIB =
SED = sed
STRIP = strip
My .o files look like this:
####### Compile
bitstream.o: ../oclJPEGDecoder-master/src/bitstream.cpp ../oclJPEGDecoder-master/src/stdafx.h \
../oclJPEGDecoder-master/src/targetver.h \
../oclJPEGDecoder-master/src/macro.h \
../oclJPEGDecoder-master/src/bitstream.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o bitstream.o ../oclJPEGDecoder-master/src/bitstream.cpp
cpuIDCT8x8.o: ../oclJPEGDecoder-master/src/cpuIDCT8x8.cpp ../oclJPEGDecoder-master/src/stdafx.h \
../oclJPEGDecoder-master/src/targetver.h \
../oclJPEGDecoder-master/src/macro.h \
../oclJPEGDecoder-master/src/idct.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o cpuIDCT8x8.o ../oclJPEGDecoder-master/src/cpuIDCT8x8.cpp
decoder.o: ../oclJPEGDecoder-master/src/decoder.cpp ../oclJPEGDecoder-master/src/stdafx.h \
../oclJPEGDecoder-master/src/targetver.h \
../oclJPEGDecoder-master/src/macro.h \
../oclJPEGDecoder-master/src/jpeg.h \
../oclJPEGDecoder-master/src/bmp.h \
../oclJPEGDecoder-master/src/bitstream.h \
../oclJPEGDecoder-master/src/huffman.h \
../oclJPEGDecoder-master/src/zigzag.h \
../oclJPEGDecoder-master/src/idct.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o decoder.o ../oclJPEGDecoder-master/src/decoder.cpp
huffman.o: ../oclJPEGDecoder-master/src/huffman.cpp ../oclJPEGDecoder-master/src/stdafx.h \
../oclJPEGDecoder-master/src/targetver.h \
../oclJPEGDecoder-master/src/macro.h \
../oclJPEGDecoder-master/src/huffman.h \
../oclJPEGDecoder-master/src/bitstream.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o huffman.o ../oclJPEGDecoder-master/src/huffman.cpp
main.o: ../oclJPEGDecoder-master/src/main.cpp ../oclJPEGDecoder-master/src/stdafx.h \
../oclJPEGDecoder-master/src/targetver.h \
../oclJPEGDecoder-master/src/macro.h \
../oclJPEGDecoder-master/src/bitstream.h \
../oclJPEGDecoder-master/src/huffman.h \
../oclJPEGDecoder-master/src/idct.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o main.o ../oclJPEGDecoder-master/src/main.cpp
oclDCT8x8.o: ../oclJPEGDecoder-master/src/oclDCT8x8.cpp ../oclJPEGDecoder-master/src/stdafx.h \
../oclJPEGDecoder-master/src/targetver.h \
/usr/local/cuda-7.0/include/CL/opencl.h \
/usr/local/cuda-7.0/include/CL/cl.h \
/usr/local/cuda-7.0/include/CL/cl_platform.h \
/usr/local/cuda-7.0/include/CL/cl_gl.h \
/usr/local/cuda-7.0/include/CL/cl_gl_ext.h \
/usr/local/cuda-7.0/include/CL/cl_ext.h \
../oclJPEGDecoder-master/src/macro.h \
../oclJPEGDecoder-master/src/idct.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o oclDCT8x8.o ../oclJPEGDecoder-master/src/oclDCT8x8.cpp
parser.o: ../oclJPEGDecoder-master/src/parser.cpp ../oclJPEGDecoder-master/src/stdafx.h \
../oclJPEGDecoder-master/src/targetver.h \
../oclJPEGDecoder-master/src/macro.h \
../oclJPEGDecoder-master/src/jpeg.h \
../oclJPEGDecoder-master/src/decoder.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o parser.o ../oclJPEGDecoder-master/src/parser.cpp
stdafx.o: ../oclJPEGDecoder-master/src/stdafx.cpp ../oclJPEGDecoder-master/src/stdafx.h \
../oclJPEGDecoder-master/src/targetver.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o stdafx.o ../oclJPEGDecoder-master/src/stdafx.cpp
main.o: ../oclJPEGDecoder-master/src/main.cpp ../oclJPEGDecoder-master/src/stdafx.h \
../oclJPEGDecoder-master/src/targetver.h \
../oclJPEGDecoder-master/src/macro.h \
../oclJPEGDecoder-master/src/bitstream.h \
../oclJPEGDecoder-master/src/huffman.h \
../oclJPEGDecoder-master/src/idct.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o main.o ../oclJPEGDecoder-master/src/main.cpp
####### Install
install: FORCE
uninstall: FORCE
FORCE:
2nd ATTEMPT WITH -std=c++0x:
I changed the CXX_FLAGS command to QMAKE_CXXFLAGS += -std=c++0x and kept everything else unchanged in my .pro file.
When I clicked on Build All after making the change, this is the output I got under "Compile Output":
18:38:06: Running steps for project oclJPEGDecoder-master...
18:38:06: Configuration unchanged, skipping qmake step.
18:38:06: Starting: "/usr/bin/make"
Makefile:634: warning: overriding commands for target `main.o'
Makefile:603: warning: ignoring old commands for target `main.o'
g++ -c -pipe -std=c++0x -g -std=gnu++0x -Wall -W -D_REENTRANT -fPIC -DQT_QML_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -I../oclJPEGDecoder-master -I. -I../oclJPEGDecoder-master -I../oclJPEGDecoder-master/src -I/usr/local/cuda-7.0/lib64 -I/usr/local/cuda-7.0/include -I/opt/Qt5.6.2/5.6/gcc_64/include -I/opt/Qt5.6.2/5.6/gcc_64/include/QtGui -I/opt/Qt5.6.2/5.6/gcc_64/include/QtCore -I. -I/opt/Qt5.6.2/5.6/gcc_64/mkspecs/linux-g++ -o bitstream.o ../oclJPEGDecoder-master/src/bitstream.cpp
In file included from ../oclJPEGDecoder-master/src/bitstream.cpp:4:
../oclJPEGDecoder-master/src/bitstream.h:368: error: 'nullptr' was not declared in this scope
../oclJPEGDecoder-master/src/bitstream.h:368: error: ISO C++ forbids initialization of member 'mBitReservoir'
../oclJPEGDecoder-master/src/bitstream.h:368: error: making 'mBitReservoir' static
../oclJPEGDecoder-master/src/bitstream.h:368: error: invalid in-class initialization of static data member of non-integral type 'uint8_t*'
../oclJPEGDecoder-master/src/bitstream.h:369: error: ISO C++ forbids initialization of member 'mCapacity'
../oclJPEGDecoder-master/src/bitstream.h:369: error: making 'mCapacity' static
../oclJPEGDecoder-master/src/bitstream.h:369: error: ISO C++ forbids in-class initialization of non-const static member 'mCapacity'
../oclJPEGDecoder-master/src/bitstream.h: In member function 'void BitStream::free()':
../oclJPEGDecoder-master/src/bitstream.h:96: error: 'mBitReservoir' was not declared in this scope
../oclJPEGDecoder-master/src/bitstream.h:96: error: 'nullptr' was not declared in this scope
../oclJPEGDecoder-master/src/bitstream.h:98: error: type '<type error>' argument given to 'delete', expected pointer
../oclJPEGDecoder-master/src/bitstream.h: In member function 'void BitStream::trim()':
../oclJPEGDecoder-master/src/bitstream.h:110: error: 'mBitReservoir' was not declared in this scope
../oclJPEGDecoder-master/src/bitstream.h: In member function 'bool BitStream::reserve(size_t)':
../oclJPEGDecoder-master/src/bitstream.h:137: error: 'mBitReservoir' was not declared in this scope
../oclJPEGDecoder-master/src/bitstream.h: In member function 'bool BitStream::frontBit() const':
../oclJPEGDecoder-master/src/bitstream.h:209: error: 'mBitReservoir' was not declared in this scope
../oclJPEGDecoder-master/src/bitstream.h: In member function 'uint8_t BitStream::frontFullByte() const':
../oclJPEGDecoder-master/src/bitstream.h:214: error: 'mBitReservoir' was not declared in this scope
../oclJPEGDecoder-master/src/bitstream.h: In member function 'uint32_t BitStream::front9b(uint8_t) const':
../oclJPEGDecoder-master/src/bitstream.h:219: error: 'mBitReservoir' was not declared in this scope
../oclJPEGDecoder-master/src/bitstream.h: In member function 'uint32_t BitStream::front17b(uint8_t) const':
../oclJPEGDecoder-master/src/bitstream.h:227: error: 'mBitReservoir' was not declared in this scope
../oclJPEGDecoder-master/src/bitstream.h: In member function 'uint32_t BitStream::front25b(uint8_t) const':
../oclJPEGDecoder-master/src/bitstream.h:235: error: 'mBitReservoir' was not declared in this scope
../oclJPEGDecoder-master/src/bitstream.h: In member function 'void BitStream::writeBit(bool)':
../oclJPEGDecoder-master/src/bitstream.h:246: error: 'mBitReservoir' was not declared in this scope
../oclJPEGDecoder-master/src/bitstream.h:248: error: 'mBitReservoir' was not declared in this scope
../oclJPEGDecoder-master/src/bitstream.h: In member function 'const uint8_t* BitStream::frontData() const':
../oclJPEGDecoder-master/src/bitstream.h:307: error: 'mBitReservoir' was not declared in this scope
../oclJPEGDecoder-master/src/bitstream.h: In member function 'uint32_t BitStream::cachedFrontBits(int)':
../oclJPEGDecoder-master/src/bitstream.h:340: error: 'mBitReservoir' was not declared in this scope
../oclJPEGDecoder-master/src/bitstream.h: In member function 'void BitStream::moveDataTo(uint8_t*)':
../oclJPEGDecoder-master/src/bitstream.h:398: error: 'mBitReservoir' was not declared in this scope
../oclJPEGDecoder-master/src/bitstream.cpp: In member function 'size_t BitStream::append(const uint8_t*, size_t)':
../oclJPEGDecoder-master/src/bitstream.cpp:22: error: 'mBitReservoir' was not declared in this scope
make: *** [bitstream.o] Error 1
18:38:06: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project oclJPEGDecoder-master (kit: Desktop Qt 5.6.2 GCC 64bit)
When executing step "Make"
18:38:06: Elapsed time: 00:00.
I got errors in bitstream.c due to incompatibility with the compiler.
How can I get around this issue? Do I absolutely need to install a new version of g++ to get this code to work? Do I need to include anything in my Makefile?
Please guide me in this matter.
EDIT:
My output for g++ --version:
g++ (GCC) 4.4.7 20120313 (Red Hat 4.4.7-17)
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
I typed yum install rpmdevtools rpm-build and it gave me the following response:
Loaded plugins: product-id, refresh-packagekit, search-disabled-repos, security,
: subscription-manager
Setting up Install Process
Package rpmdevtools-7.5-2.el6.noarch already installed and latest version
Package rpm-build-4.8.0-55.el6.x86_64 already installed and latest version
Nothing to do
I wanted to obtain more information about gcc on my system so I typed this command:
yum list available |grep gcc
It gave me this response:
compat-gcc-34.x86_64 3.4.6-19.el6 rhel-6-workstation-rpms
compat-gcc-34-c++.x86_64 3.4.6-19.el6 rhel-6-workstation-rpms
compat-gcc-34-g77.x86_64 3.4.6-19.el6 rhel-6-workstation-rpms
gcc-gnat.x86_64 4.4.7-18.el6 rhel-6-workstation-rpms
gcc-java.x86_64 4.4.7-18.el6 rhel-6-workstation-rpms
gcc-objc.x86_64 4.4.7-18.el6 rhel-6-workstation-rpms
gcc-objc++.x86_64 4.4.7-18.el6 rhel-6-workstation-rpms
Your 4.4.7 version of gcc is too old to fully enable C++11 features.
You need to upgrade the compiler to a version superior to 4.6 ( at least ) or if it's possible for you, upgrade your distro (let's say RHEL 7) which includes a more recent compiler.

Gfortran compiling error after replacing with f77

QI need to compile some files using gfortran. I went to the makefile and replaced all the "f77" with "gfortran". However I get this error when I do "make"
gfortran -c verbal.f
gfortran -c trgl6_octa.f
gfortran -c trgl6_icos.f
gfortran -c gauss_trgl.f
gfortran -c gauss_leg.f
gfortran -c sgf_3d_fs.f
gfortran -c sgf_3d_w.f
f77 -c -o sgf_3d_2p_w.o sgf_3d_2p_w.f
make: f77: Command not found
make: *** [sgf_3d_2p_w.o] Error 127
I do not understand where in the make file (pasted below) there is a hidden f77 that did not get replaced. I checked all the sources files for "f77" and there was none. I am very confused.
#
# Objects
# -------
#
OBJ0 = verbal.o
OBJ1 = trgl6_octa.o trgl6_icos.o gauss_trgl.o gauss_leg.o
OBJ2 = sgf_3d_fs.o sgf_3d_w.o sgf_3d_2p_w.o
OBJ2A = sgf_3d_3p.o sgf_3d_3p_ewald.o sgf_3d_3p_qqq.o
OBJ3 = prtcl_3d_mob.o
OBJ30 = elm_geom.o abc.o interp_p.o printel.o
OBJ33 = slp_trgl6.o slp_trgl6_sing.o slp_trgl3_sing.o
OBJ4 = gel.o gel_inv.o
OBJ = $(OBJ0) $(OBJ1) $(OBJ2) $(OBJ2A) $(OBJ3) $(OBJ30) $(OBJ33) $(OBJ4)
#
# link
# ----
#
prtcl_3d_mob: $(OBJ)
gfortran -c prtcl_3d_mob $(OBJ)
#
# compile
# ------
#
prtcl_3d_mob.o: prtcl_3d_mob.f
gfortran -c prtcl_3d_mob.f
trgl6_octa.o: trgl6_octa.f
gfortran -c trgl6_octa.f
trgl6_icos.o: trgl6_icos.f
gfortran -c trgl6_icos.f
verbal.o: verbal.f
gfortran -c verbal.f
sgf_3d_fs.o: sgf_3d_fs.f
gfortran -c sgf_3d_fs.f
sgf_3d_w.o: sgf_3d_w.f
gfortran -c sgf_3d_w.f
sgf_3d_3p.o: sgf_3d_3p.f
gfortran -c sgf_3d_3p.f
sgf_3d_3p_ewald.o: sgf_3d_3p_ewald.f
gfortran -c sgf_3d_3p_ewald.f
sgf_3d_3p_qqq.o: sgf_3d_3p_qqq.f
gfortran -c sgf_3d_3p_qqq.f
gel.o: gel.f
gfortran -c gel.f
gel_inv.o: gel_inv.f
gfortran -c gel_inv.f
prtcl_3d_geo.o: prtcl_3d_geo.f
gfortran -c prtcl_3d_geo.f
interp_p.o: interp_p.f
gfortran -c interp_p.f
abc.o: abc.f
gfortran -c abc.f
printel.o: printel.f
gfortran -c printel.f
elm_geom.o: elm_geom.f
gfortran -c elm_geom.f
slp_trgl6.o: slp_trgl6.f
gfortran -c slp_trgl6.f
slp_trgl6_sing.o: slp_trgl6_sing.f
gfortran -c slp_trgl6_sing.f
slp_trgl3_sing.o: slp_trgl3_sing.f
gfortran -c slp_trgl3_sing.f
gauss_leg.o: gauss_leg.f
gfortran -c gauss_leg.f
gauss_trgl.o: gauss_trgl.f
gfortran -c gauss_trgl.f
#
# clean
# -----
#
clean:
rm -f core
rm -f $(OBJ) prtcl_3d_mob
rm -f prtcl_3d_mob.net prtcl_3d_mob.out
rm -f matrix_inverse.out
rm -f particle_elements.out
#
# purge
# ---
#
purge:
rm -f core
rm -f $(OBJ) prtcl_3d_mob
rm -f prtcl_3d_mob.net prtcl_3d_mob.out
rm -f matrix_inverse.out
rm -f particle_elements.out
#
# clobber
# ---
#
clobber:
rm *
#
# all
# ---
#
all:
make prtcl_3d_mob
GNU make has a number of implicit rules https://www.gnu.org/software/make/manual/make.html#Catalogue-of-Rules
By default, it will compile .f files with the rule $(FC) $(FFLAGS) -c where by default FC is set to f77 (see link above for all of this).
As an explicit rule ("from .f to .o") is not found for a file, make invokes the default rule.
Solutions: either one of the two
Set FC to gfortran
add an explicit rule for sgf_3d_2p_w.o
In general, I write the rule myself as
%.o: %.f90
$(FC) $(FFLAGS) -c $<
in the Makefile. It makes it obvious that I need to define FC and FFLAGS.
Also, you can then remove all of the individual rules for compiling your files.

Unable to install openssl in AIX due to "cc: unrecognized option"

So I installed openssl in one of the 3 aix servers but it just wouldn't work in the other 2 servers.
I'm trying to install openssl-1.0.1h on AIX.
Step 1: I ran the config file -
./config -–prefix=/appl/peoplesoft/apache/openssl
Output: a Makefile is generated.
Step 2: run the make command.
Output of command make:
$ make
making all in crypto...
( echo "#ifndef MK1MF_BUILD"; echo ' /* auto-generated by crypto/Makefile for crypto/cversion.c */'; echo ' #define CFLAGS "cc -DOPENSSL_THREADS -qthreaded -D_THREAD_SAFE -DDSO_DLFCN -DHAVE_DLFCN_H -q32 -O -DB_ENDIAN -qmaxmem=16384 -qro -qroconst -DOPENSSL_BN_ASM_MONT -DSHA1_ASM -DSHA256_ASM -DAES_ASM"'; echo ' #define PLATFORM "aix-cc"'; echo " #define DATE \"`LC_ALL=C LC_TIME=C date`\""; echo '#endif' ) >buildinf.h
cc -I. -I.. -I../include -DOPENSSL_THREADS -qthreaded -D_THREAD_SAFE -DDSO_DLFCN -DHAVE_DLFCN_H -q32 -O -DB_ENDIAN -qmaxmem=16384 -qro -qroconst -DOPENSSL_BN_ASM_MONT -DSHA1_ASM -DSHA256_ASM -DAES_ASM -c cryptlib.c
cc: unrecognized option '-qthreaded'
cc: unrecognized option '-q32'
cc: unrecognized option '-qmaxmem=16384'
cc: unrecognized option '-qro'
cc: unrecognized option '-qroconst'
I don't know what's wrong.
I'm using gcc version 4.2.0 and cc has a softlink to gcc.
Should I try copying the Makefile file from the server where it works?
I'll try the previous comments: gcc doesn't really understands xlc's options, use either this:
./Configure -–prefix=/appl/peoplesoft/apache/openssl -maix32 \
... aix-gcc
or
./Configure -–prefix=/appl/peoplesoft/apache/openssl -maix64 \
... aix64-gcc
Where ... is the set of compiler/linker options you can think of, eg:
-mtune=native -pthread -lpthreads -Wl,-brtl
Open config file , for AIX and locate the "favor vendor cc over gcc"
Change this: (replace cc with gcc for AIX)
if [ "${SYSTEM}" = "AIX" ]; then # favor vendor cc over gcc
(cc) 2>&1 | grep -iv "not found" > /dev/null && CC=cc
fi
to this :
if [ "${SYSTEM}" = "AIX" ]; then # favor vendor cc over gcc
(cc) 2>&1 | grep -iv "not found" > /dev/null && CC=gcc
fi
And rerun your configuration ...

linker could not found object files from different directory with scons

Currently, I make a project with scons.
I compiled source codes and it is time to link them.
However, I got an error that ld cannot find object files.
The SConscript is located in src/kernel32, and
import os, sys
# Compile CPP
env_gpp_options = {
'CXX' : 'x86_64-pc-linux-g++',
'CXXFLAGS' : '-std=c++11 -g -m32 -ffreestanding -fno-exceptions -fno-rtti',
'LINK' : 'x86_64-pc-linux-ld',
'LINKFLAGS' : '-melf_i386 -T scripts/elf_i386.x -nostdlib -e main -Ttext 0x10200',
}
env_gpp = Environment(**env_gpp_options)
env_gpp.Append(ENV = {'PATH' : os.environ['PATH']})
object_cpp_list = Glob('*.cpp')
for object_cpp in object_cpp_list:
env_gpp.Object(object_cpp)
# Find all object file
object_target_list = Glob('*.o')
# Linking
env_link_target = 'kernel32.elf'
env_gpp.Program(env_link_target, object_target_list)
and message I got is
x86_64-pc-linux-g++ -o build/kernel32/cpu.o -c -std=c++11 -g -m32 -ffreestanding -fno-exceptions -fno-rtti src/kernel32/cpu.cpp
x86_64-pc-linux-g++ -o build/kernel32/main.o -c -std=c++11 -g -m32 -ffreestanding -fno-exceptions -fno-rtti src/kernel32/main.cpp
x86_64-pc-linux-g++ -o build/kernel32/memory.o -c -std=c++11 -g -m32 -ffreestanding -fno-exceptions -fno-rtti src/kernel32/memory.cpp
x86_64-pc-linux-g++ -o build/kernel32/pageManager.o -c -std=c++11 -g -m32 -ffreestanding -fno-exceptions -fno-rtti src/kernel32/pageManager.cpp
x86_64-pc-linux-g++ -o build/kernel32/utils.o -c -std=c++11 -g -m32 -ffreestanding -fno-exceptions -fno-rtti src/kernel32/utils.cpp
x86_64-pc-linux-ld -o build/kernel32/kernel32.elf -melf_i386 -T scripts/elf_i386.x -nostdlib -e main -Ttext 0x10200 build/kernel32/asmUtils.o build/kernel32/cpu.o build/kernel32/main.o build/kernel32/memory.o build/kernel32/pageManager.o build/kernel32/utils.o
x86_64-pc-linux-ld: cannot find main.o
scons: *** [build/kernel32/kernel32.elf] Error 1
scons: building terminated because of errors.
I checked the directory, build/kernel32/, and I found main.o file.
What is my mistake?
Is there an way to change working directory for scons?
Please let me know what I missed.
You can try this:
import os, sys
# Compile CPP
env_gpp_options = {
'CXX' : 'x86_64-pc-linux-g++',
'CXXFLAGS' : '-std=c++11 -g -m32 -ffreestanding -fno-exceptions -fno-rtti',
'LINK' : 'x86_64-pc-linux-ld',
'LINKFLAGS' : '-melf_i386 -T scripts/elf_i386.x -nostdlib -e main -Ttext 0x10200',
}
env_gpp = Environment(**env_gpp_options)
env_gpp.Append(ENV = {'PATH' : os.environ['PATH']})
object_cpp_list = Glob('*.cpp')
object_target_list = []
for object_cpp in object_cpp_list:
object_target_list.extend(env_gpp.Object(object_cpp))
# Linking
env_link_target = 'kernel32.elf'
env_gpp.Program(env_link_target, object_target_list)
Or
import os, sys
# Compile CPP
env_gpp_options = {
'CXX' : 'x86_64-pc-linux-g++',
'CXXFLAGS' : '-std=c++11 -g -m32 -ffreestanding -fno-exceptions -fno-rtti',
'LINK' : 'x86_64-pc-linux-ld',
'LINKFLAGS' : '-melf_i386 -T scripts/elf_i386.x -nostdlib -e main -Ttext 0x10200',
}
env_gpp = Environment(**env_gpp_options)
env_gpp.Append(ENV = {'PATH' : os.environ['PATH']})
object_cpp_list = Glob('*.cpp')
# Linking
env_link_target = 'kernel32.elf'
env_gpp.Program(env_link_target, object_cpp_list)
This is full scons scripts.
In project root directory,
#SConstruct
build_dir = 'build'
# Build
SConscript(['src/SConscript'], variant_dir = build_dir, duplicate = 0)
# Clean
Clean('.', build_dir)
In src directory
#SConscript for src
SConscript(['bootloader/SConscript',
'kernel32/SConscript'])
In kernel32 directory
#SConscript for kernel32
import os, sys
# Build entry
env_entry = Environment(tools=['default', 'nasm'])
target_entry = 'entry.bin'
object_entry = 'entry.s'
output_entry = env_entry.Object(target_entry, object_entry)
# Compile CPP
env_gpp_options = {
'CXX' : 'x86_64-pc-linux-g++',
'CXXFLAGS' : '-std=c++11 -g -m32 -ffreestanding -fno-exceptions -fno-rtti',
'LINK' : 'x86_64-pc-linux-ld',
'LINKFLAGS' : '-melf_i386 -T scripts/elf_i386.x -nostdlib -e main -Ttext 0x10200',
}
env_gpp = Environment(**env_gpp_options)
env_gpp.Append(ENV = {'PATH' : os.environ['PATH']})
object_cpp_list = Glob('*.cpp')
for object_cpp in object_cpp_list:
env_gpp.Object(object_cpp)
# Compile ASM
env_nasm = Environment(tools=['default', 'nasm'])
env_nasm.Append(ASFLAGS='-f elf32')
object_nasm_list = Glob('*.asm')
for object_nasm in object_nasm_list:
env_nasm.Object(object_nasm)
# Find all object file
object_target_list = Glob('*.o')
object_target_list.append('entry.bin')
# Linking
env_link_target = 'kernel32.elf'
env_gpp.Program(env_link_target, object_target_list)
Thank you for your attention.

Problems linking FreeImage 3.16.0 using make and Clang on Mac OS X 10.8

I've modified the Makefile.osx file that comes with FreeImage 3.16.0 to compile using Clang and to use the latest 10.8 Mac OS X SDK, which has gotten rid of most of the problems, but I'm completely stuck on a small set of linker errors that I can't find any information on.
I modified the makefile based off of the recommendations of this other post on stackoverflow: How to compile FreeImage on Mac OS X 10.8?
And this is what it currently looks like:
# -*- Makefile -*-
# Mac OSX makefile for FreeImage
# This file can be generated by ./gensrclist.sh
include Makefile.srcs
# General configuration variables:
CC_I386 = Clang
CC_X86_64 = Clang
CPP_I386 = Clang++
CPP_X86_64 = Clang++
COMPILERFLAGS = -Os -fexceptions -fvisibility=hidden -DNO_LCMS -D__ANSI__
COMPILERFLAGS_I386 = -arch i386
COMPILERFLAGS_X86_64 = -arch x86_64
COMPILERPPFLAGS = -Wno-ctor-dtor-privacy -D__ANSI__ -stdlib=libc++
INCLUDE +=
INCLUDE_I386 = -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk
INCLUDE_X86_64 = -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk
CFLAGS_I386 = $(COMPILERFLAGS) $(COMPILERFLAGS_I386) $(INCLUDE) $(INCLUDE_I386)
CFLAGS_X86_64 = $(COMPILERFLAGS) $(COMPILERFLAGS_X86_64) $(INCLUDE) $(INCLUDE_X86_64)
CPPFLAGS_I386 = $(COMPILERPPFLAGS) $(CFLAGS_I386)
CPPFLAGS_X86_64 = $(COMPILERPPFLAGS) $(CFLAGS_X86_64)
LIBRARIES_I386 = -Wl,-syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk
LIBRARIES_X86_64 = -Wl,-syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk
LIBTOOL = libtool
LIPO = lipo
TARGET = freeimage
STATICLIB = lib$(TARGET).a
SHAREDLIB = lib$(TARGET)-$(VER_MAJOR).$(VER_MINOR).dylib
LIBNAME = lib$(TARGET).$(VER_MAJOR).dylib
HEADER = Source/FreeImage.h
.SUFFIXES: .o-i386 .o-x86_64
MODULES_I386 = $(SRCS:.c=.o-i386)
MODULES_X86_64 = $(SRCS:.c=.o-x86_64)
MODULES_I386 := $(MODULES_I386:.cpp=.o-i386)
MODULES_X86_64 := $(MODULES_X86_64:.cpp=.o-x86_64)
PREFIX = /usr/local
INSTALLDIR = $(PREFIX)/lib
INCDIR = $(PREFIX)/include
default: all
all: dist
dist: FreeImage
cp *.a Dist
cp *.dylib Dist
cp Source/FreeImage.h Dist
FreeImage: $(STATICLIB) $(SHAREDLIB)
$(STATICLIB): $(STATICLIB)-i386 $(STATICLIB)-x86_64
$(LIPO) -create $(STATICLIB)-i386 $(STATICLIB)-x86_64 -output $(STATICLIB)
$(STATICLIB)-i386: $(MODULES_I386)
$(LIBTOOL) -arch_only i386 -o $# $(MODULES_I386)
$(STATICLIB)-x86_64: $(MODULES_X86_64)
$(LIBTOOL) -arch_only x86_64 -o $# $(MODULES_X86_64)
$(SHAREDLIB): $(SHAREDLIB)-i386 $(SHAREDLIB)-x86_64
$(LIPO) -create $(SHAREDLIB)-i386 $(SHAREDLIB)-x86_64 -output $(SHAREDLIB)
$(SHAREDLIB)-i386: $(MODULES_I386)
$(CPP_I386) -arch i386 -dynamiclib $(LIBRARIES_I386) -o $# $(MODULES_I386)
$(SHAREDLIB)-x86_64: $(MODULES_X86_64)
$(CPP_X86_64) -arch x86_64 -dynamiclib $(LIBRARIES_X86_64) -o $# $(MODULES_X86_64)
.c.o-i386:
$(CC_I386) $(CFLAGS_I386) -c $< -o $#
.c.o-x86_64:
$(CC_X86_64) $(CFLAGS_X86_64) -c $< -o $#
.cpp.o-i386:
$(CPP_I386) $(CPPFLAGS_I386) -c $< -o $#
.cpp.o-x86_64:
$(CPP_X86_64) $(CPPFLAGS_X86_64) -c $< -o $#
install:
install -d -m 755 -o root -g wheel $(INCDIR) $(INSTALLDIR)
install -m 644 -o root -g wheel $(HEADER) $(INCDIR)
install -m 644 -o root -g wheel $(SHAREDLIB) $(STATICLIB) $(INSTALLDIR)
ranlib -sf $(INSTALLDIR)/$(STATICLIB)
ln -sf $(SHAREDLIB) $(INSTALLDIR)/$(LIBNAME)
clean:
rm -f core Dist/*.* u2dtmp* $(MODULES_I386) $(MODULES_X86_64) $(STATICLIB) $(STATICLIB)-i386 $(SHAREDLIB) $(SHAREDLIB)-i386 $(SHAREDLIB)-x86_64
The linker errors I'm getting are something in LibJXR as far as I can tell:
Undefined symbols for architecture i386:
"_PerfTimerCopyStartTime", referenced from:
_ImageStrDecInit in strdec.o-i386
_ImageStrEncInit in strenc.o-i386
"_PerfTimerDelete", referenced from:
_ImageStrDecTerm in strdec.o-i386
_ImageStrEncTerm in strenc.o-i386
"_PerfTimerGetResults", referenced from:
_OutputIndivPerfTimer in strcodec.o-i386
"_PerfTimerNew", referenced from:
_ImageStrDecInit in strdec.o-i386
_ImageStrEncInit in strenc.o-i386
"_PerfTimerStart", referenced from:
_ImageStrDecInit in strdec.o-i386
_ImageStrDecDecode in strdec.o-i386
_ImageStrDecTerm in strdec.o-i386
_ImageStrEncInit in strenc.o-i386
_ImageStrEncEncode in strenc.o-i386
_ImageStrEncTerm in strenc.o-i386
_readIS in strcodec.o-i386
...
"_PerfTimerStop", referenced from:
_ImageStrDecInit in strdec.o-i386
_ImageStrDecDecode in strdec.o-i386
_ImageStrDecTerm in strdec.o-i386
_ImageStrEncInit in strenc.o-i386
_ImageStrEncEncode in strenc.o-i386
_ImageStrEncTerm in strenc.o-i386
_readIS in strcodec.o-i386
I really have no idea what to try to fix this, especially since it's only happening for the i386 configuration, the x86_64 configuration seems to be linking just fine.
If you don't need the LibJXR performance timers, you can just disable them. Change this line in your makefile:
COMPILERFLAGS = -Os -fexceptions -fvisibility=hidden -DNO_LCMS -D__ANSI__
to:
COMPILERFLAGS = -Os -fexceptions -fvisibility=hidden -DNO_LCMS -D__ANSI__ -DDISABLE_PERF_MEASUREMENT
I was also able to overcome these errors by adding the file "Source/LibJXR/image/sys/perfTimerANSI.c" to the SRCS section of Makefile.srcs. That's the file where the symbols listed as missing are implemented.

Resources