Closed cen1 closed 8 years ago
Well, "broken" is not the correct word. A build for FreeBSD was never available. And given that you are the first one in about 10 years concerned about it, it's not gonna be a big deal :-)
I am not a BSD user, not programmer, so if you want a BSD build, feel free to add the missing defines into CMakeLists.txt (you can also create your own makefile as well). I'll gladly add them into the main branch, but I am unable to verify the building process.
On the other hand, the code base is fairly stable (not much changes lately), as the MPQ format is dying anyway.
I'll try to set the platform macro to Mac or Linux when FreeBSD is detected and see if that goes through. Hopefully that works because if it does not, BSD specific defines will need to be added to the source.
Btw, we are using StormLib on FreeBSD for years. :)
Unrelated but your site doesn't load on chrome on android (just eternal spinning gear) On 24 May 2016 08:27, "cen1" notifications@github.com wrote:
I'll try to set the platform macro to Mac or Linux when FreeBSD is detected and see if that goes through. Hopefully that works because if it does not, BSD specific defines will need to be added to the source.
Btw, we are using StormLib on FreeBSD for years. :)
— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/ladislav-zezula/StormLib/issues/73#issuecomment-221187825
Btw, we are using StormLib on FreeBSD for years. :)
Ok. If you make changes to the makefiles for FreeBSD, let me know, I'll add them to the code base.
Unrelated but your site doesn't load on chrome on android (just eternal spinning gear)
Well, it does load on my Chrome on Android, pretty fast :-)
Ok, apparently the only problem is FileStream.cpp and *64 stream functions. If I rename them to regular non-64 versions it compiles without problems as a Linux target. I am yet to find the info whether 64 bit headers are available on FreeBSD.
Edit: My impression is that *64 style functions should not be used at all. Instead, regular naming convention should be used together with _FILE_OFFSETBITS macro which uses 64bit behind the scenes. https://en.wikipedia.org/wiki/Stat(system_call)
Thoughts?
@ladislav-zezula gentle poke
(COMMENT DELETED)
I am not a big fan of changing the current Linux code just because FreeBSD needs something else. The code there has been there for years and works. What about to add a new #ifdef blocks into FileStream.h and FileStream.cpp (and possibly StormPort.h):
// Add read/write/seek code for FreeBSD
Well, if my theory is correct, the changed code will work completely the same. Just needs to be tested. I found additional info for stat64: "The glibc stat() wrapper function hides these details from applications, invoking the most recent version of the system call provided by the kernel, and repacking the returned information if required for old binaries." So, if stat64() is available it will be used when stat() is used in the code.
Anyway, where do I find the test MPQ files to run the tests on (test/README.txt)? Are they available for download anywhere? I will prepare a pull request and you can let it bake for a while. I want to make sure all tests pass and I'll also use the patched version on our production ghost bots to see if anything was affected.
edit: I'll also make an #ifdef version just in case. edit2: specifically need to test on files>4GB
Ok, I figured out the simplest solution for now: it is possible to override function names at compiler level, so a simple ifdef for freebsd in cmake should do it: set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DO_LARGEFILE -Dstat64=stat -Dlstat64=lstat -Dlseek64=lseek -Doff64_t=off_t -Dfstat64=fstat -Dftruncate64=ftruncate
I'll prepare a pull.
Merged.
I've been testing my new project (http://cross.build) with StormLib and it seems that FreeBSD build is broken due to a missing define. Seems to be hidden behind a PLATFORM_MAC macro in StormPort.h.
Build commands:
Result:
Same using g++5 just to be sure:
cmake -DCMAKE_CXX_COMPILER=/usr/local/bin/g++5 -DCMAKE_C_COMPILER=/usr/local/bin/gcc5 -G "Unix Makefiles" -H./ -B./build && cd build && make