Opened 6 years ago

Last modified 6 years ago

#5237 assigned defect

FreeBSD fails to build

Reported by: yuri@… Owned by: Martin Sjölund
Priority: high Milestone: Future
Component: Build Environment Version:
Keywords: Cc:

Description (last modified by Martin Sjölund)

Invalid operands to binary expression ('bind<int &, sockaddr *, unsigned long>' and 'int')

c++ -DCMAKE_Fortran_COMPILER=gfortran7 -DPF_INET=AF_INET -DFLT_MAX=INFINITY -fPIC -O2 -pipe -fno-omit-frame-pointer  -fPIC -DLIBICONV_PLUG -fstack-protector -isystem /usr/local/include -fno-strict-aliasing  -fno-stack-protector -O2 -pipe -fno-omit-frame-pointer -fPIC -DLIBICONV_PLUG -fstack-protector -isystem /usr/local/include -fno-strict-aliasing -fno-omit-frame-pointer  -DLIBICONV_PLUG -isystem /usr/local/include  -c src/netstream-socket.cpp -o obj/netstream-socket.o
src/netstream-socket.cpp:260:69: error: invalid operands to binary expression ('__bind<int &, sockaddr *, unsigned long>' and 'int')
                        if ( bind(server_socket_, (struct sockaddr*)&self, sizeof(self)) != 0 )
                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~

1.14.0-dev
FreeBSD 11.2 amd64
clang-60

Change History (5)

comment:1 by yuri@…, 6 years ago

Could you please also make sure it builds on FreeBSD, so that I can create the FreeBSD port for it?

Thanks!

comment:2 by Martin Sjölund, 6 years ago

This is a problem with a third-party library. I'm not sure we want to patch all of those for FreeBSD; I would accept pull requests though. We have the problem of maintenance; we would need a build system setup to keep testing the target so it doesn't break in the future and it seems all BSD distributions on top of Linux kernels have died so we can't use our docker machines. It might be that would could port OpenModelica to Alpine Linux which uses musl-libc and thus less GNU extensions.

I would like to test some things on that code though because it should work just fine on FreeBSD; for some reason bind(...) returns a function pointer instead of an int? The FreeBSD man pages says it returns an int...

comment:3 by Martin Sjölund, 6 years ago

Component: *unknown*Build Environment
Description: modified (diff)
Owner: changed from somebody to Martin Sjölund
Status: newassigned
Summary: Fails to build: invalid operands to binary expression ('__bind<int &, sockaddr *, unsigned long>' and 'int')FreeBSD fails to build

comment:4 by Martin Sjölund, 6 years ago

Minimum model triggering the FreeBSD bug:

#include <sys/socket.h>
#include <functional>

using namespace std;

int main() {
  int a = bind(1, NULL, 0);
}

So it seems this is a problem with some of FreeBSD's core libraries. (Without using namespace std, it works fine; on Ubuntu with clang 6 it works fine). I guess we could fix this compilation issue and submit a bugfix upstream.

comment:5 by Martin Sjölund, 6 years ago

Seems latest macOS is also affected: https://github.com/graphstream/gs-netstream/pull/7

Note: See TracTickets for help on using tickets.