Pregunta

Estoy tratando de recopilar ejemplo el código fuente que está utilizando el OpenGL, SDL e IL aka aka DevIL bibliotecas OpenIL. OpenGL y SDL están disponibles como marcos nativos, pero diablo no es. Así que aquí es lo que hice:

He instalado DevIL a través de homebrew. En primer lugar he cambiado la fórmula, porque necesito Ilut:

brew edit devil

a continuación, editado estas líneas

def install
  system "./configure", "--disable-debug", "--disable-dependency-tracking",
                        "--prefix=#{prefix}", "--enable-ILU"
  system "make install"
end

así como

def install
  system "./configure", "--disable-debug", "--disable-dependency-tracking",
                        "--prefix=#{prefix}", "--enable-ILU", "--enable-ILUT"
  system "make install"
end

e instalado todo con

[sudo] brew install devil

lo que me da las cabeceras diablo en /usr/local/include/ y las bibliotecas dinámicas en /usr/local/lib/. A continuación, he añadido las bibliotecas de mi proyecto con los siguientes pasos:

  • Haga clic en mi único objetivo
  • Haga clic en "Añadir> marcos existentes"
  • Seleccione "Dylibs"
  • Agregar libIL.dylib, libILU.dylib y libILUT.dylib

(Hay también libIL.1.dylib, libILU.1.dylib y libILUT.1.dylib disponible en la lista, es eso normal?)

Luego añade las siguientes banderas en el "Proyecto> Editar Proyecto> Generar> Otras banderas conector":

-lil -lilu -lilut

Cuando intento compilar y vincular el proyecto me sale el siguiente error:

Ld "build/Debug/XCode OpenGL OOP Framework.app/Contents/MacOS/XCode OpenGL OOP Framework" normal i386
cd "/Users/padde/Documents/Studium/sem5/computergrafik/opengl intro/xcode projects/XCode OpenGL OOP Framework"
/Developer/usr/bin/g++-4.2 -arch i386 "-L/Users/padde/Documents/Studium/sem5/computergrafik/opengl intro/xcode projects/XCode OpenGL OOP Framework/build/Debug" "-F/Users/padde/Documents/Studium/sem5/computergrafik/opengl intro/xcode projects/XCode OpenGL OOP Framework/build/Debug" -filelist "/Users/padde/Documents/Studium/sem5/computergrafik/opengl intro/xcode projects/XCode OpenGL OOP Framework/build/XCode OpenGL OOP Framework.build/Debug/XCode OpenGL OOP Framework.build/Objects-normal/i386/XCode OpenGL OOP Framework.LinkFileList" -framework Foundation -framework AppKit -framework GLUT -framework OpenGL -framework SDL -lIL -lILU -lILUT -o "/Users/padde/Documents/Studium/sem5/computergrafik/opengl intro/xcode projects/XCode OpenGL OOP Framework/build/Debug/XCode OpenGL OOP Framework.app/Contents/MacOS/XCode OpenGL OOP Framework"

ld: warning: in /usr/local/lib/libIL.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
ld: warning: in /usr/local/lib/libILU.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
ld: warning: in /usr/local/lib/libILUT.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
Undefined symbols:
  "_ilInit", referenced from:
      RenderEngine::initManagers()       in RenderEngine.o
  "_ilGetData", referenced from:
      TextureManager::loadTexture(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, unsigned int, unsigned int, unsigned int, bool, bool)in TextureManager.o
  "_ilBindImage", referenced from:
      TextureManager::loadTexture(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, unsigned int, unsigned int, unsigned int, bool, bool)in TextureManager.o
  "_ilLoadImage", referenced from:
      TextureManager::loadTexture(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, unsigned int, unsigned int, unsigned int, bool, bool)in TextureManager.o
  "_ilGenImages", referenced from:
      TextureManager::loadTexture(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, unsigned int, unsigned int, unsigned int, bool, bool)in TextureManager.o
  "_ilGetInteger", referenced from:
      TextureManager::loadTexture(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, unsigned int, unsigned int, unsigned int, bool, bool)in TextureManager.o
      TextureManager::loadTexture(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, unsigned int, unsigned int, unsigned int, bool, bool)in TextureManager.o
      TextureManager::loadTexture(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, unsigned int, unsigned int, unsigned int, bool, bool)in TextureManager.o
      TextureManager::loadTexture(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, unsigned int, unsigned int, unsigned int, bool, bool)in TextureManager.o
  "_ilDeleteImages", referenced from:
      TextureManager::loadTexture(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, unsigned int, unsigned int, unsigned int, bool, bool)in TextureManager.o
      TextureManager::loadTexture(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, unsigned int, unsigned int, unsigned int, bool, bool)in TextureManager.o
      TextureManager::loadTexture(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, unsigned int, unsigned int, unsigned int, bool, bool)in TextureManager.o
  "_main", referenced from:
      start in crt1.10.6.o
     (maybe you meant: _SDL_main)
ld: symbol(s) not found
collect2: ld returned 1 exit status

Al parecer, los archivos .dylib no están siendo construido correctamente y como resultado no se están encontrando los símbolos, pero ¿cómo puedo hacer este trabajo? ¿He cometido errores? ¿Hay una manera de construir las bibliotecas de manera diferente por lo que trabajar con mi proyecto, o puedo cambiar la arquitectura de construcción de mi proyecto de alguna manera?

Muchas gracias por su ayuda!

¿Fue útil?

Solución

I solucionó el problema mediante la edición de la fórmula brew a:

def install
  system "./configure", "--disable-debug", "--disable-dependency-tracking",
                        "--prefix=#{prefix}", "--enable-ILU", "--enable-ILUT",
                        "CFLAGS=-arch i386", "CXXFLAGS=-arch i386"
  system "make install"
end
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top