掲題の件、情報をいただけますと助かります。
拙い説明で申し訳ありませんが、よろしくお願いします。
環境
- macOS 10.13.1
- xcode 9.1
- swift 4.0.2
- alure 1.2
###前提・実現したいこと
- iOS 向けの楽器アプリを作りたく、openAL の拡張ライブラリ alure を導入しようとしています。
- 参考しにした記事は以下になります。
(1) (ALURE(OpenALユーティリティ)をiOSで使う
(2) OpenAL + ALURE + Swift3でゲーム用の低遅延なサウンド再生システムを作る
###発生している問題・エラーメッセージ
- 上記の記事を参考にして、設定とコーディングは通ったが、ビルドが通らず、以下のエラーが発生。
ld: warning: ignoring file /****/alure-1.2/build/libalure-static.a, missing required architecture x86_64 in file /****/alure-1.2/build/libalure-static.a (3 slices) Undefined symbols for architecture x86_64: "_alureCreateBufferFromFile", referenced from: __T09SlapDrums19ConcreteSoundSource33_7EF52A05B80AD151FC4B8FE56EFA92FALLCADSgSS12fullFilePath_tcfc in SoundPlayerFactory.o "_alurePauseSource", referenced from: __T09SlapDrums19ConcreteSoundSource33_7EF52A05B80AD151FC4B8FE56EFA92FALLC5pauseyyF in SoundPlayerFactory.o "_alurePlaySource", referenced from: __T09SlapDrums19ConcreteSoundSource33_7EF52A05B80AD151FC4B8FE56EFA92FALLC4playyyF in SoundPlayerFactory.o "_alureStopSource", referenced from: __T09SlapDrums19ConcreteSoundSource33_7EF52A05B80AD151FC4B8FE56EFA92FALLCfd in SoundPlayerFactory.o __T09SlapDrums19ConcreteSoundSource33_7EF52A05B80AD151FC4B8FE56EFA92FALLC4stopyyF in SoundPlayerFactory.o "_alureShutdownDevice", referenced from: __T09SlapDrums18SoundPlayerFactoryCfd in SoundPlayerFactory.o "_alureInitDevice", referenced from: __T09SlapDrums18SoundPlayerFactoryCACSgyc33_7EF52A05B80AD151FC4B8FE56EFA92FALlfc in SoundPlayerFactory.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)
###問題と思われるソースコード
(文字数制限の関係でリンクにさせて頂きます。)
- alure.h
#ifndef AL_ALURE_H #define AL_ALURE_H #if !defined(ALC_VERSION_0_1) || !defined(AL_VERSION_1_0) #ifdef _WIN32 #include <al.h> #include <alc.h> #elif defined(__APPLE__) #include <OpenAL/alc.h> #include <OpenAL/al.h> #else #include <AL/al.h> #include <AL/alc.h> #endif #endif #if defined(__cplusplus) extern "C" { #endif #define ALURE_VERSION_STRING "1.2" #define ALURE_VERSION_1_0 #define ALURE_VERSION_1_1 #define ALURE_VERSION_1_2 #ifndef ALURE_API #if defined(ALURE_STATIC_LIBRARY) #define ALURE_API #elif defined(_WIN32) #define ALURE_API __declspec(dllimport) #else #define ALURE_API extern #endif #endif #if defined(_WIN32) #define ALURE_APIENTRY __cdecl #include <sys/types.h> typedef __int64 alureInt64; typedef unsigned __int64 alureUInt64; #else #define ALURE_APIENTRY #include <stdint.h> typedef int64_t alureInt64; typedef uint64_t alureUInt64; #endif typedef struct alureStream alureStream; 〜(以下、中略あり)〜 ALURE_API ALboolean ALURE_APIENTRY alureInitDevice(const ALCchar *name, const ALCint *attribs); ALURE_API ALboolean ALURE_APIENTRY alureShutdownDevice(void); ALURE_API ALuint ALURE_APIENTRY alureCreateBufferFromFile(const ALchar *fname); ALURE_API ALboolean ALURE_APIENTRY alurePlaySource(ALuint source, void (*callback)(void *userdata, ALuint source), void *userdata); ALURE_API ALboolean ALURE_APIENTRY alureStopSource(ALuint source, ALboolean run_callback); ALURE_API ALboolean ALURE_APIENTRY alurePauseSource(ALuint source); #if defined(__cplusplus) } /* extern "C" */ #endif #endif /* AL_ALURE_H */
###試したこと
- 上記エラーの解決方法は、以下を参考にしました。
Undefined symbols for architecture x86_64:の原因(複数)
- コーディング時に、該当のライブラリ(alureInitDeviceなど)の自動補完はできているため、ヘッダーファイルは読めていると思われる。
- Build Settings -> Buiild Active Architecture Only -> No にするも、回避できず。
- ライブラリの実装部分が.cpp であるため、ヘッダーファイルに、
extern "C"
が設定されているが、これが効いていないと思われる。
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。