redefinition of 'struct mutex' on SunOS

Moderator: Project members

Post Reply
Message
Author
risto3
500 Syntax error
Posts: 12
Joined: 2015-07-07 17:03
First name: Richard
Last name: PALO

redefinition of 'struct mutex' on SunOS

#1 Post by risto3 » 2015-07-07 17:12

Trying to build the latest filezilla client (3.11.0.2) on SunOS i386...

Code: Select all

g++ -DHAVE_CONFIG_H -I. -I../../src/include  -I./../include -I/opt/local/include  -I/opt/local/lib/wx/include/gtk2-unicode-3.0 -I/opt/local/include/wx-3.0 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -I/opt/local/include -I/usr/include -I/opt/local/include/libdrm -I/opt/local/include/freetype2 -fpch-preprocess  -O2 -I/opt/local/include -I/usr/include -I/opt/local/include/libdrm -I/opt/local/include/freetype2 -Wall -g -std=gnu++11 -MT libengine_a-ControlSocket.o -MD -MP -MF .deps/libengine_a-ControlSocket.Tpo -c -o libengine_a-ControlSocket.o `test -f 'ControlSocket.cpp' || echo './'`ControlSocket.cpp
In file included from /usr/include/sys/t_lock.h:41:0,
                 from /usr/include/sys/stream.h:44,
                 from /usr/include/netinet/in.h:67,
                 from /usr/include/netdb.h:77,
                 from ControlSocket.cpp:17:
/usr/include/sys/mutex.h:63:16: error: redefinition of 'struct mutex'
 typedef struct mutex {
                ^
In file included from ../../src/include/event_loop.h:6:0,
                 from ../../src/include/event_handler.h:7,
                 from ../../src/include/socket.h:4,
                 from ../../src/include/misc.h:4,
                 from ../../src/include/libfilezilla.h:47,
                 from filezilla.h:1:
../../src/include/mutex.h:21:7: error: previous definition of 'struct mutex'
 class mutex final
       ^
In file included from /usr/include/sys/t_lock.h:41:0,
                 from /usr/include/sys/stream.h:44,
                 from /usr/include/netinet/in.h:67,
                 from /usr/include/netdb.h:77,
                 from ControlSocket.cpp:17:
/usr/include/sys/mutex.h:69:11: error: invalid type in declaration before ';' token
 } kmutex_t;
           ^
any ideas... missing local namespace?

User avatar
botg
Site Admin
Posts: 35509
Joined: 2004-02-23 20:49
First name: Tim
Last name: Kosse

Re: redefinition of 'struct mutex' on SunOS

#2 Post by botg » 2015-07-07 18:03

I'm working on a solution.
any ideas... missing local namespace?
Frankly yes. Sadly the makers of C++ forget to implicitly put all C headers into a namespace ;)

User avatar
botg
Site Admin
Posts: 35509
Joined: 2004-02-23 20:49
First name: Tim
Last name: Kosse

Re: redefinition of 'struct mutex' on SunOS

#3 Post by botg » 2015-07-07 18:28

Please try this patch:
mutex.diff
(986 Bytes) Downloaded 298 times

risto3
500 Syntax error
Posts: 12
Joined: 2015-07-07 17:03
First name: Richard
Last name: PALO

Re: redefinition of 'struct mutex' on SunOS

#4 Post by risto3 » 2015-07-08 15:55

botg wrote:Please try this patch:
mutex.diff
Okay, that worked okay... although I thought it may have been easier to maintain putting
the mutex class into a filezilla specific namespace.

I had one more patch necessary in order to complete the build, should I mail it to you or post it here?

User avatar
botg
Site Admin
Posts: 35509
Joined: 2004-02-23 20:49
First name: Tim
Last name: Kosse

Re: redefinition of 'struct mutex' on SunOS

#5 Post by botg » 2015-07-08 17:12

Post is fine.

User avatar
botg
Site Admin
Posts: 35509
Joined: 2004-02-23 20:49
First name: Tim
Last name: Kosse

Re: redefinition of 'struct mutex' on SunOS

#6 Post by botg » 2015-07-08 21:42

I've committed above patch.
risto3 wrote:Okay, that worked okay... although I thought it may have been easier to maintain putting
the mutex class into a filezilla specific namespace.
Ultimately the mutex class will go the way of the dodo. As soon as the various MSW runtimes drops Windows XP support for good. At that point I should be able to use std::(recursive_)mutex instead. Sadly due to XP support, std::mutex implementations on Windows are terribly slow.

As for a fz specific namespace, I'm working on moving some generic code into a new utility library.

Post Reply