Build libsndfile library for ARM architectures - linux

I need to build libsndfile for use it in my audio engine on Iphone/Ipad. I've built it without error but for an i386 architecture so I've got some errors when I build my project :
Undefined symbols for architecture i386:
"_FLAC__StreamDecoderErrorStatusString", referenced from:
_sf_flac_error_callback in libsndfile.a(flac.o)
"_FLAC__StreamEncoderInitStatusString", referenced from:
_flac_write_header in libsndfile.a(flac.o)
"_FLAC__metadata_object_delete", referenced from:
_flac_close in libsndfile.a(flac.o)
"_FLAC__metadata_object_new", referenced from:
_flac_write_header in libsndfile.a(flac.o)
"_FLAC__metadata_object_vorbiscomment_append_comment", referenced from:
_flac_write_header in libsndfile.a(flac.o)
How can I build it for arm architecture ?
I've found this subject where Erik de Castro Lopo said to do that :
./configure --prefix=$HOME/Arm --build=i386-linux --host=arm-unknown-linux-gnueabi
But when I build I've got this :
undefined symbols for architecture x86_64:
"_AudioQueueAddPropertyListener", referenced from:
_main in sndfile-play.o
"_AudioQueueAllocateBuffer", referenced from:
_main in sndfile-play.o
"_AudioQueueDispose", referenced from:
_main in sndfile-play.o
"_AudioQueueEnqueueBuffer", referenced from:
_main in sndfile-play.o
_macosx_audio_out_callback in sndfile-play.o
"_AudioQueueFreeBuffer", referenced from:
_main in sndfile-play.o
How can I do ? Thanks!

The first block of errors you see (i386/FLAC) seem to be because the configure process detected the FLAC header files, but could not find the FLAC library.
The second block of errors, which you say is from cross compiling has errors related to x86_64. Do you actually have an arm cross compiler installed?
What's the the output of the following commands (run in the libsndfile source directory after running ./configure):
$ grep _os config.log
$ grep _CC config.log

Related

Cabal v2-build: Undefined symbols for architecture x86_64

Cabal suddenly stopped building my project. Nothing much changed in the project itself since the last successful build, I guess only OS updates were installed.
The error I get on cabal v2-build is:
Undefined symbols for architecture x86_64:
"_u_errorName_70", referenced from:
___hs_u_errorName in libHStxt-c-0.7.1.0-21406b30.a(text_icu.o)
"_ucnv_close_70", referenced from:
___hs_ucnv_close in libHStxt-c-0.7.1.0-21406b30.a(text_icu.o)
"_ucnv_fromUChars_70", referenced from:
___hs_ucnv_fromUChars in libHStxt-c-0.7.1.0-21406b30.a(text_icu.o)
"_ucnv_getMaxCharSize_70", referenced from:
___get_max_bytes_for_string in libHStxt-c-0.7.1.0-21406b30.a(text_icu.o)
"_ucnv_open_70", referenced from:
___hs_ucnv_open in libHStxt-c-0.7.1.0-21406b30.a(text_icu.o)
"_ucnv_setFallback_70", referenced from:
___hs_ucnv_setFallback in libHStxt-c-0.7.1.0-21406b30.a(text_icu.o)
"_ucnv_toUChars_70", referenced from:
___hs_ucnv_toUChars in libHStxt-c-0.7.1.0-21406b30.a(text_icu.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
`gcc' failed in phase `Linker'. (Exit code: 1)
Additionally, cabal repl stopped working as well:
<command line>: dlopen(/Users/user/.cabal/store/ghc-8.10.7/lib/libHStxt-c-0.7.1.0-21406b30-ghc8.10.7.dylib, 0x0005): Library not loaded: '/usr/local/opt/icu4c/lib/libicuuc.70.dylib'
Referenced from: '/Users/user/.cabal/store/ghc-8.10.7/lib/libHStxt-c-0.7.1.0-21406b30-ghc8.10.7.dylib'
Reason: tried: '/usr/local/opt/icu4c/lib/libicuuc.70.dylib' (no such file), '/usr/local/lib/libicuuc.70.dylib' (no such file), '/usr/lib/libicuuc.70.dylib' (no such file), '/usr/local/Cellar/icu4c/71.1/lib/libicuuc.70.dylib' (no such file), '/usr/local/lib/libicuuc.70.dylib' (no such file), '/usr/lib/libicuuc.70.dylib' (no such file)
Error: cabal: repl failed for exe:appname from
appname-1.0.0
I am on ghc 8.10.7, macOS Monterey 12.6.1 and cabal --version outputs
cabal-install version 3.8.1.0
compiled using version 3.8.1.0 of the Cabal library
Version of icu4c is 71.1, it is installed using brew.
How could I make the project compile successfully again?
Well, it looks like the text-icu package got built against icu4u version 70, and then your system upgraded to version 71. Unless you feel like downgrading icu4u, you should try deleting the package store (that is, ~/.cabal/store/ghc-<version>/). The next run of cabal v2-build in your project will then go and rebuild all its dependencies, including the packages rendered "stale" by your system upgrade. Note that deleting the store may break installed executables.

Problems compiling Haskell School of Expression on Mac, on what platform is it known to be compilable/runnable?

Any idea how one could get this code compiled below on Mac OS (Maverick)? I followed the instructions here. Other (non-graphics) part of the code seems to work in the GHCi.
If I try to run main3book from GHCi it crashes with segmentation fault. Maybe I could run it in a virtual machine of some kind (under VMWARE, 32 bit Windows XP)?
It would be good to know on what platform one can run the examples from this book for sure so if someone managed to run these examples recently then please let me know how.
Edit: in this discussion they mention Ubuntu where it worked. I just hope I am not the only one on the internet who is trying get these old examples running nowadays.
bash-3.2$ cat MyGraphics.hs
import SimpleGraphics
main = main3book
bash-3.2$ ghc MyGraphics
[3 of 3] Compiling Main ( MyGraphics.hs, MyGraphics.o )
Linking MyGraphics ...
Undefined symbols for architecture x86_64:
"_IOCreatePlugInInterfaceForService", referenced from:
__glfwInitJoysticks in libHSGLFW-0.5.2.0.a(cocoa_joystick.o)
"_IOIteratorNext", referenced from:
__glfwInitJoysticks in libHSGLFW-0.5.2.0.a(cocoa_joystick.o)
"_IOMasterPort", referenced from:
__glfwInitJoysticks in libHSGLFW-0.5.2.0.a(cocoa_joystick.o)
"_IORegistryEntryCreateCFProperties", referenced from:
__glfwInitJoysticks in libHSGLFW-0.5.2.0.a(cocoa_joystick.o)
"_IOServiceGetMatchingServices", referenced from:
__glfwInitJoysticks in libHSGLFW-0.5.2.0.a(cocoa_joystick.o)
"_IOServiceMatching", referenced from:
__glfwInitJoysticks in libHSGLFW-0.5.2.0.a(cocoa_joystick.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Problem solved with Ubuntu 12 (32 bit version) in VMWARE Fusion.
See picture below :)

How to use libgit2 from a native C++ application on Windows? (Microsoft VC++)

Summary: Is there any tiny example on how to build the Win32 C++ console application that uses the libgit2 library (sources available at GitHub)?
I have followed the readme and the wiki on how to build the library on Windows using the CMake, and it worked smoothly (only a single unit-test error).
Now, I want to build a simple console application that uses the library -- using Microsoft Visual Studio C++ 2010 (the.vcxproj and the.sln). I have found the general.c code in the libgit2 examples, and I would like to do the same from my C++ application. No success -- I feel really stupid today...
I have noticed there is libqgit2 for C++ and Qt. Is there anything similar for pure C++? Or is there a way to use the C library from C++ application?
Update: I have renamed the general.c to general.cpp, added the libgit2 include path to the project and the path to the .lib files, changed the #include <stdio.h> to #include <cstdio>, and compiled. The following link errors appear:
1>------ Build started: Project: libgit2_general, Configuration: Debug Win32 ------
1>general.obj : error LNK2019: unresolved external symbol _git_repository_free referenced in function _main
1>general.obj : error LNK2019: unresolved external symbol _git_config_get_string referenced in function _main
1>general.obj : error LNK2019: unresolved external symbol _git_config_get_int32 referenced in function _main
1>general.obj : error LNK2019: unresolved external symbol _git_config_open_ondisk referenced in function _main
1>general.obj : error LNK2019: unresolved external symbol _git_strarray_free referenced in function _main
... etc.
1>general.obj : error LNK2019: unresolved external symbol _git_repository_open referenced in function _main
1>general.obj : error LNK2019: unresolved external symbol _giterr_last referenced in function "void __cdecl check_error(int,char const *)" (?check_error##YAXHPBD#Z)
1>D:\Tutorial\libgit2_general\Debug\libgit2_general.exe : fatal error LNK1120: 56 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
This strongly suggests a calling convention mismatch to me. libgit2 uses __stdcall by default, for a number of reasons, while Visual Studio defaults to creating projects that use the __cdecl calling convention. While your program can use either calling convention and successfully call libgit2 using a different one, the easiest solution is probably just to use the same calling convention for both.
When you configure libgit2, you can turn off the STDCALL flag, which will cause it to emit a library built with __cdecl calling conventions:
cmake %PATH_TO_LIBGIT2_SOURCE% -DTHREADSAFE=ON -DSTDCALL=OFF
cmake --build .
It's a little surprising if you generated the project from CMake, bit it could be that you're not linking to libgit2.lib. Make sure you have git2.dll in Project Properties -> Configuration Properties -> Linker -> Input -> Additional Dependencies.

CanvasCamera Plugin

I'm trying to implement the CanvasCamera Plugin, I followed the procedure but when I try to run the project in the simulator I mark 8 errors:
Undefined symbols for architecture i386:
"_CVPixelBufferGetBaseAddress", referenced from:
-[CanvasCamera captureOutput:didOutputSampleBuffer:fromConnection:] in CanvasCamera.o
"_CVPixelBufferGetBytesPerRow", referenced from:
-[CanvasCamera captureOutput:didOutputSampleBuffer:fromConnection:] in CanvasCamera.o
"_CVPixelBufferGetHeight", referenced from:
-[CanvasCamera captureOutput:didOutputSampleBuffer:fromConnection:] in CanvasCamera.o
"_CVPixelBufferGetWidth", referenced from:
-[CanvasCamera captureOutput:didOutputSampleBuffer:fromConnection:] in CanvasCamera.o
"_CVPixelBufferLockBaseAddress", referenced from:
-[CanvasCamera captureOutput:didOutputSampleBuffer:fromConnection:] in CanvasCamera.o
"_CVPixelBufferUnlockBaseAddress", referenced from:
-[CanvasCamera captureOutput:didOutputSampleBuffer:fromConnection:] in CanvasCamera.o
"_kCVPixelBufferPixelFormatTypeKey", referenced from:
-[CanvasCamera startCapture:withDict:] in CanvasCamera.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Could you help me with this?
I'm testing in
Mac mini intel i5 processor
Os X 10.8.2
Xcode 4.5
You forgot adding the CoreVideo.framework library in the Build Phases tab of the project.
And when you press Product/Archive, you will get the bug. Check Building an archive for XCode 4.6 release with phonegap v 2.9 fails to resolve.

Flurry ads library undefined symbols for architecture armv7:

I would like to use Flurry ads in my upcoming application. I have already installed the analytics package and love how easy it is to track users and events.
However, I am having an error implementing ads with the new 4.0.1 SDK that I have found no answers to. Every time I try to build my Xcode 4.2 project I get this error message:
Undefined symbols for architecture armv7:
"_MPMoviePlayerLoadStateDidChangeNotification", referenced from:
-[FlurryVideoPlayer playVideo:view:ad:] in libFlurryAds.a(FlurryVideoPlayer.o)
-[FlurryVideoPlayer moviePlayerLoadStateChanged:] in libFlurryAds.a(FlurryVideoPlayer.o)
"_MPMoviePlayerPlaybackStateDidChangeNotification", referenced from:
-[FlurryVideoPlayer playVideo:view:ad:] in libFlurryAds.a(FlurryVideoPlayer.o)
"_MPMoviePlayerDidEnterFullscreenNotification", referenced from:
-[FlurryVideoPlayer init] in libFlurryAds.a(FlurryVideoPlayer.o)
"_MPMoviePlayerPlaybackDidFinishNotification", referenced from:
-[FlurryVideoPlayer playVideo:view:ad:] in libFlurryAds.a(FlurryVideoPlayer.o)
-[FlurryVideoPlayer moviePreloadDidFinish:] in libFlurryAds.a(FlurryVideoPlayer.o)
-[FlurryVideoPlayer stopMovie] in libFlurryAds.a(FlurryVideoPlayer.o)
"_OBJC_CLASS_$_MPMoviePlayerController", referenced from:
objc-class-ref in libFlurryAds.a(FlurryVideoPlayer.o)
"_MPMoviePlayerWillEnterFullscreenNotification", referenced from:
-[FlurryVideoPlayer init] in libFlurryAds.a(FlurryVideoPlayer.o)
"_MPMoviePlayerContentPreloadDidFinishNotification", referenced from:
-[FlurryVideoPlayer playVideo:view:ad:] in libFlurryAds.a(FlurryVideoPlayer.o)
-[FlurryVideoPlayer moviePreloadDidFinish:] in libFlurryAds.a(FlurryVideoPlayer.o)
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Clearly something has gone wrong with my FlurryAds.a library. I have tried several times to follow the Flurry advertising instructions to the letter but despite my best efforts I still have this error. My library is linked correctly within build phases and I have done my best to implement the fixes described here Undefined symbols for architecture armv7 but to no avail.
Any ideas? Thank you so so much for your help.
I've the same error with XCode 5.1
I've resolve this to link MediaPlayer.framework and AdSupport.framework in the project.

Resources