scottdraves / electricsheep

infinite evolving crowdsourced artwork
http://electricsheep.org
561 stars 70 forks source link

Build fails on FreeBSD #72

Closed yurivict closed 5 years ago

yurivict commented 6 years ago

I'm trying to restore the FreeBSD port, but it fails with these link messages:

../DisplayOutput/OpenGL/glx.cpp:(.text+0x57b): undefined reference to `_GLEE_GLX_SGI_swap_control'
../DisplayOutput/OpenGL/glx.cpp:(.text+0x580): undefined reference to `GLeeEnabled'
../DisplayOutput/OpenGL/glx.cpp:(.text+0x58f): undefined reference to `pglXSwapIntervalSGI'
glx.o: In function `DisplayOutput::CUnixGL::toggleVSync()':
../DisplayOutput/OpenGL/glx.cpp:(.text+0xa46): undefined reference to `_GLEE_GLX_SGI_swap_control'
../DisplayOutput/OpenGL/glx.cpp:(.text+0xa4b): undefined reference to `GLeeEnabled'
../DisplayOutput/OpenGL/glx.cpp:(.text+0xa5a): undefined reference to `pglXSwapIntervalSGI'
ShaderGL.o: In function `DisplayOutput::CShaderGL::~CShaderGL()':
../DisplayOutput/OpenGL/ShaderGL.cpp:(.text+0x4a): undefined reference to `pglDeleteObjectARB'
../DisplayOutput/OpenGL/ShaderGL.cpp:(.text+0x57): undefined reference to `pglDeleteObjectARB'
../DisplayOutput/OpenGL/ShaderGL.cpp:(.text+0x64): undefined reference to `pglDeleteObjectARB'
ShaderGL.o: In function `DisplayOutput::CShaderGL::~CShaderGL()':
../DisplayOutput/OpenGL/ShaderGL.cpp:(.text+0xaa): undefined reference to `pglDeleteObjectARB'
../DisplayOutput/OpenGL/ShaderGL.cpp:(.text+0xb7): undefined reference to `pglDeleteObjectARB'
ShaderGL.o:../DisplayOutput/OpenGL/ShaderGL.cpp:(.text+0xc4): more undefined references to `pglDeleteObjectARB' follow
ShaderGL.o: In function `DisplayOutput::CShaderGL::Bind()':
../DisplayOutput/OpenGL/ShaderGL.cpp:(.text+0x119): undefined reference to `pglUseProgramObjectARB'
ShaderGL.o: In function `DisplayOutput::CShaderGL::Unbind()':
../DisplayOutput/OpenGL/ShaderGL.cpp:(.text+0x348): undefined reference to `pglUseProgramObjectARB'
ShaderGL.o: In function `DisplayOutput::CShaderGL::Build(char const*, char const*)':
../DisplayOutput/OpenGL/ShaderGL.cpp:(.text+0x38c): undefined reference to `_GLEE_ARB_shading_language_100'
../DisplayOutput/OpenGL/ShaderGL.cpp:(.text+0x391): undefined reference to `GLeeEnabled'
../DisplayOutput/OpenGL/ShaderGL.cpp:(.text+0x471): undefined reference to `pglCreateProgramObjectARB'
../DisplayOutput/OpenGL/ShaderGL.cpp:(.text+0x490): undefined reference to `pglCreateShaderObjectARB'
../DisplayOutput/OpenGL/ShaderGL.cpp:(.text+0x4d3): undefined reference to `pglShaderSourceARB'
../DisplayOutput/OpenGL/ShaderGL.cpp:(.text+0x4dd): undefined reference to `pglCompileShaderARB'
../DisplayOutput/OpenGL/ShaderGL.cpp:(.text+0x4f3): undefined reference to `pglGetObjectParameterivARB'
../DisplayOutput/OpenGL/ShaderGL.cpp:(.text+0x50a): undefined reference to `pglAttachObjectARB'
../DisplayOutput/OpenGL/ShaderGL.cpp:(.text+0x572): undefined reference to `pglGetInfoLogARB'
../DisplayOutput/OpenGL/ShaderGL.cpp:(.text+0x594): undefined reference to `pglCreateShaderObjectARB'
../DisplayOutput/OpenGL/ShaderGL.cpp:(.text+0x5db): undefined reference to `pglShaderSourceARB'
../DisplayOutput/OpenGL/ShaderGL.cpp:(.text+0x5e5): undefined reference to `pglCompileShaderARB'
../DisplayOutput/OpenGL/ShaderGL.cpp:(.text+0x5fb): undefined reference to `pglGetObjectParameterivARB'
../DisplayOutput/OpenGL/ShaderGL.cpp:(.text+0x616): undefined reference to `pglAttachObjectARB'
../DisplayOutput/OpenGL/ShaderGL.cpp:(.text+0x650): undefined reference to `pglLinkProgramARB'
../DisplayOutput/OpenGL/ShaderGL.cpp:(.text+0x666): undefined reference to `pglGetObjectParameterivARB'
../DisplayOutput/OpenGL/ShaderGL.cpp:(.text+0x689): undefined reference to `pglGetInfoLogARB'
../DisplayOutput/OpenGL/ShaderGL.cpp:(.text+0x6d1): undefined reference to `pglUseProgramObjectARB'
../DisplayOutput/OpenGL/ShaderGL.cpp:(.text+0x6e7): undefined reference to `pglGetObjectParameterivARB'
../DisplayOutput/OpenGL/ShaderGL.cpp:(.text+0x6fd): undefined reference to `pglGetObjectParameterivARB'
../DisplayOutput/OpenGL/ShaderGL.cpp:(.text+0x77a): undefined reference to `pglGetActiveUniformARB'
../DisplayOutput/OpenGL/ShaderGL.cpp:(.text+0x79c): undefined reference to `pglGetUniformLocationARB'
../DisplayOutput/OpenGL/ShaderGL.cpp:(.text+0x7c2): undefined reference to `pglUniform1i'
../DisplayOutput/OpenGL/ShaderGL.cpp:(.text+0xb89): undefined reference to `pglGetUniformLocationARB'
../DisplayOutput/OpenGL/ShaderGL.cpp:(.text+0xd03): undefined reference to `pglUseProgram'
../DisplayOutput/OpenGL/ShaderGL.cpp:(.text+0xd66): undefined reference to `pglGetInfoLogARB'
ShaderGL.o: In function `DisplayOutput::CShaderUniformGL::SetData(void*, unsigned int)':
../DisplayOutput/OpenGL/ShaderGL.cpp:(.text+0xf25): undefined reference to `pglUniform1fvARB'
../DisplayOutput/OpenGL/ShaderGL.cpp:(.text+0xf33): undefined reference to `pglUniform2fvARB'
../DisplayOutput/OpenGL/ShaderGL.cpp:(.text+0xf41): undefined reference to `pglUniform3fvARB'
../DisplayOutput/OpenGL/ShaderGL.cpp:(.text+0xf4f): undefined reference to `pglUniform4fvARB'
../DisplayOutput/OpenGL/ShaderGL.cpp:(.text+0xf5d): undefined reference to `pglUniform1ivARB'
../DisplayOutput/OpenGL/ShaderGL.cpp:(.text+0xf6b): undefined reference to `pglUniform2ivARB'
../DisplayOutput/OpenGL/ShaderGL.cpp:(.text+0xf79): undefined reference to `pglUniform3ivARB'
../DisplayOutput/OpenGL/ShaderGL.cpp:(.text+0xf87): undefined reference to `pglUniform4ivARB'
../DisplayOutput/OpenGL/ShaderGL.cpp:(.text+0xfb1): undefined reference to `pglUniformMatrix2fvARB'
../DisplayOutput/OpenGL/ShaderGL.cpp:(.text+0xfbf): undefined reference to `pglUniformMatrix3fvARB'
../DisplayOutput/OpenGL/ShaderGL.cpp:(.text+0xfcd): undefined reference to `pglUniformMatrix4fvARB'
ShaderGL.o: In function `DisplayOutput::CShaderUniformGL::Apply()':
../DisplayOutput/OpenGL/ShaderGL.cpp:(.text+0x10af): undefined reference to `pglUniform1ivARB'
../DisplayOutput/OpenGL/ShaderGL.cpp:(.text+0x10c3): undefined reference to `pglUniform2ivARB'
../DisplayOutput/OpenGL/ShaderGL.cpp:(.text+0x10d7): undefined reference to `pglUniform4ivARB'
../DisplayOutput/OpenGL/ShaderGL.cpp:(.text+0x10eb): undefined reference to `pglUniform3ivARB'
../DisplayOutput/OpenGL/ShaderGL.cpp:(.text+0x10ff): undefined reference to `pglUniform1fvARB'
../DisplayOutput/OpenGL/ShaderGL.cpp:(.text+0x1110): undefined reference to `pglUniform2fvARB'
../DisplayOutput/OpenGL/ShaderGL.cpp:(.text+0x1121): undefined reference to `pglUniform3fvARB'
../DisplayOutput/OpenGL/ShaderGL.cpp:(.text+0x1132): undefined reference to `pglUniform4fvARB'
../DisplayOutput/OpenGL/ShaderGL.cpp:(.text+0x1148): undefined reference to `pglUniformMatrix2fvARB'
../DisplayOutput/OpenGL/ShaderGL.cpp:(.text+0x115e): undefined reference to `pglUniformMatrix3fvARB'
../DisplayOutput/OpenGL/ShaderGL.cpp:(.text+0x1174): undefined reference to `pglUniformMatrix4fvARB'
TextureFlatGL.o: In function `DisplayOutput::CTextureFlatGL::Upload(Base::CRefCountPtr<DisplayOutput::CImage, Base::CRefCountRep<DisplayOutput::CImage>, DisplayOutput::CImage*>)':
../DisplayOutput/OpenGL/TextureFlatGL.cpp:(.text+0x2ad): undefined reference to `pglCompressedTexImage2DARB'
../DisplayOutput/OpenGL/TextureFlatGL.cpp:(.text+0x35b): undefined reference to `_GLEE_ARB_texture_non_power_of_two'
../DisplayOutput/OpenGL/TextureFlatGL.cpp:(.text+0x360): undefined reference to `GLeeEnabled'
LuaState.o: In function `Base::Script::CLuaState::Init(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)':
../Common/LuaState.cpp:(.text+0x180): undefined reference to `lua_cpcall'
../Common/LuaState.cpp:(.text+0x190): undefined reference to `lua_cpcall'
LuaState.o: In function `Base::Script::Call(lua_State*, char const*, char const*, ...)':
../Common/LuaState.cpp:(.text+0xc48): undefined reference to `lua_tonumber'
../Common/LuaState.cpp:(.text+0xc88): undefined reference to `lua_tonumber'
LuaState.o: In function `Base::Script::docall(lua_State*, int, int)':
../Common/LuaState.cpp:(.text+0xe53): undefined reference to `lua_insert'
../Common/LuaState.cpp:(.text+0xe66): undefined reference to `lua_pcall'
../Common/LuaState.cpp:(.text+0xe73): undefined reference to `lua_remove'
LuaState.o: In function `Base::Script::CLuaState::Run(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)':
../Common/LuaState.cpp:(.text+0xec0): undefined reference to `luaL_loadfile'
../Common/LuaState.cpp:(.text+0xed5): undefined reference to `lua_pcall'
LuaState.o: In function `Base::Script::traceback(lua_State*)':
../Common/LuaState.cpp:(.text+0xff6): undefined reference to `lua_call'
luaxml.o: In function `luaopen_xml(lua_State*)':
../Common/luaxml.cpp:(.text+0x1af): undefined reference to `luaL_register'
c++: error: linker command failed with exit code 1 (use -v to see invocation)

lua-related messages likely mean that lua libs aren't supplied. But where do pglUniform1ivARB, GLeeEnabled, pglXSwapIntervalSGI come from?

stefantalpalaru commented 5 years ago

You need this library: https://sourceforge.net/projects/glee/

yurivict commented 5 years ago

@stefantalpalaru Thank you for the answer. libglee has some symbols, ex. GLeeEnabled, but not other symbols. For example pglCreateShaderObjectARB is still undefined.

stefantalpalaru commented 5 years ago

Try this patch, although the problem it fixes should manifest at compile time, not link time: https://github.com/stefantalpalaru/gentoo-overlay/commit/e2b3249a2e67dd8ec58eb6ed45847095a1f011a0#diff-46b6606a27533f9f54313ab2603da357

yurivict commented 5 years ago

I tried this patch, but there are still errors.

glx.o: In function `DisplayOutput::CUnixGL::Initialize(unsigned int, unsigned int, bool)':
glx.cpp:(.text+0x57f): undefined reference to `pglXSwapIntervalSGI'
glx.o: In function `DisplayOutput::CUnixGL::toggleVSync()':
glx.cpp:(.text+0xa4a): undefined reference to `pglXSwapIntervalSGI'
ShaderGL.o: In function `DisplayOutput::CShaderGL::~CShaderGL()':
ShaderGL.cpp:(.text+0x4a): undefined reference to `pglDeleteObjectARB'
ShaderGL.cpp:(.text+0x57): undefined reference to `pglDeleteObjectARB'
ShaderGL.cpp:(.text+0x64): undefined reference to `pglDeleteObjectARB'
ShaderGL.o: In function `DisplayOutput::CShaderGL::~CShaderGL()':
ShaderGL.cpp:(.text+0xaa): undefined reference to `pglDeleteObjectARB'
ShaderGL.cpp:(.text+0xb7): undefined reference to `pglDeleteObjectARB'
stefantalpalaru commented 5 years ago

What's the linking part of the make output? Just to make sure you're linking against libGL.so.

Alternatively, scroll up on that last link to see how I disabled V-sync because some Mesa drivers don't have that extension.

yurivict commented 5 years ago
libtool: link: c++ -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include/libgtop-2.0 -I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include -I/usr/local/include -I/usr/local/include/lua53 -I/usr/local/include -I/usr/local/include -I/usr/local/include/libpng16 -I/usr/local/include/lua53 -I/usr/local/include -D_THREAD_SAFE -pthread -D__STDC_CONSTANT_MACROS -Wno-write-strings -DHAVE_AVC_VID2=1 -O2 -pipe -fno-omit-frame-pointer -DLINUX_GNU -I/usr/local/include/libavcodec -I/usr/ports/graphics/electricsheep/work/electricsheep-4949c31/client_generic/DisplayOutput/OpenGL -DSHAREDIR=\"/usr/local/share/electricsheep\" -fstack-protector -isystem /usr/local/include -fno-strict-aliasing -fno-omit-frame-pointer -isystem /usr/local/include -fstack-protector -o electricsheep Player.o main.o Voting.o Hud.o Upload.o Download.o Networking.o LoadDDS.o Image.o RendererGL.o glx.o ShaderGL.o TextureFlatGL.o wgl.o FontGL.o mgl.o Shader.o Texture.o Font.o TextureFlat.o Renderer.o LoadPNG.o DisplayOutput.o tinyxmlparser.o tinyxml.o tinystr.o tinyxmlerror.o diriterator.o storage.o luastorage.o ContentDecoder.o SheepUploader.o ContentDownloader.o SheepGenerator.o SheepDownloader.o Sheep.o Shepherd.o LuaState.o Common.o AlignedBuffer.o isaac.o pool.o Log.o Rect.o luaxml.o Exception.o md5.o  -L/usr/local/lib -lavcodec -lavformat -lswscale -lavutil -llua-5.3 -lm -lGLee -lcurl -lpng16 -lz -lgtop-2.0 -lglib-2.0 -lintl -lXrender -lX11 -lrt -lGL -lglut -ltinyxml -lboost_system -lboost_filesystem -lboost_thread -pthread
stefantalpalaru commented 5 years ago

That looks OK. Go ahead and apply the other patch.

yurivict commented 5 years ago

The other patch didn't make any difference either.

It appears that symbols like pglCreateProgramObjectARB should come from libGLee.so, but it doesn't provide them.

yurivict commented 5 years ago

The problem was that GLee is also bundled, and the bundled header declares pglXX symbols, but never defines them. Bundling anything is a very bad idea.