# Compiling rtorrent from ports fails



## sub_mesa (Apr 1, 2011)

Hi guys,

I've been running rtorrent 0.86_1 or something I believe, on an older FreeBSD 8.0 i386 machine. At one point an update was available (0.87) - but compiling that using portupgrade failed.

During my attempts to solve the problem, I made a bad decision to remove the currently installed (and working!) package of rtorrent; and since then I am unable to build a working rtorrent binary again.

So here's what I tried:
- upgrading all packages (excluding mysql which is unrelated to rtorrent)
- forcefully reinstalling dependency packages (*portupgrade -f ...*)
- fetch precompiled package instead of port
- build and configure GCC 4.4.x; use that to reinstall all dependencies
- update to FreeBSD 8.2 i386

All this did not resolve or even affect my problem, however. The build always fails with:


```
libtool: link: g++44 -O2 -pipe -fno-strict-aliasing -DNDEBUG -I/usr/local/include/sigc++-2.0 -I/usr/local/lib/sigc++-2.0/include -
I/usr/local/include -I/usr/local/include -pthread -o rtorrent main.o  libsub_root.a ui/libsub_ui.a core/libsub_core.a display/libsub_display.a 
input/libsub_input.a rpc/libsub_rpc.a utils/libsub_utils.a -lncursesw -L/usr/local/lib /usr/local/lib/libcurl.so -lssl -lz 
/usr/local/lib/libtorrent.so -lcrypto /usr/local/lib/libsigc-2.0.so -pthread -Wl,-rpath -Wl,/usr/local/lib -Wl,-rpath -Wl,/usr/local/lib
libsub_root.a(thread_base.o): In function `ThreadBase::call_queued_items()':
thread_base.cc:(.text+0xc8): undefined reference to `__sync_bool_compare_and_swap_4'
libsub_root.a(thread_base.o): In function `ThreadBase::queue_item(void (*)(ThreadBase*))':
thread_base.cc:(.text+0x4c4): undefined reference to `__sync_bool_compare_and_swap_4'
thread_base.cc:(.text+0x5b0): undefined reference to `__sync_bool_compare_and_swap_4'
thread_base.cc:(.text+0x5bd): undefined reference to `__sync_bool_compare_and_swap_4'
libsub_root.a(thread_worker.o): In function `ThreadWorker::set_scgi(rpc::SCgi*)':
thread_worker.cc:(.text+0x907): undefined reference to `__sync_bool_compare_and_swap_4'
collect2: ld returned 1 exit status
*** Error code 1

Stop in /usr/ports/net-p2p/rtorrent/work/rtorrent-0.8.7/src.
*** Error code 1
```

Can you guys give me any suggestions? I feel very stupid for not having used *pkg_create -b* to backup the existing package; and there was no package available as well for FreeBSD 8.0. I did not try using the 8.2 package yet, but I really would want to find out the cause of this issue.

Any help is appreciated. Thanks in advance!


----------



## SirDice (Apr 1, 2011)

Don't use GCC 4.4, use the standard one in the base. Remove any CFLAGS and related settings from /etc/make.conf.


----------



## sub_mesa (Apr 1, 2011)

Thank you, will try that. I did that because the author of rtorrent said that GCC 4.1.2 could be the problem, in response to someone with the same compile errors.

I guess now that I updated to 8.2, I should use the base GCC again. Going to try that now.


----------



## SirDice (Apr 1, 2011)

The reason you should use the base compiler is that all the ports are tested with it. If you do use an alternative you are likely to run into build problems.


----------



## sub_mesa (Apr 1, 2011)

Managed to solve the problem by recompiling everything that I recompiled earlier using GCC 4.4.x. With base GCC and default /etc/libmap.conf and /etc/make.conf it worked; but I had to recompile some dependencies first.

Thanks for your help!


----------

