Clang scan-build is not picking up -fno-objc-arc flag on non-ARC'd files - clang-static-analyzer

Hi I have an XCode project which is ARCd but uses some 3rd party (AFNetworking) classes which are not ARCd. I have specified the -fno-objc-arc flag against these files however when I run scan-build I get a number of errors such as:-
error: 'autorelease' is unavailable: not available in automatic reference counting mode
I can see that scan-build is using -fobjc-arc when compiling / checking these classes which is incorrect.
Please could someone advise how I can get scan-build to pick up the correct settings?
FYI I am using checker-267 version downloaded from http://clang-analyzer.llvm.org/
Many thanks

Raised this with the clang team at Apple and they swiftly came back to say that this is a known bug, see:
http://llvm.org/bugs/show_bug.cgi?id=13683
A new version of the checker should be released soon to fix this.

Related

LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in

I have been using a graphics library from Smaller Animals Software called ImgSource. Unfortunately, Smaller Animals Software has closed and is no longer available to answer questions. Recently, I had a system failure that deleted my only up-to-date copy of the library (I thought I had a backup but was wrong). I did, however, have the source code. I recompiled the library, both release and debug. (Both are static .lib files) I am also using MSVS 2019 Community edition and the project is an MFC project. The problem, and why I'm posting here, is that when I link the new release library with a previous project, the project compiles properly. However, when I build the debug version, it will compile, but not link and produces the linker error discussed LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in file.obj
A reasonable conclusion is that there is something wrong with the debug library. However, if I build a new project and link the debug library, everything works fine. So, the error does not appear to be in the library. It seems I could start from scratch and completely redo these projects, but they do reflect a tremendous amount of work.
I can't figure out how to modify the settings in the existing projects so that they will compile in debug mode. I have tried the suggestions offered in the article referenced above. Further suggestions would be greatly appreciated.

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.

monodevelop insists on using a reference that doesn't work

I am using MonoDevelop 2.2 from the Debian testing repository. I have installed the addins for GTK support, for version 2.8 and 2.10.
When I compile my solution, I get warnings saying Warning: Assembly 'glade-sharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f' not found. Make sure that the assembly exists in disk. If the reference is required to build the project you may get compilation errors. (ProCos)
The warning is perfectly alright, because the installed libraries do not offer V2.10 of glade-sharp. So I open the reference dialog, remove the reference and insert a reference to V2.8 of glade-sharp (which does exist). Close the reference dialog and recompile. And bang, same warning and the reference has been changed back to V2.10.
Anybody have any ideas how to fix this? Or is this a known bug in that version of MonoDevelop?
If you're using the GTK version support, all the GTK-related assemblies should have the same version. I suspect that if gtk-sharp.dll is 2.10, then MD will "fix" glade-sharp to 2.10 too. In project options is a dropdown for picking the GTK version; using this will update all GTK assemblies to a specific version.
Note also that you can use the project pad to set a reference to not require a specific version.
I suggest trying MD 2.4, and if it's still an issue, please file a bug report.

fatal error C1084: Cannot read type library file: 'Smegui.tlb': Error loading type library/DLL

I am trying to build an old version of an application which consists of VC++ projects that were written in Visual Studio 2003.
My OS is Windows 7 Enterprise (64-bit).
When I try and build the solution I get the following errors:
error C4772: #import referenced a type from a missing type library; '__missing_type__' used as a placeholder
fatal error C1084: Cannot read type library file: 'Smegui.tlb': Error loading type library/DLL.
They both complain about the following import statement:
#import "Smegui.tlb" no_implementation
This is not a case of the file path being incorrect as renaming the Smegui.tlb file causes the compiler to throw another error saying it cannot find the library.
Smegui is from another application that this one depends on. I thought perhaps I was missing a dll but there is no such thing as Smegui.dll.
All I know about .tlb files is that they are a type library and you can create them from an assembly using tlbexp.exe or regasm.exe (the later also registers the assembly with COM)
There is also an Apache Ant build script which uses a custom task to invoke devenv.com to build the projects. This is the same script that the build server originally used to build the application. It gives me the same errors when I try and run it.
The strangest thing about this is that I knew it ought to work seeing as it is all freshly checked out from subversion. I tried many different combinations of admin vs user elevation, VS vs Ant build, cleaning, release.
I have got it to build successfully about 5 times but the build seems to be non-deterministic.
If anyone can shed some light on how this tlb stuff even works or what this error might mean I would greatly appreciate it.
I found a far more reliable solution: open the tlb with oleview.exe and then close it.
Not sure what this actually does but it works every time.
I think oleview is actually one of the samples included with Visual Studio but I haven't had the time to debug it and see what it is doing.
I ran into this error because one type library was trying to load a dependent type library, which it could not find. Even though the dependent type library was in the same directory, and even though that directory was in the searchable path, the compiler would error loading the first type library, but not mention the dependent type library in the error.
To find the pseudo-missing type library, I ran Process Monitor (procman64.exe) during the compile. This showed that after the reported type library had successfully loaded, a dependent type library could not be found. It even showed all of the places that it was looking for the dependent type library, none of which were where it should have been looking (e.g.: ).
The fix was to add a <PreBuildEvent> to the project to copy the dependent .tlb file to one of the directories that was actually being searched.
<PreBuildEvent>
<Command>copy /Y ..\Lib\Interop\CWSpeechRecLib.tlb .\</Command>
</PreBuildEvent>
http://msdn.microsoft.com/en-us/library/sce74ah7%28VS.71%29.aspx
smegui.tlb is referencing some other tlb that the compiler can't find. If you have the .idl for smegui you might be able to figure out what the other is. I suspect the missing tlb is something that original build machine had registered but that your machine doesn't have registered.
A type library is a binary description of a set of interfaces, coclasses and enums. They're usually generated for COM components, in the case of tlbexp and regasm the tlb is created from the assembly metadata. For native COM components they are usually generated from an idl (Interface Description Language) file by the midl tool.
Edit:
I just noticed you're on x64 Windows. Are you building the project with a new version of Visual Studio? If so, are you targeting x86 or x64? If the latter, it may simply be a 32bit component that the compiler can't find (or less likely, a x64 component the x86 compiler can't find if you are targeting x86), for WOW64 the registry is virtualized for x86 vs. x64 applications.
Well I finally found out why I managed to get it to build sometimes and not others... sort of.
So long as I ran the build script with elevated administrator permissions and let that get as far as it could until that error occurred, then run the build script again as a protected administrator succeeded. Those steps must be done in that exact order with no other steps in between. If I try build in Visual Studio it does not work (although I did get it to succeed once). Probably some kind of virtualisation issue although it still doesn't quite make sense.
Well I don't need help on this any more and I know it's probably impossible to fully answer this question without knowing exactly what the build is doing. However if anyone does have any more thoughts I would happily receive them.
Cheers,
Steiny

Failure to register .dll with regsvr32 - only in Release build

I'm having a weird problem when trying to register the .dll i created using regsvr32.
During development everything went fine, the debug version registers and works fine. Now i wanted to create a Release version, but that Version does not register anymore.
regsvr32 comes up with the following error:
The module "mpegsplitter.dll" failed to load.
Make sure the binary is stored at the specified path or
debug it to check for problems with the binary or
dependent .DLL files.
The specified procedure could not be found.
Some research brought me to the dependency walker, which does tell me this
Error: At least one module has an unresolved import due to a missing export function in an implicitly dependent module.
It also does show a dependency on "crtdll.dll" that the debug version does not have (The function view shows soem functions that normally should be in ole32.dll), which is colored red'ish.
So far so good, i guess its somehow related to what the dependency walker shows there.
But where do i go from here? How do i fix it?
Any help would be greatly appreciated, that has been keeping me busy for several hours already.
Thanks!
I have the same problem. When I compared the different between "Command Line" (in Project Properties -> Linker) of Release and Debug mode, I found out that the "Optimization" options (in Project Properties -> Linker) of Release mode was turned on while ion Debug not.
Turning of Optimization for linker in Release mode solved the problem
Is it possible that the debug version is compiled with _ATL_MIN_CRT but the release version isn't? You can set this with the Minimize CRT Use in ATL project property as well.
I fixed it. It was actually being caused by the order of some mingw libraries i included to link against ffmpeg. Oh well, how weird.
In my case, the difference was in Module Definition File entry between DEBUG and RELEASE. The DEBUG version was pointing to the .DEF file where as the RELEASE had it empty.

Resources