I did a little bit investigation on this ScummVM with plugins -related problem and it seems that:
With plugins disabled, symbol mini_CurrentContext is "B" type and with plugins enabled, symbol mini_CurrentContext is "U" type.
You can check this with "nm scummvm | grep mini". If you enable verbose build in config.mk, you can see the difference between build flags.
It seems that for some reason, ScummVM core code is also built with -fPIC and this seems to affect the symbol type. For example I was able to crash one of my SDL test programs by building it with -fPIC and linking dynamically. I would expect that -fPIC was only enabled for library code.
Unfortunately, if you disable -fPIC in config.mk and rebuild graphics/opengl/context.cpp, the next issue will be dynamic_cast DSI.
I did a test today and tried to compile ScummVM with -Os instead of -O3 and while the static version builds fine and produce a working exe, the shared version error in linking state with thousands (probably one for every source file) undefined references, like so
audio/softsynth/mt32/libmt32.a(SampleRateConverter.o): In function `MT32Emu::SampleRateConverter::getBestAnalogOutputMode(double)':
SampleRateConverter.cpp:(.text+0x90): undefined reference to `_restfpr_30_x'
audio/softsynth/mt32/libmt32.a(SampleRateConverter.o): In function `MT32Emu::SampleRateConverter::SampleRateConverter(MT32Emu::Synth&, double, MT32Emu::SamplerateConversionQuality)':
SampleRateConverter.cpp:(.text+0x160): undefined reference to `_restfpr_31_x'
audio/softsynth/mt32/libmt32.a(SampleRateConverter.o): In function `MT32Emu::SampleRateConverter::getOutputSamples(short*, unsigned int)':
SampleRateConverter.cpp:(.text+0x2f8): undefined reference to `_restgpr_24_x'
gmake: *** [scummvm] Error 1
I dug a little on the net and found something mentioned from the gcc devs (but it was fixed in 2009 and the rest of the discussion went flying over my head),
Any hints?
Not that it really matters, i probably won't use -Os anyway since the save on binary size is a few tenthousand bytes on a 18 MB binary.
Just want to make sure there isn't something broken in our gcc.
@capehill
One more thing...you mentioned that using MAXPATHLEN might be suboptimal due to the path growing too big for the buffer. Do you have a more robust solution?
btw: Thank you for still caring for my noob problems
Thanks. It seems that my proposal was to make sure that buffer overflow doesn't happen during path concatenation. Snprintf is safer than sprintf because programmer can define the maximum buffer size.
No, not really, the longest I can come up with yet are around 70 chars.
I just though because you mentioned that it may cause a path buffer overflow if patches become too long...tgen again that whole thing was aimed at the printf?
1) I get this warning, which is not true. How can i work around that to get shared builds? Quote:
CMake Warning (dev) at CMakeLists.txt:2297 (add_library): ADD_LIBRARY called with SHARED option but the target platform does not support dynamic linking. Building a STATIC library instead. This may lead to problems.
2) How to enable altivec? It's always turned off, due to a message telling altivec is not available (on the cross platform not, true, but how can i force-enable that, because i do have altivec on my native paltform)?
3) I immediately get these errors, how to resolve?
In file included from /amiga/porting/SDL2_GL4ES/include/SDL_log.h:40,
from /amiga/porting/SDL2_GL4ES/src/./SDL_internal.h:120,
from /amiga/porting/SDL2_GL4ES/src/SDL.c:21:
/amiga/porting/SDL2_GL4ES/include/SDL_stdinc.h:466:49: error: unknown type name âwchar_tâ
466 | extern DECLSPEC size_t SDLCALL SDL_wcslen(const wchar_t *wstr);
| ^~~~~~~
4) I thought our gcc11 was c++11 aware? Quote:
-- Checking if compiler supports C++ unique_ptr - no CMake Error at CMakeLists.txt:112 (message): The C++ compiler does not support C++11 (e.g. std::unique_ptr).
5) Any way to workaround the below? Quote:
*** Warning: inter-library dependencies are not known to be supported. *** All declared inter-library dependencies are being dropped. *** The inter-library dependencies that have been dropped here will be *** automatically added whenever a program is linked with this library *** or is declared to -dlopen it.
*** Since this library must not contain undefined symbols, *** because either the platform does not support them or *** it was explicitly requested with -no-undefined, *** libtool will only create a static version of it.