building a gl3 app under cygwin - cygwin

i've got a small opengl 3.2 app that i've been developing on linux using the standard gnu tools (gmake/gcc). the code seems pretty portable--i had no problems running it on osx until i started using gl3 features that the mac mini gl drivers don't seem to support. i've got a bootcamp partition with windows xp on the same mini, and i'd like to run my app there if possible.
the windows drivers definitely support gl 3.2, but i'm having trouble linking. this seems like a really common issue, but i haven't found any answers online that address using opengl > 1.2 under cygwin. i'm using glew-1.5.5 and linking like so:
g++ -o glToy *.o -L/cygdrive/c/Program\ Files/glew-1.5.5/lib -lglew32 -lglut32 -lglu32 -lopengl32
but i get a whole lot of this sort of output:
Program.o:/home/Jacob/glToy/Program.cpp:134: undefined reference to `__imp____glewUseProgram'
Program.o:/home/Jacob/glToy/Program.cpp:235: undefined reference to `__imp____glewActiveTexture'
Program.o:/home/Jacob/glToy/Program.cpp:73: undefined reference to `__imp____glewGetShaderiv'
...
any ideas what i'm doing wrong? or perhaps this isn't a workable setup? other ideas for getting this going on the mac mini (2009 version)? thanks!

you can also skip linking, just get glew.c and put it in /include (not /include/GL like glew.h) and then change your #include to <glew.c>

you aren't linking glew properly or glew is broken... nothing to do with gl itself
the easy fix is just to use the extension api and forget about glew.

Related

How to check the compiler version in Qt .pro file?

I want to build a Qt project using either GCC or an ARM compiler. In either environment I have to link different libraries.
How I can check if the current compiler is Linux's g++ and CROSS_COMPILE is 'arm-cortexa9neont-linux-gnueabi-'?
You can use the Platform Scope built in to QMake to set up the build differently depending on platform.
It's based on the mkspec's shipped with Qt and can be found in
[Where Qt's installed]/mkspecs
So in your case I guess it'll look something like this:
linux-arm-gnueabi {
//ARM stuff here
}
Please note that I have not tested this. I've only read what's in the documentation I have linked to.
If you want to know only type of processor, you can use Q_PROCESSOR_ARM macro.

Preloading dynamically loaded libraries in linux

I have a 7 year old game that a friend built & I have very little of the source code left.
It works perfect on CentOS 4.8 and below, so I'm thinkin' it's a TLS error. I transfered a new folder with all the CentOS 4.8 libraries the program called to the new one... I'm trying to load the old libraries it called for in ldd specifically to that program,. This is what I'm trying:
LD_PRELOAD="/glibs/ld-linux.so.2 /glibs/libc.so.6 /glibs/libgcc_s.so.1 /glibs/libm.so.6 /glibs/libpthread.so.0 /glibs/libstdc++.so.5 /glibs/libz.so.1 /glibs/libxml2.so.2" /home/g/gameserver
I keep getting a Segmentation Fault error, does anyone know why? Maybe I don't fully understand what LD_PRELOAD does or something. How would I be able to load old libraries without messing up the originals? Thanks in advance!
LD_PRELOAD is more used to override a functionality in a library before the normal ones get used (e.g. custom malloc, socksify all sockets etc). What you probably need is to put all your old libraries into their own directory and then set LD_LIBRARY_PATH so that it attempts to find the library first in this directory.

Xcode 4.6 Undefined symbols for architecture armv7 associate with static library

I currently run into a problem after I updated my xcode to 4.6.
At the beginning, I got lots of linking errors. With the help from other posts, I am be able to solve them. However, new problems always come whenever I solved the previous one.
Right now, I am stuck at "Undefined symbols for architecture armv7" when I try to build the game on devices with release mode (release and debug modes work for simulator, and debug mode works for devices). I have already researched this problem online, but none of the solutions could solve my situation. That's why I want to start a new post.
Let me explain the situation in details:
All the errors are happened at calling methods in libraries.
my libraries works fine with architecture armv7 before (xcode 4.5)
The current value for Architectures in project file is "Standard (armv7, armv7s)
The current value for Current Architecture is "armv7 armv7s armv6"
This is a sample error:
Even though I only showed errors related to libReceiptVerification.multi.a, errors actually happen at other libraries.
//************* From this line **************
Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_NSMutableOrderedSet", referenced from:
objc-class-ref in libarclite_iphoneos.a(arclite.o)
"_CFStringCreateWithBytes", referenced from:
-[JKSerializer serializeObject:options:encodeOption:block:delegate:selector:error:] in libReceiptVerification.multi.a(JSONKit.o)
_jk_cachedObjects in libReceiptVerification.multi.a(JSONKit.o)
"_CFStringCreateWithBytesNoCopy", referenced from:
-[JKSerializer serializeObject:options:encodeOption:block:delegate:selector:error:] in libReceiptVerification.multi.a(JSONKit.o)
"_CFDataSetLength", referenced from:
__NSStringObjectFromJSONString in libReceiptVerification.multi.a(JSONKit.o)
// *************** Ending Here ***********
So, does anyone has any clue on this problem?
Thanks for your help in advance.
I am having the same problem Solved by setting
Implicitly link Objective-C Runtime Support to NO
You can find it under Project->Build Settings->Apple LLVM Compiler 4.2-Language.
Or search for Implicitly link Objective-C Runtime Support in project->Build Settings
Check out the library targets for libarclite, JSONKit and everything else and make sure they also have the identical architecture values set for their Release builds.
Also that "Build Active Architecture Only" is checked to NO for Release targets.

Does gcc support unique_locks?

I wanted to use threads in my code and thought that the upcoming C++0x extensions would be handy as they will become a standard eventually. This seemed to be future-proof without the need to use additional libraries like the boost::thread.
Unfortunately I couldn't find useful information about which features regarding threads are currently supported by gcc. I'm using unique_locks which seem not to work, yet. This is the output of the linker:
.build_debug/src/core/simulator.o: In function `Simulator::start(int, int, int, int)':
simulator.cpp:(.text+0x1fc): undefined reference to `_ZSt4lockISt11unique_lockISt5mutexES2_IEEvRT_RT0_DpRT1_'
.build_debug/src/core/simulator.o: In function `Simulator::resume()':
simulator.cpp:(.text+0x351): undefined reference to `_ZSt4lockISt11unique_lockISt5mutexES2_IEEvRT_RT0_DpRT1_'
.build_debug/src/core/simulator.o: In function `Simulator::pause()':
simulator.cpp:(.text+0x417): undefined reference to `_ZSt4lockISt11unique_lockISt5mutexES2_IEEvRT_RT0_DpRT1_'
.build_debug/src/core/simulator.o: In function `Simulator::stop()':
simulator.cpp:(.text+0x4cd): undefined reference to `_ZSt4lockISt11unique_lockISt5mutexES2_IEEvRT_RT0_DpRT1_'
Does anybody understand these messages? I guess they are referring to the usage of unique_locks. But why do these errors occur?
My source code resembles this one:
std::unique_lock<std::mutex> lkIntra(intraMtx, std::defer_lock);
std::unique_lock<std::mutex> lkInter(interMtx, std::defer_lock);
std::lock(lkIntra, lkInter);
EDIT: I tried to compile this with gcc 4.3.X and 4.4.5. The linker was g++ 4.3, 4.4 and 4.5.
EDIT2: I just tried to use the boost equivalents to the std-threads. After adding the compiler flag "-lboost_thread" the compilation worked. Without which the linking process resulted in similar error messages. Now I'm wondering whether I need to do something alike when using standard threads (I already tried "-lpthread").
The current development version of G++ supports it: http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a00729.html
The 4.5.1 version doesn't seem to (at least, for me on Mac OS Intel).

VC++ 2010 wants to link boost libararies i didn't even specify

I'm trying to build my application with MSVC 2010 instead of GCC. With GCC everything works fine. My app uses boost_system and boost_thread libraries.
I built boost with VC2010 in "system" layout, that means the libraries are named just libboost_system.lib (and not libboost_system_compiler_threading_version_wtf_snafu.lib)
The libs reside in C:\Boost\lib,
the Makefile specifies
LFLAGS = /NOLOGO /INCREMENTAL:NO /SUBSYSTEM:CONSOLE
LIBS = /LIBPATH:C:/Boost/lib libboost_system.lib libboost_thread.lib Ws2_32.lib
when invoking nmake it compiles, but when trying to link it quits with
LINK : fatal error LNK1104: cannot open file 'libboost_date_time-vc100-mt-1_43.lib
I mean seriously, WTF? I told it to link libboost_systen.lib and libboost_thread.lib how come it tries to link libboost_data_time and why does it assume I built the libs in "tagged" layout??
How can I stop MSVC trying to be smart and guess what I might have wanted to link?
Thanks,
Philipp
This is a feature of the Boost libs with compatible compilers for automatic linking.
(Those convoluted library names cover the myriad of threading and linking options that are available on the platform; there are good reasons to use that convention on Windows...)
More information here:
http://www.boost.org/doc/libs/1_33_1/more/getting_started.html#auto-link
I can't find a page for a more recent version, but I believe the BOOST_ALL_NO_LIB and related options are all still valid in 1.43.
Assuming you are auto-linking (i.e. you've defined BOOST_ALL_DYN_LINK or library specific equivalents).
For layout 'system' you have to define the preprocessor macro:
BOOST_AUTO_LINK_NOMANGLE
to link to the correct library names.
For layout 'tagged' you have to define the preprocessor macro:
BOOST_AUTO_LINK_TAGGED
to link to the correct library names.
I don't know if you could do this override for some libraries and keep the default for others. That would be a very cumbersome setup I'd imagine.

Resources