GithubHelp home page GithubHelp logo

Comments (21)

rakshasa avatar rakshasa commented on June 14, 2024

Considering I've recently upgraded this should get fixed soon.

ATM use the macports clang to compile.

from libtorrent.

rakshasa avatar rakshasa commented on June 14, 2024

BTW, I'm pretty sure the union above was added since it is supposed to be supported by C++11.

Need to look into the copy constructor part.

from libtorrent.

mistydemeo avatar mistydemeo commented on June 14, 2024

ATM use the macports clang to compile.

The system clang also works in libstdc++ mode, this is specifically a libc++ issue. If Macports's clang works, I imagine it's because it's defaulting to libstdc++.

from libtorrent.

ahaghgoo avatar ahaghgoo commented on June 14, 2024

So if I upgraded to Mavericks and installed rtorrent via MacPorts, would libtorrent "build" (I'm a layman to the world of developers)?

from libtorrent.

clarkewd avatar clarkewd commented on June 14, 2024

so just to check - there is still no way to build rtorrent on mavericks even though this commit says:

libtorrent: use libstdc++ if compiling with clang on mavericks, fixes

right? I can't get it to compile even after trying with that added line...

from libtorrent.

mistydemeo avatar mistydemeo commented on June 14, 2024

@clarkewd Can you discuss Homebrew issues on the Homebrew tracker? The issue is Homebrew/legacy-homebrew#23483

from libtorrent.

rakshasa avatar rakshasa commented on June 14, 2024
CC=clang CXX=clang++ CXXFLAGS="-Wno-deprecated-declarations -O3 -std=c++11 -stdlib=libc++" ./configure

With these settings I could compile with C++11 check succeeding.

from libtorrent.

Blub avatar Blub commented on June 14, 2024

There are several issues there with clang 3.3. Here's what I use on ArchBSD to build it:
https://github.com/ArchBSD/abs/blob/master/community/libtorrent/PKGBUILD#L38
Starting from line 38:
The first two are missing headers - FreeBSD systems seem to have much stricter headers around.

The parts below are to make it actually compile as C++11 code.
libc++'s tr1 headers don't actually make a tr1 namespace.

Also, tr1 is not an actual standard, you shouldn't use it in an actual project.

(Note that I explicitly set -std=c++11 in the CXXFLAGS since the configure checks for it fail.)

And the patch used is to avoid link errors when building rtorrent:
https://github.com/ArchBSD/abs/blob/master/community/libtorrent/missing_references.diff

Declaring static const variables only in the class-def is simply not enough. I don't know why exactly clang wants to take a reference to them in the rtorrent code - it shouldn't - but in any case, providing the actual symbols is more correct.

from libtorrent.

andyattebery avatar andyattebery commented on June 14, 2024

I'm still unable to libtorrent using clang (not via homebrew). I set the CXXFLAGS to

CXXFLAGS="-Wno-deprecated-declarations -O3 -std=c++11 -stdlib=libc++"

as suggested above and received this error:

Making all in data
/bin/sh ../../../libtool  --tag=CXX   --mode=compile clang++ -DHAVE_CONFIG_H -I. -I../../.. -I. -I./.. -I./../.. -I../../..    -Wno-deprecated-declarations -O3 -std=c++11 -stdlib=libc++ -g -DDEBUG -fvisibility=hidden -D_THREAD_SAFE   -MT block.lo -MD -MP -MF .deps/block.Tpo -c -o block.lo block.cc
libtool: compile:  clang++ -DHAVE_CONFIG_H -I. -I../../.. -I. -I./.. -I./../.. -I../../.. -Wno-deprecated-declarations -O3 -std=c++11 -stdlib=libc++ -g -DDEBUG -fvisibility=hidden -D_THREAD_SAFE -MT block.lo -MD -MP -MF .deps/block.Tpo -c block.cc  -fno-common -DPIC -o .libs/block.o
In file included from block.cc:44:
In file included from ./../../protocol/peer_connection_base.h:42:
./../../torrent/poll.h:40:10: fatal error: 'tr1/functional' file not found
#include <tr1/functional>

Which points to the real issue that @Blub mentions above that libc++ doesn't include the namespace tr1 since the majority of its features are included in c++11. So would the best option moving forward be adding preprocessor checks for libc++ to remove referencing the tr1 namespace as suggested here: http://stackoverflow.com/questions/13219007/xcode-4-5-tr1-type-traits-file-not-found?

from libtorrent.

Blub avatar Blub commented on June 14, 2024

Your compile error is about the missing tr1/functional file in the include path, not the namespace for inside the code. If you have c++11 headers around you can try using those (just remove the tr1/ from the path) instead and then you'll get the namespace related errors. I wonder if the other issues still exist with clang 3.4+ as they seem weird to even be there to begin with. (I'll see once FreeBSD merges the next update into the stable/10 branch)

from libtorrent.

dhruvit-r avatar dhruvit-r commented on June 14, 2024

There is clang++ for compiling C++ tuff. Try that.

from libtorrent.

Blub avatar Blub commented on June 14, 2024

/me points to the clang++ part of the commands pasted above...

from libtorrent.

andyattebery avatar andyattebery commented on June 14, 2024

@Blub Yea, I realize its that stdc++ doesn't have the "tr1" headers inside of a "tr1" directory. This is the correct behavior for c++11, right? So I've tried removing all references to tr1 in the code and recompiling via clang++ and manually setting -std=c++11 in the CXXFLAGS since the configure script fails for that check as @rakshasa mentions above. I'm still debugging compile errors for std::bind (instead of std::tr1::bind). However, once this is working, this should be how the code should be structured — without explicit references to tr1 — right?

from libtorrent.

Blub avatar Blub commented on June 14, 2024

It should. As you can see in the PKGBUILD link I posted above, there are a few more replacements happening. (like .assign -> .fill - basically everything after the port-patches are applied is to compile as c++11 as we prefer clang/libc++-compiled packages on ArchBSD)
I haven't tried it against a current git clone though, only against the version tarball referenced in the PKGBUILD.

from libtorrent.

arp242 avatar arp242 commented on June 14, 2024

This is also an issue with FreeBSD, where GCC was removed entirely in favour of Clang.

Someone seems to have created a patch, though:
http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/185299

(I'm not the author of this patch, and I didn't test it).

from libtorrent.

rakshasa avatar rakshasa commented on June 14, 2024

I have started work on a C++11 branch, however it is not yet ready.

https://github.com/rakshasa/libtorrent/tree/c++11

from libtorrent.

rakshasa avatar rakshasa commented on June 14, 2024

Both libtorrent and rtorrent now have c++11 branches, which should work with clang.

from libtorrent.

mistydemeo avatar mistydemeo commented on June 14, 2024

Thank you, I'll test! Is this expected to make it into a future release?

from libtorrent.

rakshasa avatar rakshasa commented on June 14, 2024

The next release, most likely this week or next, will become the stable branch.

The unstable branch will require C++11, mainly because I want to play with the new features and 3 years is enough for the distros to catch up.

from libtorrent.

rakshasa avatar rakshasa commented on June 14, 2024

Merged C++11 branch.

from libtorrent.

bapzangbo avatar bapzangbo commented on June 14, 2024

I have error when build with xcode6 libtorrent-rasterbar.a

Undefined symbols for architecture i386:
"libtorrent::absolutetime_deprecated_()", referenced from:
libtorrent::session::session(libtorrent::fingerprint const&, int, unsigned int) in main.o
"libtorrent::session::init(std::__1::pair<int, int>, char const*, libtorrent::fingerprint const&, unsigned int)", referenced from:
libtorrent::session::session(libtorrent::fingerprint const&, int, unsigned int) in main.o
"libtorrent::session::start(int)", referenced from:
libtorrent::session::session(libtorrent::fingerprint const&, int, unsigned int) in main.o
"libtorrent::session::~session()", referenced from:
_main in main.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

from libtorrent.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.