2014-11-23 1 views
0

CLAM project의 예제를 빌드하고 연결하려고합니다. 나는 다음 오류를 링크하고 얻는다. 나는 틀린 것을 모른다.링커에서 오류가 발생했습니다. C++ linux Scons : CLAM project

>== Linking UserTutorial1 
>/usr/local/lib/libclam_core.so: undefined reference to `dlclose' 
>/usr/local/lib/libclam_core.so: undefined reference to `dlsym' 
>/usr/local/lib/libclam_core.so: undefined reference to `dlopen' 
>/usr/local/lib/libclam_core.so: undefined reference to `dlerror' 
>/usr/local/lib/libclam_core.so: undefined reference to `dladdr' 
>collect2: error: ld returned 1 exit status 
>scons: *** [UserTutorial1] Error 1 
>scons: building terminated because of errors. 

아무에게도 도움이 될 수 없습니다. 어떤 변화하는 I는 다음과 같습니다 SConstruct 할 수 있도록해야합니다

>## #!/usr/bin/python 
>import os 
>import glob 
>import sys 
>options = Variables('options.cache', ARGUMENTS) 
>options.Add(PathVariable('clam_prefix', 'The prefix where CLAM was installed', '')) 
>options.Add(BoolVariable('verbose', 'Display the full command line instead a short command >description', 'no')) 
>options.Add(BoolVariable('crossmingw', 'Enables MinGW crosscompilation from linux', 'no')) 
>def scanFiles(pattern, paths) : 
> files = [] 
> for path in paths : 
>  files+=glob.glob(path+"/"+pattern) 
> return files 
>def recursiveDirs(root) : 
> return filter((lambda a : a.rfind(".svn")==-1), [ a[0] for a in os.walk(root)] ) 
>def unique(list) : 
> return dict.fromkeys(list).keys() 
>toolchain = 'default' 
>if sys.platform == "win32" : toolchain = 'mingw' 
>env = Environment(tools=[toolchain], options=options) 
>options.Save('options.cache', env) 
>#TODO: This didn't work for dynamic linking 
>def renameEmbededFileSymbols(source, target, env) : 
> """ Remove the path part of the symbol name for the embeded file""" 
> objdumpOutput=os.popen("objdump -x %s | grep _binary'.*'start"%target[0] , "r").read() 
> startSymbol=objdumpOutput.split()[-1] 
> infix = startSymbol[len('_binary_'):-len("_start")] 
> baseName = os.path.split(str(source[0]))[-1] 
> newInfix = infix[-len(baseName):] 
> return Execute("objcopy %(target)s " 
>  "--redefine-sym _binary_%(infix)s_start=_binary_%(newInfix)s_start " 
>  "--redefine-sym _binary_%(infix)s_end=_binary_%(newInfix)s_end " 
>  "--redefine-sym _binary_%(infix)s_size=_binary_%(newInfix)s_size " % { 
>   "infix": infix, 
>   "newInfix": newInfix, 
>   "target": target[0], 
>  } 
> ) 
>""" 
>embededFileBuilder = Builder(
> action=Action([ 
>  ["ld", "-fPIC", "--shared", "-b", "binary", "-o", "$TARGET", "$SOURCE"], 
>  renameEmbededFileSymbols, 
>  ], 
>  ), 
> suffix='.os', 
> ) 
>env['BUILDERS']['EmbededFile']=embededFileBuilder 
>""" 
>env.SConsignFile() # Single signature file 
>crosscompiling=env['crossmingw'] 
>CLAMInstallDir = env['clam_prefix'] 
>clam_sconstoolspath = os.path.join(CLAMInstallDir,'share','clam','sconstools') 
>env.Tool('clam', toolpath=[clam_sconstoolspath]) 
>env.Tool('qt4', toolpath=[clam_sconstoolspath]) 
>if crosscompiling : 
> env.Tool('crossmingw', toolpath=[clam_sconstoolspath]) 
>env.AppendUnique(ASFLAGS='-I. ') 
>env['CXXFILESUFFIX'] = '.cxx' 
>env['QT4_UICDECLSUFFIX'] = '.hxx' 
>env.moveIntermediateInto('generated') 
>env.activateColorCommandLine() 
>if not env['verbose']: env.ClamQuietCompilation() 
>env.EnableClamModules(libs=[ 
> 'clam_core', 
> 'clam_audioio', 
> 'clam_processing', 
> ], path=CLAMInstallDir) 
>env.EnableQt4Modules([ 
> 'QtCore', 
> 'QtGui', 
> 'QtOpenGL', 
># 'QtSql', 
># 'QtNetwork', 
># 'QtTest', 
># 'QtXml', 
># 'QtSvg', 
># 'QtUiTools', 
># 'QtDesigner', 
># 'Qt3Support', 
> ], debug=False, 
> crosscompiling=crosscompiling, 
> ) 
>sourcePaths = [] 
>extraPaths = [ 
> CLAMInstallDir+'/include', 
> CLAMInstallDir+'/include/CLAM', # KLUDGE to keep old style includes 
>] 
>includePaths = sourcePaths + extraPaths 
>sources = scanFiles('*.cxx', sourcePaths) 
>sources = unique(sources) 
>singleSourceExamples = [ 
> "WritingProcessings.cxx", 
> "NetworkPersistence_example.cxx", 
> "NetworkUsage_example.cxx", 
> "AudioFileReading_example.cxx", 
> "AudioFileWriting_example.cxx", 
> "AudioIOExample.cxx", 
># "Configurators_example.cxx", # QT4Port 
> "DescriptorComputation_example.cxx", 
> "FDFilterExample.cxx", 
> "FFT_example.cxx", 
> "FileInfo_example.cxx", 
> "FilePlayback_example.cxx", 
> "FundamentalDetect.cxx", 
> "LPCAnalysis_example.cxx", # TODO FLTK Dependencies -> Qt4 
> "Midi2XmlExample.cxx", 
> "MIDIFileReadWriteExample.cxx", 
> "MIDIIOExample.cxx", 
> "MIDIOut_example.cxx", 
> "MIDI_Synthesizer_example.cxx", 
> "NetworkPersistence_example.cxx", 
> "NetworkUsage_example.cxx", 
> "OfflineAudioConvolution.cxx", 
> "PersistenceThroughDTs_example.cxx", 
> "POCompositeExample.cxx", 
> "SimplePortsUsage_example.cxx", 
> "ProcessingLifeCycle_example.cxx", 
> "ProcessingObject_controls_example.cxx", 
> "SDIF_And_Segment_example.cxx", # TODO: FLTK Dependencies 
> "Spectrum_example.cxx", 
> "StereoToMonoFile.cxx", 
># "ThreadedProcessing_example.cxx", # TODO: Depends on Resample and FLTK 
> "Tutorial/UserTutorial1.cxx", 
> "Tutorial/UserTutorial2.cxx", 
> "Tutorial/UserTutorial3.cxx", 
> "Tutorial/UserTutorial4.cxx", 
> "Tutorial/UserTutorial5.cxx", 
> "Tutorial/UserTutorial6.cxx", 
>] 
>directoryBasedExamples = [ 
> "PortsAndControlsUsageExample", 
> "ControlArrayExamples", 
> "Wav2SDIF", 
> "SDIF2Wav", 
> "SDIF2WavStreaming", 
>] 
>directoryBasedLibraries = [ 
># "PluginExamples/ClamLadspaPluginExample", 
> "PluginExamples/ClamNativePluginExample", 
>] 
>singleSourceLibraries = [ 
>] 
>env.Append(CPPPATH=includePaths) 
>env.AppendUnique(CPPFLAGS=["-g", "-Wall"]) 
>#env.AppendUnique(DEFINES=["_DEBUG"]) 
>examples = [] 
>for libsource in singleSourceLibraries : 
> library = os.path.basename(libsource) 
> examples += [ env.SharedLibrary(source = libsource) ] 
>for folder in directoryBasedLibraries : 
> librarySources = glob.glob(folder+"/*.cxx") 
># librarySources += [env.EmbededFile(file) for file in glob.glob(folder+"/*.clamnetwork")] 
> library = os.path.basename(folder) 
> examples += [ env.SharedLibrary(target=library, source = librarySources) ] 
>for main in singleSourceExamples : 
> executable = os.path.splitext(os.path.basename(main))[0] 
> examples += [ env.Program(target=executable, source = sources + [main]) ] 
>for folder in directoryBasedExamples : 
> exampleSources = glob.glob(folder+"/*.cxx") 
> executable = os.path.basename(folder)+"Exe" 
> examples += [ env.Program(target=executable, source = sources + exampleSources) ] 
>if not crosscompiling : 
> # Still having problems crosscompiling aubio 
> tickEnv = env.Clone() 
> tickEnv.ParseConfig('pkg-config aubio --cflags --libs') 
> tickEnv.ParseConfig('pkg-config samplerate --cflags --libs') 
> tickSrc = glob.glob("TickExtractor/*cxx") 
> examples += [ tickEnv.Program(target="TickExtractorExe", source = tickSrc) ] 
>env.Alias('examples',examples) 
>env.Default(examples) 
+0

libdl이 누락 된 것처럼 보입니다. 당신이 그것을 어디에 추가하는지 잘 모르겠습니다. 덕분에 – cup

+0

; 나는 그렇게 생각하지만 어디에서, 나는 너무 궁금해하고있다. – telcom

+0

아마도 CPPPATH를 설정 한 후 env.Append (LIBS = [ 'dl'])와 같은 것일 수도있다. – cup

답변

2

난 당신이 SConstruct에서 아무것도 변경할 필요가 있다고 생각하지 않는다,이 오류가 내 각도에서 모든 SCons는 관련이있을 것 같지 않습니다. 오류 메시지는 /usr/local/lib/libclam_core.so의 설치가 해결되지 않은 기호에 의존 함을 보여줍니다. 커맨드 라인에서 간단한 C++ 메인 프로그램에 대해 "clam_core"를 링크하려고 할 때에도 문제가 발생합니다.

"ldd"를 사용하여 "clam_core"lib의 동적 종속성을 확인하십시오. 표준 쉘에서 dlopen 호출을 해결할 수 있습니까? 이것이 명령 행에서 작동하지만 SCons에서는 작동하지 않으면 쉘 환경에서 LD_LIBRARY_PATH를 설정하여 가능합니다. 그런 다음이 경로를 SCons에 전파하거나 LD_LIBRARY_PATH를 사용하지 않고도 종속성을 해결할 수 있도록 필요한 CLAM 라이브러리를 올바르게 설치해야합니다.

CLAM 라이브러리의 설치를 확인하십시오. 소스에서 컴파일 했습니까? 또는 바이너리 패키지를 사용 했습니까? 후자의 경우, 귀하의 기계/아키텍처에 적합한 것을 고르셨습니까?

+0

고마워요. 실제로 나는 소스에서 컴파일 했으므로 오류없이 바이너리를 얻습니다. 경로에 대해 확인한 결과 "ldd"에 문제가있는 것 같습니다. 경로를 설정하면 지금까지 도움이되지 않았습니다 ... – telcom

관련 문제