Skip to content

Conversation

@hungte
Copy link
Contributor

@hungte hungte commented Apr 19, 2013

A few commits to allow compiling on FreeBSD, verified on FreeBSD 9 with clang.

@AtnNn
Copy link
Member

AtnNn commented Apr 19, 2013

This is awesome! Does it build and run on FreeBSD? I'm going to try it out today.

@mglukhovsky
Copy link
Member

@hungte, could you please fill out our contributor agreement form (www.rethinkdb.com/community/cla/)-- you only have to do it once. Thanks for the pull request!

@mglukhovsky
Copy link
Member

Thanks, @hungte. I'll leave it to @AtnNn to finish reviewing the changes before we merge it in. We really appreciate the effort you've put forward, can't wait to include FreeBSD on the list of supported platforms!

@hungte
Copy link
Contributor Author

hungte commented Apr 20, 2013

atnnn> Yes it does. See my comment in commit 2cd2c77 - verified with 1.4.3 on FreeBSD 9, with pre-compiled web.
You need, however, to configure with CXX=clang and modify some settings in custom.mk as 2cd2c77 listed -
ALLOW_WARNINGS := 1
LIBRARY_PATHS += -lrt
CXX := ccache /usr/local/bin/clang -I/usr/local/include -D__STDC_LIMIT_MACROS

mglukhovsky> I'm a little concerned about the Travis build failure above - not sure if I've broken anything for Linux, or if it's temporary failure not related to my patches. Maybe I should get a Linux box and have a try...

@mglukhovsky
Copy link
Member

@hungte, noted, @AtnNn will be able to help parse those unit test failures. You could try a Linux box, or building on a VM if you'd like to dig into yourself and rerun those unit tests.

@ghost ghost assigned AtnNn Apr 20, 2013
@hungte
Copy link
Contributor Author

hungte commented Apr 20, 2013

The Travis failure seems not related to this patch since other people are seeing same failure.

Updated some build env changes so that LIBRARY_PATHS and -I/usr/local/include -D__STDC_LIMIT_MACROS are no longer required.

Step to test updated in commit 1539e00 description. Note there is no freebsd "ports" yet, so you still need to manually install all dependency stuff, or using precompiled web assets (which is a lot easier)

@AtnNn
Copy link
Member

AtnNn commented Apr 20, 2013

I got it to work. Thanks for your efforts :D

info: Running rethinkdb 1.4.3-940-gf8fb58-dirty (CLANG 3.1 ((branches/release_31 156863)))...                                                                                           
info: Running on FreeBSD 9.1-RELEASE amd64

It's nice to see all your commits, you seem to know what you are doing very well.

Here are the dependencies I had to install on FreeBSD 9.1:

pkg_add -r wget gcc48 protobuf protobuf-c v8 openjdk7 boost-all gmake bash clang
pkg_add -r node npm py-yaml
npm install -g less coffee-script handlebars

I tried with gcc48, but there seemed to be a lot of #include's missing, so I stuck with clang.

I had a few troubles getting the test suite to run, I put a few changes in 6fe0a1a.

I only saw four unit tests fail:

ClusteringBranch.Backfill:

src/unittest/clustering_branch.cc:246: Failure
Value of: store2.store.values[it->first]
  Actual: "7"
Expected: it->second
Which is: "12"

RPCDirectoryTest and RPCMailboxTest:

error: Error in src/arch/io/io_utils.cc at line 21:
error: Guarantee failed: [res == 0]  (errno 54 - Connection reset by peer) error returned by close(2)
error: Backtrace:
1: 0x18d6e53 <format_backtrace(bool)+51> at /usr/home/teapot/rethinkdb/build/debug_clang_notcmalloc/rethinkdb-unittest
2: 0x2046821 <report_fatal_error(char const*, int, char const*, ...)+625> at /usr/home/teapot/rethinkdb/build/debug_clang_notcmalloc/rethinkdb-unittest
3: 0x18a8c1a <scoped_fd_t::reset(int)+218> at /usr/home/teapot/rethinkdb/build/debug_clang_notcmalloc/rethinkdb-unittest
4: 0x18a6986 <scoped_fd_t::~scoped_fd_t()+22> at /usr/home/teapot/rethinkdb/build/debug_clang_notcmalloc/rethinkdb-unittest5: 0x18914e5 <scoped_fd_t::~scoped_fd_t()+21> at /usr/home/teapot/rethinkdb/build/debug_clang_notcmalloc/rethinkdb-unittest                     

And the SnapshotsTest took too long, so I killed it.

@hungte
Copy link
Contributor Author

hungte commented Apr 20, 2013

I've changed "Fix stack_t.ss_sp type difference for FreeBSD." to a better implementation by typeof.
Please re-check 8e5ca2a again.

@AtnNn
Copy link
Member

AtnNn commented Apr 22, 2013

@srh can you take a look at this pull request?

@hungte I would love to merge this, but I would like to get the tests to pass on FreeBSD first. I'll try to help but I'll be a little busy working on other things this week.

@hungte
Copy link
Contributor Author

hungte commented Apr 23, 2013

@AtnNn Of course - we should pass unit tests to make sure nothing is broken -- although maybe some failures are already in current master branch...
P.S: How to start the unit tests on FreeBSD? I tried make test-dep(s) but it simply failed.

@AtnNn
Copy link
Member

AtnNn commented Apr 23, 2013

To run the tests in debug mode, make unit DEBUG=1 or make DEBUG=1; ./build/debug*/rethinkdb-unittest.

I had to patch gtest to get the tests to build: 6fe0a1a

@AtnNn
Copy link
Member

AtnNn commented Apr 23, 2013

The failures in our next branch on travis are due to the python driver tests. All the unit tests currently pass.

@coffeemug
Copy link
Contributor

@hungte -- wow, this rocks! Thank you for the contribution!

@AtnNn, @al3xandru -- if this makes it into 1.5, we should * definitely* add docs for it, and point it out in the changelog and announcement. I'm slating it for 1.5 for now, feel free to take out if it doesn't make it (but pretty please, could it make it? :-D)

@coffeemug
Copy link
Contributor

@AtnNn -- our tests are now fixed (at least the errors that showed up here). Could we retest and merge?

@AtnNn
Copy link
Member

AtnNn commented Apr 30, 2013

@coffeemug the tests need to pass on both Travis and FreeBSD before we can safely merge this.

On Wednesday our sprint will be over and I'll take a closer look at why they are failing.

@mglukhovsky
Copy link
Member

Hey @hungte, just wanted to let you know that we're super-excited about getting FreeBSD support in, but we're also in the midst of shipping 1.5. We're working to figure out what needs to be done to get tests pass. Thanks for your patience!

@kudos
Copy link

kudos commented May 11, 2013

Hey @hungte, thanks for the great work here.

I'm not sure whether this issue is FreeBSD specific or not but it fails for me due to a missing directory (drivers/javascript/build). Creating it manually first solves the issue and I have it compiling successfully on 9.1.

Edit: Actually, just building again for a local Vagrant box and remembered some additional steps I needed, I had to symlink /usr/local/bin/bash to /bin/bash and use --lib-path /usr/local/lib

@hungte
Copy link
Contributor Author

hungte commented May 15, 2013

Hi @kudos,

Added a commit to fix drivers/javascript/build ( c9606b3 ).

For /bin/bash, applying atnnn's patch may help (or after you rebase).

Do you remember where you failed without --lib-path /usr/local/lib? I added /usr/local/lib in one mk file but maybe there's somewhere else (ex, some drivers or modules that I didn't build) to be modified...

@hungte
Copy link
Contributor Author

hungte commented May 15, 2013

After rebasing to latest "next" branch, I keep seeing "no std::move' error that is probably caused by c++11 related stuff, or libc++. It's fixed on MacOSX, but I haven't found a good solution for FreeBSD yet.

So I revised the commits to work with gcc48 and made it built successfully again :)

@kudos
Copy link

kudos commented May 15, 2013

The error I get on ./configure without using --lib-path looks like:

* Error: libprotobuf not found
/usr/bin/ld: cannot find -lprotobuf

I'll try building from your latest commit later today.

@hungte
Copy link
Contributor Author

hungte commented May 15, 2013

@coffeemug Yes it is (not searching /usr/local/lib by default).
I've already included that part in 10c54b7 .

@jdoliner
Copy link
Contributor

What are we planning to do once we merge this in to make sure we don't break FreeBSD compilation? Can we get an automated test going for it?

@AtnNn
Copy link
Member

AtnNn commented May 16, 2013

Can get an automated test going for it?

Yes, good idea

hungte added 14 commits May 17, 2013 15:17
Protoc-js does not always create folder for given output path. We need
to create it explicitly in build procedure.
When using clang3.1/-std=c++0x, the casting of NULL will cause error:
 reinterpret_cast from 'nullptr_t' to 'memcached_value_t *' is not
 allowed.

For c++11, NULL (nullptr) is defined as nullptr_t and should not be
re-casted to other pointer types.
install(1) on FreeBSD does not allow reading file content from
/dev/stdin, so we must create a real file in build directory before
calling install.
Required by boost library.
The C++ ABI v1 on FreeBSD 9.x clang is different with GCC 4.x ABI v1.
Requires FreeBSD 9.1 (clang 3.1+) and the libc++ from
/usr/src/lib/libc++.
For systems using ldconfig with different syntax (ex, FreeBSD or
MacOSX), we need to fallback LD path to defaults.
Tested on FreeBSD 9.1 with following steps:

 # For dependency
 pkg_add -r wget protobuf protobuf-c v8 openjdk7 boost-all gmake
 pkg_add -r bash node npm py-yaml gcc48
 npm install -g less coffee-script handlebars

 # To build with GCC48:
 CXX=gcc48 ./configure --ccache
 # Edit config.mk to add "ALLOW_WARNINGS := 1"

 # To build with system clang 3.1:
 CXX=clang ./configure --ccache
 # You have to install system libc++ by:
 #  cd /usr/src/lib/libc++; sudo make install
 # Then edit config.mk to add "ALLOW_WARNINGS := 1"

 # To build
 gmake
@hungte
Copy link
Contributor Author

hungte commented May 17, 2013

Added some fixes so clang3.1/c++11 (need the libc++ in FreeBSD 9.1 source tree) won't fail to build.

@AtnNn
Copy link
Member

AtnNn commented May 17, 2013

@hungte I have a freebsd VM open, I'll try to help you with this branch today.

@AtnNn
Copy link
Member

AtnNn commented Jun 18, 2013

I rebased this onto next and added a few patches in the atnnn/freebsd branch: https://github.com/rethinkdb/rethinkdb/compare/atnnn;freebsd

It builds with

./configure CXX=g++47 --static none --without-tcmalloc --ccache CXXFLAGS='-std=c++11'
gmake

But fails to run

info: Loading data from directory /usr/home/user/rethinkdb/rethinkdb_data
Version: rethinkdb 1.6.0-50-gb60da6-dirty (GCC 4.7.3)
Version: rethinkdb 1.6.0-50-gb60da6-dirty (GCC 4.7.3)
Version: rethinkdb 1.6.0-50-gb60da6-dirty (GCC 4.7.3)
Version: rethinkdb 1.6.0-50-gb60da6-dirty (GCC 4.7.3)
Version: rethinkdb 1.6.0-50-gb60da6-dirty (GCC 4.7.3)
error: Error in src/arch/runtime/thread_pool.cc at line 325:
error: Error in src/arch/runtime/thread_pool.cc at line 325:
error: Segmentation fault from reading the address 0x5d.
Version: rethinkdb 1.6.0-50-gb60da6-dirty (GCC 4.7.3)
Version: rethinkdb 1.6.0-50-gb60da6-dirty (GCC 4.7.3)
error: Error in src/arch/runtime/thread_pool.cc at line 325:
error: Segmentation fault from reading the address 0x5d.
error: Backtrace:
error: Segmentation fault from reading the address 0x5d.
error: Backtrace:
error: Backtrace:
Segmentation fault: 11 (core dumped)

@AtnNn
Copy link
Member

AtnNn commented Jun 18, 2013

With DEBUG=1, the server runs and the web ui works. Simple operations like insert fail. Here are all the failing unit tests: https://gist.github.com/atnnn/dcbccf0bc39349d1820f

@AtnNn
Copy link
Member

AtnNn commented Jun 25, 2013

Someone who is more familiar with the code failing in these tests should take a look at this.

@danielmewes
Copy link
Member

Unless some part of the networking isn't working properly, from what I can see these failure might just have to do with timing issues (heartbeat timeouts) in the tests, and the unit tests not being prepared for those.
@AtnNn Do you still have a FreeBSD VM running somewhere? I would find it interesting to re-test this with the current code base in next.

@danielmewes
Copy link
Member

I merged next into @AtnNn's freebsd branch. If I compile in release mode, there now is a problem with hostname lookup. This is probably because a lot of that code has changed, and needs to be adapted to FreeBSD.
If I compile in debug mode, a newly created table never becomes available. I think this might have to do with the changed message hub, but that's just a hypothesis.

@AtnNn
Copy link
Member

AtnNn commented Jun 17, 2014

None of us use FreeBSD and we don't have the resources to keep this branch up-to-date.

@hungte hopefully we can resurrect it some day.

@AtnNn AtnNn closed this Jun 17, 2014
@AtnNn AtnNn modified the milestones: backlog, wontfix Jul 30, 2014
@srh srh mentioned this pull request Aug 28, 2022
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants