• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Code not working on new server

Red Squirrel

No Lifer
I have this program which unfortunately uses dependencies, I'd have to code my own sql connector to get away from that. And this is the reason why I hate using dependencies... for whatever reason something stopped working despite the code not changing. It's a pretty big program so it would be hard to post the whole thing but I'm hoping someone can make sense of this error:

Code:
In file included from sources.h:1,
                 from poller.cpp:35:
includes/ShardListEntry.cpp: In member function ‘void ShardListEntry::Poll()’:
includes/ShardListEntry.cpp:55: error: size of array ‘m_row’ has non-integral type ‘const char [13]’

This is line 55:
Code:
SocketClient client(string(m_row["slogonserver"]),(int)m_row["slogonport"]);

m_row is a Row which is part of the mysql++ library, which is what is giving me trouble, they probably went and changed something.


the first argument of client takes a string and the second one takes an int. The expected result of the first row entry is a string and second result is an int.

This worked before, but something must have changed.

Anyone familiar with mysql++ library could tell me why it's doing this?
 
Last edited:
I commented out that section and hard coded stuff as a temp fix, and now I get tons of link related errors. This app is pretty much a disaster on that server so I'll have to rewrite it in such a way that I don't need dependencies. Gave up on it. Every time I need to transfer that app on another server I get issues, so it's time to just pack it in and rewrite it properly with no dependencies.
 
Yeah my first thought was that either it got built with a different version of the compiler, or an incompatible lib/obj got linked. Hard to say much without a lot more context.

Btw, avoiding this situation is a main benefit of Docker. You should check it out.
 
Well chances are it is a different compiler version but I don't really have control over that, it's whatever comes with the distro/yum repos and it's a newer distro. One grippe I have with Linux as well is the lack of consistency. They don't seem to all put the libs in the same places and that breaks everything too when trying to move code that has dependencies and they seem to randomly deprecate stuff that further breaks more things.

I commented out the offending code (which works fine on the other server) just to see what happens but then I get link errors with the Pngwriter dependency saying that it's not compatible with that version:

Code:
/usr/bin/ld: skipping incompatible /usr/local/lib/libpngwriter.a when searching for -lpngwriter
/usr/bin/ld: skipping incompatible /usr/local/lib/libpngwriter.a when searching for -lpngwriter
/usr/bin/ld: cannot find -lpngwriter

But that's the latest version! (has not been updated since like 2009) I hate dealing with dependencies because of this kind of issues and inconsistencies between distros.

I typically try to code stuff in a way that it's strictly a bunch of .cpp and .h files that don't rely on anything else but for this particular app I could not do it because of the need for the sql connector and the png library. I'll have to figure out a way around it though.

Could be a while till I get this old code to work so think I'll have to rewrite it... I can probably pipe some data through php to interact with mysql as well as the png stuff, kind of dirty but it will be a quick way to get up and running again till I can find a better way.
 
Last edited:
Well chances are it is a different compiler version but I don't really have control over that, it's whatever comes with the distro/yum repos and it's a newer distro. One grippe I have with Linux as well is the lack of consistency. They don't seem to all put the libs in the same places and that breaks everything too when trying to move code that has dependencies and they seem to randomly deprecate stuff that further breaks more things.
But that's the latest version! (has not been updated since like 2009) I hate dealing with dependencies because of this kind of issues and inconsistencies between distros.

I typically try to code stuff in a way that it's strictly a bunch of .cpp and .h files that don't rely on anything else but for this particular app I could not do it because of the need for the sql connector and the png library. I'll have to figure out a way around it though.

Could be a while till I get this old code to work so think I'll have to rewrite it... I can probably pipe some data through php to interact with mysql as well as the png stuff, kind of dirty but it will be a quick way to get up and running again till I can find a better way.

If you have dependencies on third party libraries, then you should simply use/include the version of the libraries that you coded your application to use with your application install (i.e. you have an installation directory for your app/program, like "/usr/local/myapp", under which you have a "lib" directory in which you place all your third party libs that you used which you depend on for your application, and when you compile your code, you make sure to have that lib directory placed in the runtime search path for library files).

If you really want to be certain, then you can always staticly link the libraries, but that makes for much larger executables.

Welcome to programming 101 for Unix/Linux, you just learned the hard way why you need to do what I just wrote above.
 
Last edited:
That's mostly all greek to me, how would I do that? I normally follow whatever instructions come with the library (how to install) and what compile string to add to g++ when compiling. Unfortunately it seems lot of those parameters are distro specific. Some of them I guessed at and changed, like since this is a 64 bit distro and the old server was 32, there was one path going to a certain folder so I just made it go to lib64 instead of lib. But that's all guess work and it did not do anything. The Mysql++ lib is something that is installed through yum so I don't really have any control over where it goes or even know where I'd look if I wanted to move it. The pngwriter one has not been updated since like 2009, but I was looking into trying to avoid it anyway and either use libpng directly or write my own that is a simple header file without a library.

Come to think of it, is there a way to convert libraries into simple header files? That way it does not need to link a special way or do anything special, it just works if I include the files.

How would I go about statically linking, would that make it more like a windows exe where it works on any system? If yes that'e EXACTLY what I need. I don't care if the exe is 1GB or 10GB, if it's guaranteed to work, then that's exactly what I want to do. Perhaps I can compile it statically on my dev server then upload it to prod and it will just work. If it can be that easy I'll do what it takes.
 
Back
Top