Cuberite Forum
freebsd compilation error - Printable Version

+- Cuberite Forum (https://forum.cuberite.org)
+-- Forum: Cuberite (https://forum.cuberite.org/forum-4.html)
+--- Forum: Development (https://forum.cuberite.org/forum-13.html)
+--- Thread: freebsd compilation error (/thread-1215.html)

Pages: 1 2


freebsd compilation error - xreprimand - 08-12-2013

Hi! I am trying to compile MCServer in my own server (Freebsd 9.1) from source code:
Code:
gmake -j3
here is last 3 lines with errors:
Code:
/usr/bin/g++ -s -ggdb -g -D_DEBUG -O3 -x c -c -I. -Isource -Isource/md5 -IWebServer -Isource/items -Isource/blocks -Itolua++-1.0.93/src/lib -Ilua-5.1.4/src -Izlib-1.2.7 -IiniFile -Itolua++-1.0.93/include -Ijsoncpp-src-0.5.0/include -Ijsoncpp-src-0.5.0/src/lib_json -Iexpat source/SQLite/sqlite3.c -o build/debug/source/SQLite/sqlite3.o
source/SQLite/sqlite3.c:23345: error: 'fchmod' undeclared here (not in a function)
gmake: *** [build/debug/source/SQLite/sqlite3.o] Error 1
I am using gmake (not make) because default "make" in Freebsd is not GNU-like
Sooo, can anyone help me? I dont want to change server OS for many reasons.

Tnx a lot.


RE: freebsd compilation error - bearbin - 08-12-2013

The fix is to include:

#include <sys/stat.h>

at the top of the affected file.

IDK much about C++, so I'm not going to do it, but you can try.

Anyway once we get this sorted out we can count freeBSD as a supported platform Smile

Edit: Hmm, this is strange. It's already included at line 22845, maybe it just needs to be at the top. IDK.


RE: freebsd compilation error - xreprimand - 08-12-2013

tnx for your reply
I removed #include from 22845 line and paste at the top of this file
When i am trying to compile i just getting
Code:
/usr/bin/g++ -s -ggdb -g -D_DEBUG -O3 -x c -c -I. -Isource -Isource/md5 -IWebServer -Isource/items -Isource/blocks -Itolua++-1.0.93/src/lib -Ilua-5.1.4/src -Izlib-1.2.7 -IiniFile -Itolua++-1.0.93/include -Ijsoncpp-src-0.5.0/include -Ijsoncpp-src-0.5.0/src/lib_json -Iexpat source/SQLite/sqlite3.c -o build/debug/source/SQLite/sqlite3.o
and nothing else happens
UPD 1:
Whou! It needs a little bit more time, seems like no more error in this file! Tnx a lot!)
UPD 2:
Here is something new: Sad
Code:
/usr/bin/ld: cannot find -ldl
gmake: *** [MCServer/MCServer] Error 1
UPD2.1:
I am going to update ports, I think it will help


RE: freebsd compilation error - bearbin - 08-12-2013

Sounds like a non gnu-compatible ld.


RE: freebsd compilation error - xreprimand - 08-12-2013

Ok, i found solution!!
Now i am trying to tell what i do step by step:

1) Here is no -ldl (libdl.so), freebsd uses -lltdl (libltdl.so). Check libtdl installation:
Code:
$ ls /usr/local/lib | grep libltdl
libltdl.a
libltdl.la
libltdl.so
libltdl.so.7
If u see nothing (0 lines) - install it
1.1)
Code:
$ whereis libltdl
libltdl: /usr/ports/devel/libltdl
$ cd /usr/ports/devel/libltdl
$ sudo make install clean
2) Edit GNUmakefile:
Code:
$ ls | grep make
GNUmakefile
$ ee GNUmakefile
Find "LNK_LIBS = -lstdc++ -ldl" and change -ldl to -lltdl
3) Copy (or create symlink) required libraries from /usr/local/lib to /usr/lib (because gmake usually dont like "third party libs" or something like this)

Compiling is done! Now i can cd to MCServer and type ./MCServer

Code:
[2007400|23:09:30] Starting server...
[57ad400|23:09:30] ServerTickThread
[2007400|23:09:30] Starting InputThread...
[2007400|23:09:30] Initialization done, server running now.
THANK YOU SO MUCH, bearbin ! =)
P.S. It was my first step by step guide, i hope it will help developers or users, sorry for my bad english


RE: freebsd compilation error - bearbin - 08-12-2013

I think the makefile should be modified to have platform specific stuff somehow, so we can fix the second issue you are having.

Actually, FreeBSD is supposed to have linux binary compatibility - is my linux build from my buildserver compatible?


RE: freebsd compilation error - xoft - 08-12-2013

Thanks for the report and the info.
I tried making the makefile os-specific, can you try SHA add99a8847d61ec5d48135b6e8503ff5a63c7c8e if it works out of the box?


RE: freebsd compilation error - xreprimand - 08-12-2013

(08-12-2013, 04:13 PM)bearbin Wrote: Actually, FreeBSD is supposed to have linux binary compatibility - is my linux build from my buildserver compatible?
I think its compatible, but i dont want to install linux_base_* port and etc. with it, because my freebsd machine is 24h online and used as server for many services.
(08-12-2013, 04:30 PM)xoft Wrote: Thanks for the report and the info.
I tried making the makefile os-specific, can you try SHA add99a8847d61ec5d48135b6e8503ff5a63c7c8e if it works out of the box?
Eh... i dont understand what did you mean. Can you explain what i should to do?
Also, if you need freebsd machine, i can give you ssh access.


RE: freebsd compilation error - NiLSPACE - 08-12-2013

I think he wants you to try the source from this commit or above https://github.com/mc-server/MCServer/commit/add99a8847d61ec5d48135b6e8503ff5a63c7c8e


RE: freebsd compilation error - xreprimand - 08-12-2013

It does not work
Here is full compilation log: http://xdevelnet.org/compllog.txt
I will try to do something in GNUmakefile


It works, i forgot to delete old file Smile