Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

udpt: init at 2016-02-20 #19171

Closed
wants to merge 4 commits into from
Closed

udpt: init at 2016-02-20 #19171

wants to merge 4 commits into from

Conversation

makefu
Copy link
Contributor

@makefu makefu commented Oct 2, 2016

Motivation for this change

Adds an udp torrent tracker. This PR is in preparation to the udpt nix module i have in use.

Things done
  • Tested using sandboxing
    (nix.useSandbox on NixOS,
    or option build-use-sandbox in nix.conf
    on non-NixOS)
  • Built on platform(s)
    • NixOS
    • OS X
    • Linux
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@Mic92
Copy link
Member

Mic92 commented Oct 2, 2016

Fails to build with the following error:

g++ -g -std=gnu++11 -c -o main.o src/main.cpp -DBOOST_LOG_DYN_LINK
src/main.cpp: In function 'void daemonize(const boost::program_options::variables_map&)':
src/main.cpp:65:57: warning: ignoring return value of 'int chdir(const char*)', declared with attribute warn_unused_result [-Wunused-result]
  ::chdir(conf["daemon.chdir"].as<std::string>().c_str());
                                                         ^
g++ -g -std=gnu++11 -c -o udpTracker.o src/udpTracker.cpp -DBOOST_LOG_DYN_LINK
In file included from /nix/store/8sl4jfs3nq0pkq4gg655s3axrxdx7z29-glibc-2.24-dev/include/bits/byteswap.h:35:0,
                 from /nix/store/8sl4jfs3nq0pkq4gg655s3axrxdx7z29-glibc-2.24-dev/include/endian.h:60,
                 from /nix/store/8sl4jfs3nq0pkq4gg655s3axrxdx7z29-glibc-2.24-dev/include/sys/types.h:216,
                 from /nix/store/8sl4jfs3nq0pkq4gg655s3axrxdx7z29-glibc-2.24-dev/include/stdlib.h:275,
                 from /nix/store/hxj3mhv9cwnapzay50dwin8p05s0k89a-gcc-5.4.0/include/c++/5.4.0/cstdlib:72,
                 from /nix/store/hxj3mhv9cwnapzay50dwin8p05s0k89a-gcc-5.4.0/include/c++/5.4.0/bits/stl_algo.h:59,
                 from /nix/store/hxj3mhv9cwnapzay50dwin8p05s0k89a-gcc-5.4.0/include/c++/5.4.0/algorithm:62,
                 from src/udpTracker.hpp:26,
                 from src/udpTracker.cpp:20:
src/udpTracker.cpp: In member function 'void UDPT::UDPTracker::start()':
src/udpTracker.cpp:105:191: error: expected id-expression before '(' token
    BOOST_LOG_SEV(m_logger, boost::log::trivial::info) << "UDP tracker bound on " << ::inet_ntop(AF_INET, reinterpret_cast<LPVOID>(&m_localEndpoint.sin_addr), buff, sizeof(buff)) << ":" << ::htons(m_localEndpoint.sin_port);
                                                                                                                                                                                               ^
make: *** [Makefile:28: udpTracker.o] Error 1

@makefu
Copy link
Contributor Author

makefu commented Oct 2, 2016

@Mic92 Correct, it seems the issue is new to the latest version of boost packaged in master. I look into it.

EDIT: It looks like this is related to :: explicit global namespacing - https://bbs.archlinux.org/viewtopic.php?id=53751

The issue does not appear when building with nixpkgs stable (16.03)

EDIT2: more like it is related to Optimization in place where global functions maybe come macros ... https://stackoverflow.com/questions/14431776/c-ntohs-fails-on-higher-optimization-levels

@Mic92
Copy link
Member

Mic92 commented Oct 2, 2016

I guess the easiest way to solve this, is to report this in the upstream project.

@makefu
Copy link
Contributor Author

makefu commented Oct 2, 2016

@Mic92 you are right, let's wait for upstream.

@joachifm
Copy link
Contributor

joachifm commented Oct 2, 2016

Somewhat unintuitively, you can "fix" the build by disabling fortify hardening (which imposes use of -O2, triggering the build error).

Suitable for a network facing daemon.
Without this, the resulting binary is unstripped.
@makefu
Copy link
Contributor Author

makefu commented Oct 19, 2016

@Mic92 seems upstream fixed the issue with naim94a/udpt@e826b58 . i will test this later on

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants