QDevelop Qt IDE in Ubuntu 10.04 LTS Lucid Lynx qwt - build

I am having an issue using the QDevelop, Qt IDE (Qt version 4.6.2) in Ubuntu 10.04 LTS Lucid Lynx. The code I am trying to work with was transfered from a newer 64bit laptop to my 32 bit laptop. Both systems are running the same version of Ubuntu and Qt IDE. When I try building the code I get a long list of errors, which I don't really want to post here but I will at the end of my text. Any help would be greatly appreciated. For whatever reason, my blocks of text are getting cut off. I am using the "< pre>insert text here< slashpre> white space retainer trick, what am I doing wrong? Ok my build chunk of text is not being formatted properly using the pre slashpre html thingies.. The formating of this post is getting all messed up! :|
Email I sent my college:
I installed the 32bit version of qwt-5.2.1 and it still isn’t building, I get the same errors.
Attached are my .pro and make files as well as buildoutput.txt showing the results of my build.
See if you see anything wrong with any of the information below:
Checking paths:
In the myPico.pro file there is a line: LIBS += -L/usr/local/qwt-5.2.1/lib -lqwt-qt4 (This is 32bit, I found you can type “file” then space and a file name, it will give you information about the file including if it’s 32bit or 64bit. See note below.)
Inside /usr/local/qwt-5.2.1/lib I have three items that are teal: libqwt.so, libqwt.so.5 and libqwt.so.5.2 and one green item: libqwt.so.5.2.1. They all point to libqwt.so.5.2.1 and it’s 32bit.
Inside the Makefile, the line INCPATH everything seems ok, but I don’t understand the last part of the line: “-I/usr/include/qt4 -Ibuild -Ibuild” When I go to /usr/include/qt4 I don’t see anything that says build. Could this be an issue?
In searching the web for solutions I see a lot of people having the same issue but their solutions are cryptic/Band-Aid short cuts.
Note: I thought of a possible issue. You had me copy the libs from your system and then we found out they were 64 bit. I installed the 32 bit ones but I don’t know if that removed what we copied manually. So I am trying to figure out where we copied those libs to. Ok I found it (/usr/local/qwt-5.2.1/lib) and they’re 32 bit, so installing the 32 bit overwrote the 64bit versions.
.pro file:
TEMPLATE = app
QT = gui core
CONFIG += qt warn_on console debug
DESTDIR = bin
OBJECTS_DIR = build
MOC_DIR = build
UI_DIR = build
FORMS = ui/mainwindow.ui
HEADERS = src/mainwindowimpl.h src/picofunctions.h src/Thread.h
SOURCES = src/mainwindowimpl.cpp src/main.cpp src/picofunctions.cpp src/Thread.cpp
LIBS += -L/usr/local/qwt-5.2.1/lib -lqwt-qt4
Makefile:
#############################################################################
# Makefile for building: bin/myPico
# Generated by qmake (2.01a) (Qt 4.6.2) on: Mon Nov 22 10:56:19 2010
# Project: myPico.pro
# Template: app
# Command: /usr/bin/qmake-qt4 -unix -o Makefile myPico.pro
#############################################################################
####### Compiler, tools and options
CC = gcc
CXX = g++
DEFINES = -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED
CFLAGS = -pipe -g -Wall -W -D_REENTRANT $(DEFINES)
CXXFLAGS = -pipe -g -Wall -W -D_REENTRANT $(DEFINES)
INCPATH = -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -Ibuild -Ibuild
LINK = g++
LFLAGS =
LIBS = $(SUBLIBS) -L/usr/lib -L/usr/local/qwt-5.2.1/lib -lqwt-qt4 -lQtGui -lQtCore -lpthread
AR = ar cqs
RANLIB =
QMAKE = /usr/bin/qmake-qt4
TAR = tar -cf
COMPRESS = gzip -9f
COPY = cp -f
SED = sed
COPY_FILE = $(COPY)
COPY_DIR = $(COPY) -r
STRIP = strip
INSTALL_FILE = install -m 644 -p
INSTALL_DIR = $(COPY_DIR)
INSTALL_PROGRAM = install -m 755 -p
DEL_FILE = rm -f
SYMLINK = ln -f -s
DEL_DIR = rmdir
MOVE = mv -f
CHK_DIR_EXISTS= test -d
MKDIR = mkdir -p
####### Output directory
OBJECTS_DIR = build/
####### Files
SOURCES = src/mainwindowimpl.cpp \
src/main.cpp \
src/picofunctions.cpp \
src/Thread.cpp build/moc_mainwindowimpl.cpp
OBJECTS = build/mainwindowimpl.o \
build/main.o \
build/picofunctions.o \
build/Thread.o \
build/moc_mainwindowimpl.o
DIST = /usr/share/qt4/mkspecs/common/g++.conf \
/usr/share/qt4/mkspecs/common/unix.conf \
/usr/share/qt4/mkspecs/common/linux.conf \
/usr/share/qt4/mkspecs/qconfig.pri \
/usr/share/qt4/mkspecs/features/qt_functions.prf \
/usr/share/qt4/mkspecs/features/qt_config.prf \
/usr/share/qt4/mkspecs/features/exclusive_builds.prf \
/usr/share/qt4/mkspecs/features/default_pre.prf \
/usr/share/qt4/mkspecs/features/debug.prf \
/usr/share/qt4/mkspecs/features/default_post.prf \
/usr/share/qt4/mkspecs/features/warn_on.prf \
/usr/share/qt4/mkspecs/features/qt.prf \
/usr/share/qt4/mkspecs/features/unix/thread.prf \
/usr/share/qt4/mkspecs/features/moc.prf \
/usr/share/qt4/mkspecs/features/resources.prf \
/usr/share/qt4/mkspecs/features/uic.prf \
/usr/share/qt4/mkspecs/features/yacc.prf \
/usr/share/qt4/mkspecs/features/lex.prf \
myPico.pro
QMAKE_TARGET = myPico
DESTDIR = bin/
TARGET = bin/myPico
first: all
####### Implicit rules
.SUFFIXES: .o .c .cpp .cc .cxx .C
.cpp.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$#" "$
Build output:
Build (make)...
g++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -Ibuild -Ibuild -o build/mainwindowimpl.o src/mainwindowimpl.cpp
In file included from /usr/include/qt4/qwt_plot.h:17
,
from build/ui_mainwindow.h:29,
from src/mainwindowimpl.h:5,
from src/mainwindowimpl.cpp:1:
/usr/include/qt4/qwt_array.h:25:23: error: qmemarray.h: No such file or directory
In file included from /usr/include/qt4/qwt_marker.h:20,
from /usr/include/qt4/qwt_plot.h:23,
from build/ui_mainwindow.h:29,
from src/mainwindowimpl.h:5,
from src/mainwindowimpl.cpp:1:
/usr/include/qt4/qwt_text.h:20:29: error: qsimplerichtext.h: No such file or directory
In file included from /usr/include/qt4/qwt_plot.h:24,
from build/ui_mainwindow.h:29,
from src/mainwindowimpl.h:5,
from src/mainwindowimpl.cpp:1:
/usr/include/qt4/qwt_legend.h:16:25: error: qscrollview.h: No such file or directory
In file included from /usr/include/qt4/qwt_legend.h:25,
from /usr/include/qt4/qwt_plot.h:24,
from build/ui_mainwindow.h:29,
from src/mainwindowimpl.h:5,
from src/mainwindowimpl.cpp:1:
/usr/include/qt4/qwt_plot_dict.h:15:22: error: qintdict.h: No such file or directory
In file included from /usr/include/qt4/qwt_plot.h:25,
from build/ui_mainwindow.h:29,
from src/mainwindowimpl.h:5,
from src/mainwindowimpl.cpp:1:
/usr/include/qt4/qwt_plot_printfilter.h:16:24: error: qvaluelist.h: No such file or directory
In file included from /usr/include/qt4/qwt_dimap.h:14,
from /usr/include/qt4/qwt_grid.h:15,
from /usr/include/qt4/qwt_plot.h:18,
from build/ui_mainwindow.h:29,
from src/mainwindowimpl.h:5,
from src/mainwindowimpl.cpp:1:
/usr/include/qt4/qwt_math.h: In function ‘void qwtShiftArray(T*, int, int)’:
/usr/include/qt4/qwt_math.h:162: error: there are no arguments to ‘QABS’ that depend on a template parameter, so a declaration of ‘QABS’ must be available
/usr/include/qt4/qwt_math.h:162: note: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated)
In file included from /usr/include/qt4/qwt_grid.h:16,
from /usr/include/qt4/qwt_plot.h:18,
from build/ui_mainwindow.h:29,
from src/mainwindowimpl.h:5,
from src/mainwindowimpl.cpp:1:
/usr/include/qt4/qwt_scldiv.h: At global scope:
/usr/include/qt4/qwt_scldiv.h:128: error: ISO C++ forbids declaration of ‘QMemArray’ with no type
/usr/include/qt4/qwt_scldiv.h:128: error: expected ‘;’ before ‘’
/usr/include/qt4/qwt_plot_dict.h:22: error: declaration of ‘class QwtSeqDict’
/usr/include/qt4/qwt_plot_dict.h: In constructor ‘QwtCurveDict::QwtCurveDict()’:
/usr/include/qt4/qwt_plot_dict.h:66: error: ‘setAutoDelete’ was not declared in this scope
/usr/include/qt4/qwt_plot_dict.h: At global scope:
/usr/include/qt4/qwt_plot_dict.h:70: error: invalid use of incomplete type ‘class QwtSeqDict’
/usr/include/qt4/qwt_plot_dict.h:22: error: declaration of ‘class QwtSeqDict’
/usr/include/qt4/qwt_plot_dict.h: In constructor ‘QwtMarkerDict::QwtMarkerDict()’:
/usr/include/qt4/qwt_plot_dict.h:72: error: ‘setAutoDelete’ was not declared in this scope
/usr/include/qt4/qwt_plot_dict.h: At global scope:
/usr/include/qt4/qwt_plot_dict.h:75: error: expected initializer before ‘’
/usr/include/qt4/qwt_plot_dict.h:22: error: declaration of ‘class QwtSeqDict’
/usr/include/qt4/qwt_legend.h:31: error: expected initializer before ‘

Uhh well mysteriously the issue just up and disappeared without me doing a single thing.

Related

PRE_TARGETDEPS fails when using parallel builds

I'm using a custom ressource management (in replacement to qrc) and I'm trying to integrate it to QtCreaor.
I have a Python script that generates a source file to be compiled. I use QMAKE_EXTRA_TARGETS/PRE_TARGETDEPS to tell QMake that this script must be executed before files are compiled. So I do, in my pro file:
CONFIG += ordered
generated_file.target = my_custom_target
generated_file.commands = echo "Generating..." && d:/dev/vobs_ext_2015/tools_ext/python/Python34_light/python.exe $$PWD/pyc_res_generator.py -o $$PWD/generated/generated.cpp && echo "Generated!"
generated_file.depends = FORCE
QMAKE_EXTRA_TARGETS += generated_file
PRE_TARGETDEPS += my_custom_target
SOURCES += generated/generated.cpp
#DEPENDPATH = ./generated
With pyc_res_generator.py simply being:
#! /usr/bin/env python
# -*- coding: utf8 *-*
import argparse
parser = argparse.ArgumentParser(description="", formatter_class=argparse.RawTextHelpFormatter)
parser.add_argument("-o", type=str, help="Output file name")
args = parser.parse_args()
with open(args.o, 'w') as output_file:
output_file.write( "// This is valid C++!" )
To test this, I write some invalid C++ in generated.cpp (like fjkfkfk). When I compile (target is Android), I see in the log:
echo Generating... && python.exe pyc_res_generator.py -o generated/generated.cpp && echo Generated!
Generating...
B:\Android\android-ndk-r11b/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-g++ -c -Wno-psabi -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums -DANDROID -Wa,--noexecstack -fno-builtin-memmove -std=c++11 -g -g -marm -O0 -fno-omit-frame-pointer -Wall -Wno-psabi -W -D_REENTRANT -fPIC -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I..\TestQt -I. -IB:\QtCreator5_6_1\5.6\android_armv7\include -IB:\QtCreator5_6_1\5.6\android_armv7\include\QtWidgets -IB:\QtCreator5_6_1\5.6\android_armv7\include\QtGui -IB:\QtCreator5_6_1\5.6\android_armv7\include\QtCore -I. -isystem B:\Android\android-ndk-r11b\sources\cxx-stl\gnu-libstdc++\4.9\include -isystem B:\Android\android-ndk-r11b\sources\cxx-stl\gnu-libstdc++\4.9\libs\armeabi-v7a\include -isystem B:\Android\android-ndk-r11b\platforms\android-9\arch-arm\usr\include -IB:\QtCreator5_6_1\5.6\android_armv7\mkspecs\android-g++ -o main.obj ..\TestQt\main.cpp
B:\Android\android-ndk-r11b/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-g++ -c -Wno-psabi -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums -DANDROID -Wa,--noexecstack -fno-builtin-memmove -std=c++11 -g -g -marm -O0 -fno-omit-frame-pointer -Wall -Wno-psabi -W -D_REENTRANT -fPIC -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I..\TestQt -I. -IB:\QtCreator5_6_1\5.6\android_armv7\include -IB:\QtCreator5_6_1\5.6\android_armv7\include\QtWidgets -IB:\QtCreator5_6_1\5.6\android_armv7\include\QtGui -IB:\QtCreator5_6_1\5.6\android_armv7\include\QtCore -I. -isystem B:\Android\android-ndk-r11b\sources\cxx-stl\gnu-libstdc++\4.9\include -isystem B:\Android\android-ndk-r11b\sources\cxx-stl\gnu-libstdc++\4.9\libs\armeabi-v7a\include -isystem B:\Android\android-ndk-r11b\platforms\android-9\arch-arm\usr\include -IB:\QtCreator5_6_1\5.6\android_armv7\mkspecs\android-g++ -o dialog.obj ..\TestQt\dialog.cpp
B:\Android\android-ndk-r11b/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-g++ -c -Wno-psabi -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums -DANDROID -Wa,--noexecstack -fno-builtin-memmove -std=c++11 -g -g -marm -O0 -fno-omit-frame-pointer -Wall -Wno-psabi -W -D_REENTRANT -fPIC -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I..\TestQt -I. -IB:\QtCreator5_6_1\5.6\android_armv7\include -IB:\QtCreator5_6_1\5.6\android_armv7\include\QtWidgets -IB:\QtCreator5_6_1\5.6\android_armv7\include\QtGui -IB:\QtCreator5_6_1\5.6\android_armv7\include\QtCore -I. -isystem B:\Android\android-ndk-r11b\sources\cxx-stl\gnu-libstdc++\4.9\include -isystem B:\Android\android-ndk-r11b\sources\cxx-stl\gnu-libstdc++\4.9\libs\armeabi-v7a\include -isystem B:\Android\android-ndk-r11b\platforms\android-9\arch-arm\usr\include -IB:\QtCreator5_6_1\5.6\android_armv7\mkspecs\android-g++ -o generated.obj ..\TestQt\generated\generated.cpp
B:\QtCreator5_6_1\5.6\android_armv7\bin\moc.exe -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -IB:/QtCreator5_6_1/5.6/android_armv7/mkspecs/android-g++ -IC:/Users/jp225611/Documents/TestQt -IB:/QtCreator5_6_1/5.6/android_armv7/include -IB:/QtCreator5_6_1/5.6/android_armv7/include/QtWidgets -IB:/QtCreator5_6_1/5.6/android_armv7/include/QtGui -IB:/QtCreator5_6_1/5.6/android_armv7/include/QtCore -I. -IB:\Android\android-ndk-r11b/sources/cxx-stl/gnu-libstdc++/4.9/include -IB:\Android\android-ndk-r11b/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/include -IB:\Android\android-ndk-r11b/platforms/android-9/arch-arm//usr/include ..\TestQt\dialog.h -o moc_dialog.cpp
..\TestQt\generated\generated.cpp:1:1: error: 'fjkfkfk' does not name a type
// This is valid C++!
^
makefile:670: recipe for target 'generated.obj' failed
mingw32-make: *** [generated.obj] Error 1
mingw32-make: *** Waiting for unfinished jobs....
Generated!
13:59:08: Le processus "B:\QtCreator5_6_1\Tools\mingw492_32\bin\mingw32-make.exe" s'est terminé avec le code 2.
Erreur lors de la compilation/déploiement du projet TestQt (kit : android_armeabi-v7a)
When executing step "Make"
13:59:08: Temps écoulé : 00:03.
And I see that generated\generated.cpp was correctly generated by pyc_res_generator.py (it now contains // This is valid C++!)...but apparently too lately as the compiler saw fjkfkfk...
As you can see, the output reports:
Generating...
B:\Android\android-ndk-r11b/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-g++ .... ..\TestQt\generated\generated.cpp
Generated...
While one would expect:
Generating...
Generated...
B:\Android\android-ndk-r11b/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-g++ .... ..\TestQt\generated\generated.cpp
This only occurs when parallel builds are enabled (I set MAKEFLAGS environment variable to '-j8`)
It looks like my custom command generated_file is started before generated\generated.cpp is compiled, but the system does not wait for it to end before actually compiling generated\generated.cpp.
Am I doing something wrong?
PRE_TARGETDEPS (custom targets) is not the good approach here as generated_file.target must match exactly the Makefile target name which may be vary on different options:
shadow build enabled or not
host platform (using slashs or backslash as a folder separator)
probably targetted compiler/platform
However, custom compiler apparently works much better. That's how moccing files is done. A custom compiler can generate a new file to be compiled (and then the system waits for the file to be generated before compiling it, even when performing parallel builds).
# Set fuiles to be generated in a variable
TO_GENERATE = $$PWD/generated/generated.cpp
# Specify custom command output file:
custom_generator.output = $$PWD/generated/generated.cpp
# Specify custom command:
custom_generator.commands = 'echo "Generating..." && python $$PWD/pyc_res_generator.py -o $$PWD/generated/generated.cpp && echo "Generated..."'
# dependency:
custom_generator.depends = FORCE
# link to input file variable
custom_generator.input = TO_GENERATE
# link to variable to store generated file to
custom_generator.variable_out = SOURCES
# add to qmake:
QMAKE_EXTRA_COMPILERS += custom_generator
Then, you don't even need to specify SOURCES += $$PWD/generated/generated.cpp. And also, $$PWD/generated/generated.cpp gets deleted upon clean!
This works perfectly as expected!
You need to set the name of the target to the name of the file that it generates. Here's a full project file that works for me (qmake 3.1, Qt 5.10.1):
# Filename relative to the *build* directory.
generated_file.target = generated/generated.cpp
generated_file.commands = 'echo "Generating..." && mkdir -p generated && echo "int main() {}" > generated/generated.cpp'
generated_file.depends = FORCE
QMAKE_EXTRA_TARGETS += generated_file
# Filename relative to the *source* directory.
SOURCES += $$OUT_PWD/generated/generated.cpp
The reason is that generated_file.target becomes the name of the target in the Makefile, so when generated.cpp is needed, your custom rule will be executed to create the file.
You can also remove it from PRE_TARGETDEPS, because you're already adding the generated file to SOURCES instead, which creates the proper dependency.
Note that this approach generates the file in the build directory, not the source directory. This is why you need to specify $$OUT_PWD when adding it to SOURCES: by default, qmake seems to assume that SOURCES are relative to the source directory.
If you want to generate it in the source directory instead, you might think that you just prefix $$PWD everywhere, but then qmake sometimes uses absolute paths and sometimes relative, and everything fails. You can probably work around that with $$absolute_path($$PWD) but I haven't tried.
Relevant sections from the generated Makefile (comments are mine):
# How to create generated/generated.cpp.
# Depending on FORCE to make it always stale (fails if you create a file named FORCE :)).
generated/generated.cpp: FORCE
echo "Generating..." && mkdir -p generated && echo "int main() {}" > generated/generated.cpp
# generated.o depends on generated/generated.cpp.
# Note that it's not in the same directory; we don't care.
generated.o: generated/generated.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o generated.o generated/generated.cpp
# The final executable depends on the compiled generated.o.
OBJECTS = generated.o
$(TARGET): $(OBJECTS)
$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
The qmake documentation is pretty vague about this, only stating that target should be "The name of the custom build target.". However, the example shows that they're setting it to the name of the output file. (As a bonus, it also shows how to not repeat that name in the commands.)
An alternative relies on the TEMPLATE=subdirs, to honour libname.depends in a parallel build environment. You would need two .pro files in each application folder. And one in the shared library folder. Any other folders in your development area that use TEMPLATE=subdirs need to be made compatible.
eg TestApp using LibLarry.
Folder TestApp has
bld.pro and TestApp.pro.
TestApp.pro:
#This is a TEMPLATE=subdirs, which gmake will interpret;
# making sure the build dependencies are respected
TEMPLATE = subdirs
SUBDIRS += bld mylib
bld.file = bld.pro
bld.depends = mylib # force library to be built first.
mylib.file = $${PATH_TO_LIB_LARRY}/liblarry.pro
bld.pro:
TARGET=TestApp
SOURCES+=TestApp.cpp
PRE_TARGETDEPS+=$${PATH_TO_LIB_LARRY}/liblarry.a
#boilerplate...
QT -= gui
CONFIG = ...
include ($${PATH_TO_LIB_LARRY}/liblarry.pri) # contains include file info
CONFIG += link_prl # allow lib larry to specify its position in the linker input command.
Folder LibLarry has
LibLarry.pro
containing
LibLarry.pro:
TARGET=larry
TEMPLATE=lib
CONFIG+=staticlib
CONFIG+=create_prl # export information, so apps can link correctly
SOURCES+=my_shared_function.cpp
include (liblarry.pri)
liblarry.pri:
HEADERS += $$PWD/my_shared_function.h
INCLUDEPATH += $$PWD

How to compile bmdview2 (.bmd GCN Wii 3D models) for mac os x?

This is a software tool that reads .bmd 3D model files used in some game cube or wii games (like Mario Sunshine or Twilight Princess), and then export them to .3DS 3D studio.
I am having trouble trying to compile this one for mac os x. Repositories:
https://github.com/magcius/bmdview
or
https://github.com/dashxdr/bmdview2
In Xcode I got an error with the Matrix44 class.
In the terminal the project compiles but can't be linked.
Perhaps the makefile needs some tweaking... but I am really lost. I'll appreciate any help.
Output error:
g++ -o bmdview2_glut simple_gl_glut.o main.o drawBmd.o camera.o drawtext.o parameters.o transformtools.o simple_gl_common.o oglblock.o ui.o addons/exportTexture.o addons/export3ds.o addons/exportb3d.o addons/bck.o addons/btp.o bmdread.o openfile.o common.o drw1.o evp1.o inf1.o jnt1.o mat3.o mdl3.o shp1.o tex1.o vtx1.o -O2 -lGL -lGLU -lglut -lGLEW -l3ds
ld: library not found for -lGL
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [bmdview2_glut] Error 1
Command /usr/bin/make failed with exit code 2
MAKEFILE:
GLEW_DIR = glew
GLEW_INC_DIR = $(GLEW_DIR)/include
GLEW_LIB_DIR = $(GLEW_DIR)/lib
LIB3DS_INC_DIR = ../lib3ds-1.2.0
LIB3DS_LIB_DIR = $(LIB3DS_INC_DIR)/lib3ds
CXXFLAGS = -I$(GLEW_INC_DIR) -O2 -ggdb -Wall \
-I$(LIB3DS_INC_DIR) \
#-fpascal-strings # needed for 3d mouse api
BASE_SRCS = bmdread.cpp openfile.cpp common.cpp drw1.cpp \
evp1.cpp inf1.cpp jnt1.cpp mat3.cpp mdl3.cpp shp1.cpp tex1.cpp \
vtx1.cpp
BMDINFO_SRCS = bmdinfo.cpp $(BASE_SRCS)
BMDINFO_OBJS = $(BMDINFO_SRCS:.cpp=.o)
BMDVIEW2_SRCS = simple_gl_glut.cpp main.cpp drawBmd.cpp \
camera.cpp drawtext.cpp parameters.cpp transformtools.cpp\
simple_gl_common.cpp oglblock.cpp ui.cpp \
addons/exportTexture.cpp addons/export3ds.cpp addons/exportb3d.cpp \
addons/bck.cpp addons/btp.cpp $(BASE_SRCS)
BMDVIEW2_OBJS = $(BMDVIEW2_SRCS:.cpp=.o)
# I don't know how dylibs work with bundles, so I've statically linked GLEW
# for now.
# this can be used to emped an Info.plist without building a bundled app,
# but it seems not to suffice for the 3d mouse api
#-sectcreate __TEXT __info_plist Info.plist \
bmdview2_glut: $(BMDVIEW2_OBJS)
g++ -o $# $^ -O2 -lGL -lGLU -lglut -lGLEW -l3ds
Bmdview2.app: bmdview2_glut Info.plist icon.icns
rm -rf Bmdview2.app
mkdir -p Bmdview2.app/Contents/MacOS
mkdir Bmdview2.app/Contents/Resources
cp Info.plist Bmdview2.app/Contents
cp icon.icns Bmdview2.app/Contents/Resources
cp bmdview2_glut Bmdview2.app/Contents/MacOS
mac.o: mac.mm
g++ -c -O2 mac.mm
mat3.o: common/gccommon.h mat3.h
#TODO: OpenGL/GLEW shouldn't be required for a mere console program...
bmdinfo: $(BMDINFO_OBJS)
g++ -o $# $^ \
-L$(LIB3DS_LIB_DIR) -l3ds \
-L$(GLEW_LIB_DIR) -lGLEW \
-framework OpenGL
clean:
rm -f `echo $(BMDVIEW2_OBJS) $(BMDINFO_OBJS) | sort | uniq` bmdview2_glut
run: bmdinfo
./bmdinfo testdata/model.bmd
runglut:
export DYLD_LIBRARY_PATH=$(GLEW_LIB_DIR);./bmdview2_glut testdata/model.bmd
zip:
zip bmdview2_src_`date '+%Y%m%d'`.zip *.h *.cpp testdata/tests/ common/gccommon.h addons/*.cpp addons/*.h tev.html tev.markdown style.css resource.rc icon.ico Makefile *.inc gl_template.ds*
test: bmdview2_glut
./bmdview2_glut WoodCircleCutPlanet.bdl
test2: bmdview2_glut
./bmdview2_glut NigeroPlanet.bdl

dynamic qt paths for libs/includes folders in compiled version

I compiled qt 4.8.5 for CentOS 6.4. Everything works perfectly. When I am compiling other libraries using this compiled qt version is compiling as long as I keep the installer folder in the same location. If I move the installer folder in another location, then I get the following errors:
cd common/ && make -f Makefile
make[1]: Entering directory `/path/MashLab/meshlab/src/common'
g++ -c -m64 -pipe -O2 -Wall -W -D_REENTRANT -fPIC -DGLEW_STATIC -DQT_NO_DEBUG -DQT_SCRIPT_LIB -DQT_XMLPATTERNS_LIB -DQT_XML_LIB -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../../../../qt/install_dir/mkspecs/linux-g++-64 -I. -I/path/qt/install/include/QtCore -I/path/qt/install/include/QtGui -I/path/qt/install/include/QtOpenGL -I/path/qt/install/include/QtXml -I/path/qt/install/include/QtXmlPatterns -I/path/qt/install/include/QtScript -I/path/qt/install/include -I../.. -I../../../vcglib -I../external/glew-1.7.0/include -I. -I../external/jhead-2.95 -I/usr/X11R6/inc
lude -I. -o filterparameter.o filterparameter.cpp
filterparameter.cpp:24:18: error: QtCore: No such file or directory
filterparameter.cpp:25:16: error: QMap: No such file or directory
filterparameter.cpp:26:17: error: QPair: No such file or directory
filterparameter.cpp:27:19: error: QAction: No such file or directory
It's still searching for the libs and includes in the path where it was installed even if I export the environment variables to the new location:
$: export QMAKESPEC=/path/qt/install_dir/mkspecs/linux-g++-64
$: export QTLIB=/path/qt/install_dir/lib
$: export QTINC=/path/qt/install_dir/include
$: export QTDIR=/path/qt/install_dir
installed location: /path/qt/install
new location: /path/qt/install_dir
Question: Is there a way (some arguments) which you can compile qt and use dynamic paths of libs/includes?
With Qt >= 5.3 create a qt.conf next to where qmake is (e.g. /path/qt/install_dir/bin/qt.conf)
[Paths]
Prefix = ..
If this doesn't work, check which at path qmake is looking for qt.conf with
strace qmake -query 2>&1 | grep qt.conf

Can't compile C++ plug-ins with OSX Lion?

I have been writing a plug-in for Maya with C++. The Makefile I use works fine on Snow Leopard, but does not in Lion. I am using the latest version of Maya 2012 in both cases. Here's the top of the error stack:
/Applications/Autodesk/maya2012/Maya.app/Contents/../../devkit/include/maya/OpenMayaMac.h:89:35: error:
AvailabilityMacros.h: No such file or directory
/Applications/Autodesk/maya2012/Maya.app/Contents/../../devkit/include/maya/OpenMayaMac.h:107:24: error:
sys/param.h: No such file or directory
/Applications/Autodesk/maya2012/Maya.app/Contents/../../devkit/include/maya/OpenMayaMac.h:114:40: error:
CoreServices/CoreServices.h: No such file or directory
This makes me think that these files are in a different location in Lion, but I do see them all in my /usr/include/ directory, just like Snow Leopard. Anyone have similar issues, ideas, suggestions?
The make file I use is below:
# NOTE: MAYA_LOCATION on Mac OS X points to Maya.app/Contents
MAYA_LOCATION = /Applications/Autodesk/maya2012/Maya.app/Contents
# Change location if a non standard install.
DEVKIT_LOCATION = $(MAYA_LOCATION)/../../devkit
C++ = g++
PREFERRED_ARCHITECTURE =
# Determine the architectures to build.
MAYABIN = ${MAYA_LOCATION}/bin/maya
MAYA_ARCHES = $(shell lipo -info $(MAYABIN) | sed 's/^.*://')
ifneq ($(PREFERRED_ARCHITECTURE),)
MAYA_ARCHES = $(filter $(PREFERRED_ARCHITECTURE),$(MAYA_ARCHES))
ifeq ($(MAYA_ARCHES),)
$(error $(MAYABIN) does not support the '$(PREFERRED_ARCHITECTURE)' architecture.)
endif
endif
ARCH_FLAGS = $(patsubst %,-arch %,$(MAYA_ARCHES))
CFLAGS = -DAW_NEW_IOSTREAMS -DCC_GNU_ -DOSMac_ -DOSMacOSX_ \
-DOSMac_MachO_ -DREQUIRE_IOSTREAM -fno-gnu-keywords -fpascal-strings -O3 \
$(ARCH_FLAGS) -D_LANGUAGE_C_PLUS_PLUS -isysroot /Developer/SDKs/MacOSX10.6.sdk \
-include $(MAYA_LOCATION)/../../devkit/include/maya/OpenMayaMac.h \
-shared
C++FLAGS = $(CFLAGS)
INCLUDES = -I. -I$(MAYA_LOCATION)/../../devkit/include
LDFLAGS = -framework Carbon -framework OpenGL -framework GLUT -lOpenMayaUI
LD = $(MAYA_LOCATION)/../../devkit/bin/mayald MAYA_ARCHES="$(MAYA_ARCHES)" MAYA_LOCATION="$(MAYA_LOCATION)"
all: VmExample.bundle
VmExampleNode.o: VmExampleNode.cpp
$(C++) -c VmExampleNode.cpp $(C++FLAGS) $(INCLUDES)
vmPluginMain.o: vmPluginMain.cpp
$(C++) -c vmPluginMain.cpp $(C++FLAGS) $(INCLUDES)
VmExample.bundle: VmExampleNode.o vmPluginMain.o
$(LD) -dynamic -bundle -o VmExample.bundle VmExampleNode.o vmPluginMain.o ../core/libVexample.o $(LDFLAGS)
same problem here; Managed to make it work by adding
-mmacosx-version-min=10.6
-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk
to C++ Flags

gcc -I and -L options don't seem to work

I am trying to compile a project in my system using qmake. Some dependencies of the project are not installed but reside in my home directory, more or less like this: libs files: /home/myusername/local/lib and my includes directory /home/myusername/local/include. Inside the include directory I have a folder, qjson with the needed headers from the library. In the lib folder I have the files libqjson.so libqjson.so.0 libqjson.so.0.7.1.
My qmake project file looks something like this:
linux-g++ {
INCLUDEPATH += /home/myusername/local/include/
LIBS += -L/home/myusername/local/lib/ -lqjson
}
and the generated makefile will produce commands like this one:
g++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB \
-DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I../qbuzz \
-I/usr/include/qt4/QtCore -I/usr/include/qt4/QtNetwork -I/usr/include/qt4/QtGui \
-I/usr/include/qt4 -I/home/myusername/local/include/ -I. -I. -I../myproject -I. \
-o qbuzz-result.o ../myproject/myfile.cc
It is clear that my include directory is in the -I option of gcc. myfile.cc contains an include like this one:
#include <qjson/parser.h>
However, after running make, I get the error:
../myproject/myfile.cc:2:26: fatal error: qjson/parser.h: No such file or directory
compilation terminated.
Now, if I modify the environment variable CPLUS_INCLUDE_PATH to add my local include file, I have no problems there, but in the linker stage I got the error:
/usr/bin/ld: cannot find -lqjson
collect2: ld returned 1 exit status
Even though the linker command was:
g++ -omyprogram main.o mainwindow.o myfile.o moc_mainwindow.o -L/usr/lib \
-L/home/myusername/local/lib/ -lqjson -lQtGui -lQtNetwork -lQtCore -lpthread
I also can get around modifying the environment variable LIBRARY_PATH. However I am looking for a solution that relies on modifying as few environment variables as possible, and after all, why are the options -L and -I there?
I works on Windows without problems using MinGW g++.
I notice that the QT's automatic include paths have no trailing slashes, and yours do. Have you tried writing the paths without trailing slashes?
linux-g++ {
INCLUDEPATH += /home/myusername/local/include
LIBS += -L/home/myusername/local/lib -lqjson
}
G++ and friends (i.e. as, ld, etc) will not directly tell you exactly where it looks for header and library files. One way to debug this is to run strace -o output.txt -eopen -s 1024 -f qmake. This will run qmake logging all open system calls of qmake and all of the child processes it forks. You will then be able to see in what directories and in what order it searches for header files (and libraries). Example output extract for stdio.h:
26069 open("/usr/lib/gcc/x86_64-redhat-linux/4.6.0/include/stdio.h", O_RDONLY|O_NOCTTY) = -1 ENOENT (No such file or directory)
26069 open("/usr/local/include/stdio.h", O_RDONLY|O_NOCTTY) = -1 ENOENT (No such file or directory)
26069 open("/usr/include/stdio.h", O_RDONLY|O_NOCTTY) = 4