link to dylib in xcode 4 - xcode4

I'm trying to use libxar inside my xcode4 project and get the famous "undefined symbols for architecture" error, no matter what arch I choose for building, e.g.:
Undefined symbols for architecture x86_64:
"xar_open(char const*, int)", referenced from:
_main in main.o
I did what I always did to include the dylib:
set "library search path" to the path where libxar.dylib is placed
set "header path" to the path where xar.h is placed (which contains xar_open)
added libxar.dylib to build phases - link binary with libraries
Did I miss something?

Related

Compile error in Arduino IDE using Mozzi library

I'm using the Mozzi lib (http://sensorium.github.io/Mozzi/) as part of a tutorial (http://www.echanter.com/home/howto-build#TOC-Arduino-IDE). I included the Mozzi in Arduino Studio and followed minor configs in the tutorial. I've looked around the lines that are reported, but I'm stumped. Compile error is:
Mozzi/mozzi_fixmath.cpp.o: In function isqrt16(unsigned int)': /home/temp/sketchbook/libraries/Mozzi/mozzi_fixmath.cpp:156: multiple definition of isqrt32(unsigned long)'
echanter.cpp.o:/home/temp/sketchbook/libraries/Mozzi/Sample.h:61: first defined here
collect2: error: ld returned 1 exit status
In the root dir are two files with isqrt16(unsigned int) defined: mozzi_fixmath.cpp and mozzi_fixmath.h. I commented out the definition in the cpp file and it compiled.

How to build Quazip 0.5.1 on Windows 7?

I'm trying to build the quazip libary (version 0.5.1) on Windows 7 (32-bit) with Qt 5.0.1 32-Bit LGPL installed.
When i run in the Qt-Commandprompt:
qmake
mingw32-make
with the directory set to the folder in which I extracted Quazip (C:\Qt\quazip-0.5.1\quazip), I get the following error-log:
C:\Qt\quazip-0.5.1\quazip>mingw32-make
mingw32-make -f Makefile.Release
mingw32-make[1]: Entering directory 'C:/Qt/quazip-0.5.1/quazip'
g++ -Wl,-s -shared -mthreads -Wl,--out-implib,release\libquazip.a -o release\qua
zip.dll object_script.quazip.Release -LC:\Qt\Qt5\5.0.1\mingw47_32\lib -lQt5Core
./release\unzip.o:unzip.c:(.text+0x1008): undefined reference to `crc32'
./release\unzip.o:unzip.c:(.text+0x10aa): undefined reference to `inflate'
./release\unzip.o:unzip.c:(.text+0x10da): undefined reference to `crc32'
./release\unzip.o:unzip.c:(.text+0x1110): undefined reference to `crc32'
./release\unzip.o:unzip.c:(.text+0x1327): undefined reference to `inflateEnd'
./release\unzip.o:unzip.c:(.text+0x1727): undefined reference to `get_crc_table'
./release\unzip.o:unzip.c:(.text+0x186f): undefined reference to `inflateInit2_'
./release\zip.o:zip.c:(.text+0xac7): undefined reference to `crc32'
./release\zip.o:zip.c:(.text+0xb7c): undefined reference to `deflate'
./release\zip.o:zip.c:(.text+0xcdf): undefined reference to `deflate'
./release\zip.o:zip.c:(.text+0xef5): undefined reference to `deflateEnd'
./release\zip.o:zip.c:(.text+0x13a8): undefined reference to `get_crc_table'
./release\zip.o:zip.c:(.text+0x1af9): undefined reference to `deflateInit2_'
./release\quaadler32.o:quaadler32.cpp:(.text+0x2e): undefined reference to `adle
r32'
./release\quaadler32.o:quaadler32.cpp:(.text+0x61): undefined reference to `adle
r32'
./release\quaadler32.o:quaadler32.cpp:(.text+0xa1): undefined reference to `adle
r32'
./release\quaadler32.o:quaadler32.cpp:(.text+0xb1): undefined reference to `adle
r32'
c:/qt/qt5/tools/mingw/bin/../lib/gcc/i686-w64-mingw32/4.7.2/../../../../i686-w64
-mingw32/bin/ld.exe: ./release\quaadler32.o: bad reloc address 0x0 in section `.
rdata$_ZTI13QuaChecksum32[__ZTI13QuaChecksum32]'
collect2.exe: error: ld returned 1 exit status
Makefile.Release:106: recipe for target 'release\quazip.dll' failed
mingw32-make[1]: *** [release\quazip.dll] Error 1
mingw32-make[1]: Leaving directory 'C:/Qt/quazip-0.5.1/quazip'
makefile:34: recipe for target 'release' failed
mingw32-make: *** [release] Error 2
But in my Zlib-Folder (C:\Qt\Qt5\5.0.1\Src\qtbase\src\3rdparty\zlib) are all this listed files installed.
.
As I tried to solve the problem, I have added into the quazip.pro and into the quazip.pri:
INCLUDEPATH += $$[QT_INSTALL_PREFIX]/src/3rdparty/zlib
, how it is suggested here.
All other solutiuons I have found on Google so far aren't helping.
I hope someone of you can help me.
Greetings,
LVreg
The problem is that QuaZIP can not find the zlib library. You should include the path of the headers an also the libraries when you run qmake:
qmake "INCLUDEPATH+=C:/Qt/Qt5/5.0.1/Src/qtbase/src/3rdparty/zlib" "LIBS+=-LC:/Qt/Qt5/5.0.1/Src/qtbase/src/3rdparty/zlib -lz"
mingw32-make
There is a full explanation in my blog if you want to check it out: http://www.antonioborondo.com/2014/10/22/zipping-and-unzipping-files-with-qt/
Here is what worked for me (QuaZip 0.7 on Windows 7 compiled with MSVC13 32 bits):
In the command line type:
SET INCLUDE=<PathToZib\include>;%INCLUDE%
SET LIB=<PathToZib\lib>;%LIB%
qmake PREFIX=<FolderWhereInstallWillPutFiles> LIBS+=<PathToZib\lib>/zdll.lib
nmake
nmake install
everything between <> must be changed to your applicable path
NOTE:
in the LIBS+= part use / instead of \ as folders delimiter
try to make the lib of quazip on windows - look here:
https://www.maefloresta.com/wiki/doku.php?id=quazip_windows
but - try the following command - instead of "make" take "mingw32-make".

xcode static library link error while building for iPhone device

I am using xcode 4.6. The SDK is iOS 6.1. The error I got is "Undefined symbols for architecture armv7" while project linking my own created static library, called "libEncrypt.a".
I am sure I have created the libEncrpt.a using architecture armv7. Using "otool -a" to verify the static library, it displays below message. Don't understand why xcode sill complains the error like "Undefined symbols for architecture armv7"??
> otool -a libEncrypt.a
Archive : libEncrypt.a (architecture armv7)
0100644 505/20 108 1360127518 #1/20
0100644 505/20 3604 1360127513 #1/20
Archive : libEncrypt.a (architecture armv7s)
0100644 505/20 108 1360127518 #1/20
0100644 505/20 3604 1360127513 #1/20
Add the detail error message blow:
Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_libEncrypt", referenced from:
objc-class-ref in LoginViewController.o
objc-class-ref in SignupViewController.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Double check your "Build Active Architecture Only" settings in your app and static library projects.
I had this exact same issue because I had "Build Active Architecture Only" set to YES for my static library but not for my iOS app. When the iOS app tried do a Debug build it expected all architectures to exist but only armv7s was being built for the static library because I was deploying to my iPhone 5.

Qt: Building quazip/zlib Library error

I am statically building the quazip library as mentioned in the following post: linking QuaZip with Qt 4.8.0 into project
I get these error when I build the project:
/QtSDK/QtSources/4.8.0/src/3rdparty/zlib/zconf.h:373:6: error: "_LARGEFILE64_SOURCE" is not defined
In file included from ../../../quazip-0.4.4/quazip/zip.h:56,
from ../../../quazip-0.4.4/quazip/quazip.h:31,
from ../../../quazip-0.4.4/quazip/quazipfile.h:30,
from ../../../quazip-0.4.4/quazip/quazipfile.cpp:24:
/QtSDK/QtSources/4.8.0/src/3rdparty/zlib/zlib.h:1583:32: error: "_FILE_OFFSET_BITS" is not defined
cc1plus: warnings being treated as errors
Are these known errors in zlib library? I am using zlib library in Qt 4.8.0
That would be a bug in your compiler. I can't tell what version of zlib you're using, and your compiler does not show the offending line in the error message, so I can't tell exactly what the line contains. However I suspect that these are lines that have an #if directive with the noted symbol in the expression. Per the C standard, a symbol that is not defined is given a null value (no characters replace it) in an expression in an #if statement. Instead your compiler is erroneously issuing an error.

Qmake build and gcc includes

I am working with Qt and kinda new to it. I want to build a Qt application and created devprog.pro file. However, after executing qmake and make I get the error
c:\qt473\include\qtcore../../src/corelib/global/qglobal.h(45)
: fatal error C10 83: Cannot open
include file: 'stddef.h': No such file
or directory
So I specified the gcc 4.4.1 include location and the error messages (amongst others) I get is:
c:\codeblocks\MinGW\lib\gcc\mingw32\4.4.1\include\stddef.h(211)
: error C2371: ' size_t' :
redefinition; different basic types
predefined C++ types (compiler internal)(19) : see declaration of
'size_ t'
C:\CodeBlocks\MinGW\include\string.h(126)
: error C2143: syntax error : missing
';' before '*'
C:\CodeBlocks\MinGW\include\string.h(126)
: error C4430: missing type specifier
- int assumed. Note: C++ does not support default-int
My question is:
1. How can resolve such error problems as I've scratched my hair off trying to solve this.
2. Is there a way to make automatically let qmake detect your main gcc mingw location without having to set it for each project during qmake execution?

Resources