Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[build] Shared library on OS X #328

Closed
define-private-public opened this issue Jul 17, 2017 · 11 comments
Closed

[build] Shared library on OS X #328

define-private-public opened this issue Jul 17, 2017 · 11 comments
Labels
help needed - please! I need help with this issue

Comments

@define-private-public
Copy link
Contributor

I'm working on some Nim bindings at the moment and I'm trying to test they work on OS X. I'm trying to work with raylib as a shared library. So When I clone the source and did make SHARED_RAYLIB=YES PLATFORM=PLATFORM_DESKTOP there were no .so files in the release/osx folder.

I noticed that around line 320 of the src/Makefile that there was no ifeq clause for OSX. So I added one in (by copy and pasting the one for LINUX). It did get a bit farther, but then this error arose:

mac:src me$ make SHARED_RAYLIB=YES PLATFORM=PLATFORM_DESKTOP
gcc -c audio.c -O1 -Wall -std=c99 -D_DEFAULT_SOURCE -fgnu89-inline -Wno-missing-braces -fPIC -I. -Iexternal -Iexternal/openal_soft/include -Iexternal/glfw3/include -DPLATFORM_DESKTOP -DBUILDING_DLL -DAL_LIBTYPE_STATIC
audio.c:878:25: warning: unused variable 'numSamplesOgg' [-Wunused-variable]
                    int numSamplesOgg = stb_vorbis_get_samples_short_interleaved(music->ctxOgg, m...
                        ^
1 warning generated.
gcc -c core.c -O1 -Wall -std=c99 -D_DEFAULT_SOURCE -fgnu89-inline -Wno-missing-braces -fPIC -I. -Iexternal -Iexternal/openal_soft/include -Iexternal/glfw3/include -DPLATFORM_DESKTOP -DBUILDING_DLL
gcc -c models.c -O1 -Wall -std=c99 -D_DEFAULT_SOURCE -fgnu89-inline -Wno-missing-braces -fPIC -I. -Iexternal -Iexternal/openal_soft/include -Iexternal/glfw3/include -DPLATFORM_DESKTOP -DBUILDING_DLL
gcc -c rlgl.c -O1 -Wall -std=c99 -D_DEFAULT_SOURCE -fgnu89-inline -Wno-missing-braces -fPIC -I. -Iexternal -Iexternal/openal_soft/include -Iexternal/glfw3/include -DGRAPHICS_API_OPENGL_33
gcc -c shapes.c -O1 -Wall -std=c99 -D_DEFAULT_SOURCE -fgnu89-inline -Wno-missing-braces -fPIC -I. -Iexternal -Iexternal/openal_soft/include -Iexternal/glfw3/include -DBUILDING_DLL
shapes.c:631:20: warning: unsequenced modification and access to 't' [-Wunsequenced]
    return (c/2*((t-=2)*t*t + 2) + b);
                   ^    ~
1 warning generated.
gcc -c text.c -O1 -Wall -std=c99 -D_DEFAULT_SOURCE -fgnu89-inline -Wno-missing-braces -fPIC -I. -Iexternal -Iexternal/openal_soft/include -Iexternal/glfw3/include -DBUILDING_DLL
In file included from text.c:59:
./external/stb_truetype.h:3291:16: warning: unused function 'stbtt_GetBakedQuad' [-Wunused-function]
STBTT_DEF void stbtt_GetBakedQuad(const stbtt_bakedchar *chardata, int pw, int ph, int char_index...
               ^
./external/stb_truetype.h:3389:15: warning: unused function 'stbtt_PackBegin' [-Wunused-function]
STBTT_DEF int stbtt_PackBegin(stbtt_pack_context *spc, unsigned char *pixels, int pw, int ph, in...
              ^
./external/stb_truetype.h:3420:16: warning: unused function 'stbtt_PackEnd' [-Wunused-function]
STBTT_DEF void stbtt_PackEnd  (stbtt_pack_context *spc)
               ^
./external/stb_truetype.h:3727:15: warning: unused function 'stbtt_PackFontRange' [-Wunused-function]
STBTT_DEF int stbtt_PackFontRange(stbtt_pack_context *spc, unsigned char *fontdata, int font_inde...
              ^
./external/stb_truetype.h:3426:16: warning: unused function 'stbtt_PackSetOversampling'
      [-Wunused-function]
STBTT_DEF void stbtt_PackSetOversampling(stbtt_pack_context *spc, unsigned int h_oversample, unsi...
               ^
./external/stb_truetype.h:3739:16: warning: unused function 'stbtt_GetPackedQuad' [-Wunused-function]
STBTT_DEF void stbtt_GetPackedQuad(const stbtt_packedchar *chardata, int pw, int ph, int char_ind...
               ^
./external/stb_truetype.h:3944:15: warning: unused function 'stbtt_GetNumberOfFonts' [-Wunused-function]
STBTT_DEF int stbtt_GetNumberOfFonts(const unsigned char *data)
              ^
./external/stb_truetype.h:2197:16: warning: unused function 'stbtt_GetFontVMetrics' [-Wunused-function]
STBTT_DEF void stbtt_GetFontVMetrics(const stbtt_fontinfo *info, int *ascent, int *descent, int *lineGap)
               ^
./external/stb_truetype.h:2204:16: warning: unused function 'stbtt_GetFontBoundingBox'
      [-Wunused-function]
STBTT_DEF void stbtt_GetFontBoundingBox(const stbtt_fontinfo *info, int *x0, int *y0, int *x1, int *y1)
               ^
./external/stb_truetype.h:2192:16: warning: unused function 'stbtt_GetCodepointHMetrics'
      [-Wunused-function]
STBTT_DEF void stbtt_GetCodepointHMetrics(const stbtt_fontinfo *info, int codepoint, int *advance...
               ^
./external/stb_truetype.h:2185:16: warning: unused function 'stbtt_GetCodepointKernAdvance'
      [-Wunused-function]
STBTT_DEF int  stbtt_GetCodepointKernAdvance(const stbtt_fontinfo *info, int ch1, int ch2)
               ^
./external/stb_truetype.h:1474:15: warning: unused function 'stbtt_GetCodepointBox' [-Wunused-function]
STBTT_DEF int stbtt_GetCodepointBox(const stbtt_fontinfo *info, int codepoint, int *x0, int *y0, ...
              ^
./external/stb_truetype.h:1479:15: warning: unused function 'stbtt_IsGlyphEmpty' [-Wunused-function]
STBTT_DEF int stbtt_IsGlyphEmpty(const stbtt_fontinfo *info, int glyph_index)
              ^
./external/stb_truetype.h:1422:15: warning: unused function 'stbtt_GetCodepointShape' [-Wunused-function]
STBTT_DEF int stbtt_GetCodepointShape(const stbtt_fontinfo *info, int unicode_codepoint, stbtt_ve...
              ^
./external/stb_truetype.h:2224:16: warning: unused function 'stbtt_FreeShape' [-Wunused-function]
STBTT_DEF void stbtt_FreeShape(const stbtt_fontinfo *info, stbtt_vertex *v)
               ^
./external/stb_truetype.h:3145:16: warning: unused function 'stbtt_FreeBitmap' [-Wunused-function]
STBTT_DEF void stbtt_FreeBitmap(unsigned char *bitmap, void *userdata)
               ^
./external/stb_truetype.h:3229:26: warning: unused function 'stbtt_GetCodepointBitmap'
      [-Wunused-function]
STBTT_DEF unsigned char *stbtt_GetCodepointBitmap(const stbtt_fontinfo *info, float scale_x, floa...
                         ^
./external/stb_truetype.h:3234:16: warning: unused function 'stbtt_MakeCodepointBitmap'
      [-Wunused-function]
STBTT_DEF void stbtt_MakeCodepointBitmap(const stbtt_fontinfo *info, unsigned char *output, int o...
               ^
./external/stb_truetype.h:2262:16: warning: unused function 'stbtt_GetCodepointBitmapBox'
      [-Wunused-function]
STBTT_DEF void stbtt_GetCodepointBitmapBox(const stbtt_fontinfo *font, int codepoint, float scale...
               ^
./external/stb_truetype.h:3190:26: warning: unused function 'stbtt_GetGlyphBitmap' [-Wunused-function]
STBTT_DEF unsigned char *stbtt_GetGlyphBitmap(const stbtt_fontinfo *info, float scale_x, float sc...
                         ^
./external/stb_truetype.h:3954:15: warning: unused function 'stbtt_FindMatchingFont' [-Wunused-function]
STBTT_DEF int stbtt_FindMatchingFont(const unsigned char *fontdata, const char *name, int flags)
              ^
./external/stb_truetype.h:3959:15: warning: unused function 'stbtt_CompareUTF8toUTF16_bigendian'
      [-Wunused-function]
STBTT_DEF int stbtt_CompareUTF8toUTF16_bigendian(const char *s1, int len1, const char *s2, int len2)
              ^
./external/stb_truetype.h:3819:23: warning: unused function 'stbtt_GetFontNameString' [-Wunused-function]
STBTT_DEF const char *stbtt_GetFontNameString(const stbtt_fontinfo *font, int *length, int platfo...
                      ^
23 warnings generated.
gcc -c textures.c -O1 -Wall -std=c99 -D_DEFAULT_SOURCE -fgnu89-inline -Wno-missing-braces -fPIC -I. -Iexternal -Iexternal/openal_soft/include -Iexternal/glfw3/include -DPLATFORM_DESKTOP -DGRAPHICS_API_OPENGL_33 -DBUILDING_DLL
In file included from textures.c:102:
./external/stb_image.h:650:12: warning: unused function 'stbi__sse2_available' [-Wunused-function]
static int stbi__sse2_available()
           ^
1 warning generated.
gcc -c utils.c -O1 -Wall -std=c99 -D_DEFAULT_SOURCE -fgnu89-inline -Wno-missing-braces -fPIC -I. -Iexternal -Iexternal/openal_soft/include -Iexternal/glfw3/include -DPLATFORM_DESKTOP -DBUILDING_DLL
gcc -c -o external/stb_vorbis.o external/stb_vorbis.c -O1 -O1 -Wall -std=c99 -D_DEFAULT_SOURCE -fgnu89-inline -Wno-missing-braces -fPIC -I. -Iexternal -Iexternal/openal_soft/include -Iexternal/glfw3/include -DPLATFORM_DESKTOP
gcc -shared -o ../release/osx/libraylib.so  audio.o  core.o  models.o  rlgl.o  shapes.o  text.o  textures.o  utils.o external/stb_vorbis.o
Undefined symbols for architecture x86_64:
  "_alBufferData", referenced from:
      _LoadSoundFromWave in audio.o
      _UpdateSound in audio.o
      _InitAudioStream in audio.o
      _UpdateAudioStream in audio.o
  "_alDeleteBuffers", referenced from:
      _UnloadSound in audio.o
      _CloseAudioStream in audio.o
  "_alDeleteSources", referenced from:
      _UnloadSound in audio.o
      _CloseAudioStream in audio.o
  "_alGenBuffers", referenced from:
      _LoadSoundFromWave in audio.o
      _InitAudioStream in audio.o
  "_alGenSources", referenced from:
      _LoadSoundFromWave in audio.o
      _InitAudioStream in audio.o
  "_alGetBufferi", referenced from:
      _UpdateSound in audio.o
  "_alGetError", referenced from:
      _UpdateAudioStream in audio.o
  "_alGetSourcei", referenced from:
      _ResumeSound in audio.o
      _IsSoundPlaying in audio.o
      _CloseAudioStream in audio.o
      _ResumeMusicStream in audio.o
      _UpdateMusicStream in audio.o
      _IsMusicPlaying in audio.o
      _IsAudioBufferProcessed in audio.o
      ...
  "_alListener3f", referenced from:
      _InitAudioDevice in audio.o
  "_alListenerf", referenced from:
      _InitAudioDevice in audio.o
      _SetMasterVolume in audio.o
  "_alSource3f", referenced from:
      _LoadSoundFromWave in audio.o
      _InitAudioStream in audio.o
  "_alSourcePause", referenced from:
      _PauseSound in audio.o
      _PauseMusicStream in audio.o
      _PauseAudioStream in audio.o
  "_alSourcePlay", referenced from:
      _PlaySound in audio.o
      _ResumeSound in audio.o
      _PlayMusicStream in audio.o
      _ResumeMusicStream in audio.o
      _PlayAudioStream in audio.o
      _ResumeAudioStream in audio.o
  "_alSourceQueueBuffers", referenced from:
      _InitAudioStream in audio.o
      _UpdateAudioStream in audio.o
  "_alSourceStop", referenced from:
      _UnloadSound in audio.o
      _UpdateSound in audio.o
      _StopSound in audio.o
      _CloseAudioStream in audio.o
      _StopMusicStream in audio.o
      _StopAudioStream in audio.o
  "_alSourceUnqueueBuffers", referenced from:
      _CloseAudioStream in audio.o
      _UpdateAudioStream in audio.o
  "_alSourcef", referenced from:
      _LoadSoundFromWave in audio.o
      _SetSoundVolume in audio.o
      _SetSoundPitch in audio.o
      _InitAudioStream in audio.o
      _SetMusicVolume in audio.o
      _SetMusicPitch in audio.o
  "_alSourcei", referenced from:
      _LoadSoundFromWave in audio.o
      _UpdateSound in audio.o
  "_alcCloseDevice", referenced from:
      _InitAudioDevice in audio.o
      _CloseAudioDevice in audio.o
  "_alcCreateContext", referenced from:
      _InitAudioDevice in audio.o
  "_alcDestroyContext", referenced from:
      _InitAudioDevice in audio.o
      _CloseAudioDevice in audio.o
  "_alcGetContextsDevice", referenced from:
      _CloseAudioDevice in audio.o
      _IsAudioDeviceReady in audio.o
  "_alcGetCurrentContext", referenced from:
      _CloseAudioDevice in audio.o
      _IsAudioDeviceReady in audio.o
  "_alcGetString", referenced from:
      _InitAudioDevice in audio.o
  "_alcMakeContextCurrent", referenced from:
      _InitAudioDevice in audio.o
      _CloseAudioDevice in audio.o
  "_alcOpenDevice", referenced from:
      _InitAudioDevice in audio.o
  "_glActiveTexture", referenced from:
      _rlglDrawMesh in rlgl.o
  "_glAttachShader", referenced from:
      _LoadShaderProgram in rlgl.o
  "_glBindAttribLocation", referenced from:
      _LoadShaderProgram in rlgl.o
  "_glBindBuffer", referenced from:
      _LoadDefaultBuffers in rlgl.o
      _UnloadDefaultBuffers in rlgl.o
      _UpdateDefaultBuffers in rlgl.o
      _DrawDefaultBuffers in rlgl.o
      _rlglLoadMesh in rlgl.o
      _rlglUpdateMesh in rlgl.o
      _rlglDrawMesh in rlgl.o
      ...
  "_glBindFramebuffer", referenced from:
      _rlEnableRenderTexture in rlgl.o
      _rlDisableRenderTexture in rlgl.o
      _rlglLoadRenderTexture in rlgl.o
  "_glBindTexture", referenced from:
      _rlTextureParameters in rlgl.o
      _rlglLoadTexture in rlgl.o
      _DrawDefaultBuffers in rlgl.o
      _rlglLoadRenderTexture in rlgl.o
      _rlglUpdateTexture in rlgl.o
      _rlglGenerateMipmaps in rlgl.o
      _rlglDrawMesh in rlgl.o
      ...
  "_glBindVertexArray", referenced from:
      _LoadDefaultBuffers in rlgl.o
      _UnloadDefaultBuffers in rlgl.o
      _UpdateDefaultBuffers in rlgl.o
      _DrawDefaultBuffers in rlgl.o
      _rlglLoadMesh in rlgl.o
      _rlglUpdateMesh in rlgl.o
      _rlglDrawMesh in rlgl.o
      ...
  "_glBlendFunc", referenced from:
      _rlglInit in rlgl.o
      _BeginBlendMode in rlgl.o
  "_glBufferData", referenced from:
      _LoadDefaultBuffers in rlgl.o
      _rlglLoadMesh in rlgl.o
      _rlglUpdateMesh in rlgl.o
  "_glBufferSubData", referenced from:
      _UpdateDefaultBuffers in rlgl.o
      _rlglUpdateMesh in rlgl.o
  "_glCheckFramebufferStatus", referenced from:
      _rlglLoadRenderTexture in rlgl.o
  "_glClear", referenced from:
      _rlClearScreenBuffers in rlgl.o
      _rlglInit in rlgl.o
  "_glClearColor", referenced from:
      _rlClearColor in rlgl.o
      _rlglInit in rlgl.o
  "_glClearDepth", referenced from:
      _rlglInit in rlgl.o
  "_glCompileShader", referenced from:
      _LoadShaderProgram in rlgl.o
  "_glCompressedTexImage2D", referenced from:
      _LoadCompressedTexture in rlgl.o
  "_glCreateProgram", referenced from:
      _LoadShaderProgram in rlgl.o
  "_glCreateShader", referenced from:
      _LoadShaderProgram in rlgl.o
  "_glCullFace", referenced from:
      _rlglInit in rlgl.o
  "_glDeleteBuffers", referenced from:
      _rlDeleteBuffers in rlgl.o
      _UnloadDefaultBuffers in rlgl.o
  "_glDeleteFramebuffers", referenced from:
      _rlDeleteRenderTextures in rlgl.o
      _rlglLoadRenderTexture in rlgl.o
  "_glDeleteProgram", referenced from:
      _rlDeleteShader in rlgl.o
      _UnloadDefaultShader in rlgl.o
      _LoadShaderProgram in rlgl.o
  "_glDeleteShader", referenced from:
      _LoadShaderProgram in rlgl.o
  "_glDeleteTextures", referenced from:
      _rlDeleteTextures in rlgl.o
      _rlDeleteRenderTextures in rlgl.o
      _rlglClose in rlgl.o
      _rlglLoadRenderTexture in rlgl.o
  "_glDeleteVertexArrays", referenced from:
      _rlDeleteVertexArrays in rlgl.o
      _UnloadDefaultBuffers in rlgl.o
  "_glDepthFunc", referenced from:
      _rlglInit in rlgl.o
  "_glDisable", referenced from:
      _rlDisableDepthTest in rlgl.o
      _rlglInit in rlgl.o
  "_glDisableVertexAttribArray", referenced from:
      _UnloadDefaultBuffers in rlgl.o
      _rlglLoadMesh in rlgl.o
      _rlglDrawMesh in rlgl.o
  "_glDrawArrays", referenced from:
      _DrawDefaultBuffers in rlgl.o
      _rlglDrawMesh in rlgl.o
  "_glDrawElements", referenced from:
      _DrawDefaultBuffers in rlgl.o
      _rlglDrawMesh in rlgl.o
  "_glEnable", referenced from:
      _rlEnableDepthTest in rlgl.o
      _rlglInit in rlgl.o
  "_glEnableVertexAttribArray", referenced from:
      _LoadDefaultBuffers in rlgl.o
      _DrawDefaultBuffers in rlgl.o
      _rlglLoadMesh in rlgl.o
      _rlglDrawMesh in rlgl.o
  "_glFramebufferTexture2D", referenced from:
      _rlglLoadRenderTexture in rlgl.o
  "_glFrontFace", referenced from:
      _rlglInit in rlgl.o
  "_glGenBuffers", referenced from:
      _LoadDefaultBuffers in rlgl.o
      _rlglLoadMesh in rlgl.o
  "_glGenFramebuffers", referenced from:
      _rlglLoadRenderTexture in rlgl.o
  "_glGenTextures", referenced from:
      _rlglLoadTexture in rlgl.o
      _rlglLoadRenderTexture in rlgl.o
  "_glGenVertexArrays", referenced from:
      _LoadDefaultBuffers in rlgl.o
      _rlglLoadMesh in rlgl.o
  "_glGenerateMipmap", referenced from:
      _rlglGenerateMipmaps in rlgl.o
  "_glGetAttribLocation", referenced from:
      _LoadDefaultShaderLocations in rlgl.o
  "_glGetFloatv", referenced from:
      _rlglInit in rlgl.o
  "_glGetIntegerv", referenced from:
      _rlglInit in rlgl.o
  "_glGetProgramInfoLog", referenced from:
      _LoadShaderProgram in rlgl.o
  "_glGetProgramiv", referenced from:
      _LoadShaderProgram in rlgl.o
  "_glGetShaderInfoLog", referenced from:
      _LoadShaderProgram in rlgl.o
  "_glGetShaderiv", referenced from:
      _LoadShaderProgram in rlgl.o
  "_glGetString", referenced from:
      _rlglInit in rlgl.o
  "_glGetStringi", referenced from:
      _rlglInit in rlgl.o
  "_glGetTexImage", referenced from:
      _rlglReadTexturePixels in rlgl.o
  "_glGetUniformLocation", referenced from:
      _rlglDrawMesh in rlgl.o
      _LoadDefaultShaderLocations in rlgl.o
      _GetShaderLocation in rlgl.o
  "_glLinkProgram", referenced from:
      _LoadShaderProgram in rlgl.o
  "_glPixelStorei", referenced from:
      _LoadCompressedTexture in rlgl.o
      _rlglReadTexturePixels in rlgl.o
  "_glPolygonMode", referenced from:
      _rlEnableWireMode in rlgl.o
      _rlDisableWireMode in rlgl.o
  "_glReadPixels", referenced from:
      _rlglReadScreenPixels in rlgl.o
  "_glShaderSource", referenced from:
      _LoadShaderProgram in rlgl.o
  "_glTexImage2D", referenced from:
      _rlglLoadTexture in rlgl.o
      _rlglLoadRenderTexture in rlgl.o
  "_glTexParameterf", referenced from:
      _rlTextureParameters in rlgl.o
  "_glTexParameteri", referenced from:
      _rlTextureParameters in rlgl.o
      _rlglLoadTexture in rlgl.o
      _rlglLoadRenderTexture in rlgl.o
      _rlglGenerateMipmaps in rlgl.o
  "_glTexParameteriv", referenced from:
      _rlglLoadTexture in rlgl.o
  "_glTexSubImage2D", referenced from:
      _rlglUpdateTexture in rlgl.o
  "_glUniform1f", referenced from:
      _rlglDrawMesh in rlgl.o
  "_glUniform1fv", referenced from:
      _SetShaderValue in rlgl.o
  "_glUniform1i", referenced from:
      _DrawDefaultBuffers in rlgl.o
      _rlglDrawMesh in rlgl.o
  "_glUniform1iv", referenced from:
      _SetShaderValuei in rlgl.o
  "_glUniform2fv", referenced from:
      _SetShaderValue in rlgl.o
  "_glUniform2iv", referenced from:
      _SetShaderValuei in rlgl.o
  "_glUniform3f", referenced from:
      _rlglDrawMesh in rlgl.o
  "_glUniform3fv", referenced from:
      _SetShaderValue in rlgl.o
  "_glUniform3iv", referenced from:
      _SetShaderValuei in rlgl.o
  "_glUniform4f", referenced from:
      _DrawDefaultBuffers in rlgl.o
      _rlglDrawMesh in rlgl.o
  "_glUniform4fv", referenced from:
      _SetShaderValue in rlgl.o
  "_glUniform4iv", referenced from:
      _SetShaderValuei in rlgl.o
  "_glUniformMatrix4fv", referenced from:
      _DrawDefaultBuffers in rlgl.o
      _rlglDrawMesh in rlgl.o
      _SetShaderValueMatrix in rlgl.o
  "_glUseProgram", referenced from:
      _UnloadDefaultShader in rlgl.o
      _DrawDefaultBuffers in rlgl.o
      _rlglDrawMesh in rlgl.o
      _SetShaderValue in rlgl.o
      _SetShaderValuei in rlgl.o
      _SetShaderValueMatrix in rlgl.o
  "_glVertexAttrib2f", referenced from:
      _rlglLoadMesh in rlgl.o
  "_glVertexAttrib3f", referenced from:
      _rlglLoadMesh in rlgl.o
  "_glVertexAttrib4f", referenced from:
      _rlglLoadMesh in rlgl.o
      _rlglDrawMesh in rlgl.o
  "_glVertexAttribPointer", referenced from:
      _LoadDefaultBuffers in rlgl.o
      _DrawDefaultBuffers in rlgl.o
      _rlglLoadMesh in rlgl.o
      _rlglDrawMesh in rlgl.o
  "_glViewport", referenced from:
      _rlViewport in rlgl.o
  "_glfwCreateWindow", referenced from:
      _InitGraphicsDevice in core.o
  "_glfwDefaultWindowHints", referenced from:
      _InitGraphicsDevice in core.o
  "_glfwDestroyWindow", referenced from:
      _CloseWindow in core.o
  "_glfwGetCursorPos", referenced from:
      _PollInputEvents in core.o
  "_glfwGetFramebufferSize", referenced from:
      _SetupViewport in core.o
  "_glfwGetJoystickAxes", referenced from:
      _PollInputEvents in core.o
  "_glfwGetJoystickButtons", referenced from:
      _PollInputEvents in core.o
  "_glfwGetJoystickName", referenced from:
      _GetGamepadName in core.o
  "_glfwGetKey", referenced from:
      _GetKeyStatus in core.o
  "_glfwGetMonitorName", referenced from:
      _SetWindowMonitor in core.o
  "_glfwGetMonitors", referenced from:
      _SetWindowMonitor in core.o
  "_glfwGetMouseButton", referenced from:
      _GetMouseButtonStatus in core.o
  "_glfwGetPrimaryMonitor", referenced from:
      _InitGraphicsDevice in core.o
      _ToggleFullscreen in core.o
      _SetWindowMinSize in core.o
  "_glfwGetProcAddress", referenced from:
      _InitGraphicsDevice in core.o
  "_glfwGetTime", referenced from:
      _GetTime in core.o
  "_glfwGetVideoMode", referenced from:
      _InitGraphicsDevice in core.o
      _SetWindowMinSize in core.o
  "_glfwGetVideoModes", referenced from:
      _InitGraphicsDevice in core.o
  "_glfwInit", referenced from:
      _InitGraphicsDevice in core.o
  "_glfwJoystickPresent", referenced from:
      _PollInputEvents in core.o
  "_glfwMakeContextCurrent", referenced from:
      _InitGraphicsDevice in core.o
  "_glfwPollEvents", referenced from:
      _PollInputEvents in core.o
  "_glfwSetCharCallback", referenced from:
      _InitGraphicsDevice in core.o
  "_glfwSetCursorEnterCallback", referenced from:
      _InitGraphicsDevice in core.o
  "_glfwSetCursorPos", referenced from:
      _SetMousePosition in core.o
  "_glfwSetCursorPosCallback", referenced from:
      _InitGraphicsDevice in core.o
  "_glfwSetDropCallback", referenced from:
      _InitGraphicsDevice in core.o
  "_glfwSetErrorCallback", referenced from:
      _InitGraphicsDevice in core.o
  "_glfwSetInputMode", referenced from:
      _DisableCursor in core.o
      _EnableCursor in core.o
      _ShowCursor in core.o
      _HideCursor in core.o
  "_glfwSetKeyCallback", referenced from:
      _InitGraphicsDevice in core.o
  "_glfwSetMouseButtonCallback", referenced from:
      _InitGraphicsDevice in core.o
  "_glfwSetScrollCallback", referenced from:
      _InitGraphicsDevice in core.o
  "_glfwSetWindowIcon", referenced from:
      _SetWindowIcon in core.o
  "_glfwSetWindowIconifyCallback", referenced from:
      _InitGraphicsDevice in core.o
  "_glfwSetWindowMonitor", referenced from:
      _ToggleFullscreen in core.o
      _SetWindowMonitor in core.o
  "_glfwSetWindowPos", referenced from:
      _InitGraphicsDevice in core.o
      _SetWindowPosition in core.o
  "_glfwSetWindowShouldClose", referenced from:
      _KeyCallback in core.o
  "_glfwSetWindowSizeCallback", referenced from:
      _InitGraphicsDevice in core.o
  "_glfwSetWindowSizeLimits", referenced from:
      _SetWindowMinSize in core.o
  "_glfwSwapBuffers", referenced from:
      _SwapBuffers in core.o
  "_glfwSwapInterval", referenced from:
      _InitGraphicsDevice in core.o
  "_glfwTerminate", referenced from:
      _InitGraphicsDevice in core.o
      _CloseWindow in core.o
  "_glfwWaitEvents", referenced from:
      _WindowShouldClose in core.o
  "_glfwWindowHint", referenced from:
      _InitGraphicsDevice in core.o
  "_glfwWindowShouldClose", referenced from:
      _WindowShouldClose in core.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [raylib] Error 1

I have glfw3 3.2.1 installed from homebrew. The static library compiles just fine.

@raysan5
Copy link
Owner

raysan5 commented Jul 17, 2017

Hi @define-private-public, when compiling as SHARED_RAYLIB you need to link with SHAREDLIBS. Those libraries are GLFW3 and OpenAL Soft. When you duplicate the Linux version for OSX, you should include $(SHAREDLIBS) and define a custom value for OSX:

SHAREDLIBS=-lglfw -framework OpenGL -framework OpenAL -framework Cocoa

I'm not an expert on OSX but try compiling with those libraries. Let me know if it works.

@raysan5
Copy link
Owner

raysan5 commented Jul 17, 2017

Just implemented those changes on commit 8f569e5

@raysan5 raysan5 changed the title Shared library on OS X [build] Shared library on OS X Jul 17, 2017
@define-private-public
Copy link
Contributor Author

Okay, I'll give it a whirl when I get home.

@define-private-public
Copy link
Contributor Author

define-private-public commented Jul 18, 2017

The commit didn't make it build properly. It couldn't locate the .so file. I added -L/usr/local/Cellar/glfw/3.2.1/lib to line 331 of src/Makefile. I'm not sure if that's the proper place to shove it, but then the .so file built fine. In the wiki, it says to installed glfw3 via homebrew, so that's were I got that -L location from.

As for building the examples, they didn't work off the bat either. I had to add that same -L flag to line 99 of examples/Makefile. I also needed to change line 34 RAYLIB_PATH ?= ../ and then they started to build.

They do run, but you need to run them from the root of examples/.

@define-private-public
Copy link
Contributor Author

Good & Bad news.

Good: I was able to get an experimental binding for Nim working.

Bad:

  1. When trying to run anything that was built with the .so, it's always looking for the .so in the folder ../release/osx. That's why I could only run the examples from say, examples/ and not examples/core. There has got to be some way to make it look for it in the current directory or elsewhere on the system.
  2. Some of the bound functions in Nim were giving me some trouble when trying to dynamically load the library. I think this is more of a Nim thing though.

@raysan5
Copy link
Owner

raysan5 commented Jul 18, 2017

Wow! Thanks for the report! It's great you manage to compile and use it!

Now I'm thinking how to integrate all those changes properly into Makefile... it seems a bit platform dependant... maybe the best option is just document it properly in the Wiki...

  1. When trying to run anything that was built with the .so, it's always looking for the .so in the folder ../release/osx. That's why I could only run the examples from say, examples/ and not examples/core. There has got to be some way to make it look for it in the current directory or elsewhere on the system.

Probably you can just configure OUTPUT_PATH in Makefile for every compiled program... but it doesn't look like the best solution...

Sorry, I'm not an expert on OSX, maybe someone could provide more information on this topic...

@raysan5 raysan5 added the help needed - please! I need help with this issue label Jul 18, 2017
@raysan5
Copy link
Owner

raysan5 commented Jul 18, 2017

Actually, it is an issue with paths on OSX...

Some info: https://stackoverflow.com/questions/27948093/include-search-path-on-mac-osx-yosemite-10-10-1

@define-private-public
Copy link
Contributor Author

I don't know that much about .so's files on OS X either. Let me see if I can summon someone who might be able to help.

@define-private-public
Copy link
Contributor Author

Okay, I got a response from him:

  1. OS X likes to use .dylibs instead of .so files, so we should try to build one of those instead for the Apple platform
  2. -Xlinker -rpath ${DIR_WITH_DYLIBS} needs to be used in the invocation of clang.

@define-private-public
Copy link
Contributor Author

this also might be relevant.

http://log.zyxar.com/blog/2012/03/10/install-name-on-os-x/

@raysan5
Copy link
Owner

raysan5 commented Jul 25, 2017

Just closing as per #336.

@raysan5 raysan5 closed this as completed Jul 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help needed - please! I need help with this issue
Projects
None yet
Development

No branches or pull requests

2 participants