Compiling the client for MacOS

Is it possible to compile the client for MacOS ?

it would be better to use UrBackup than TimeMachine in our network …

Nobody tried yet. It probably does not work. It’s a differnt compiler (clang) and you probably need some other Mac specific stuff as well.

That said, it should be relativily easy if you know (or learn) about deployment on Macs and have a little bit of C/C++ knownledge.

I don’t have a Mac.

It 's beyond my skills, we must wait for a skilled volunteer …

Hi Martin,

i documented myself on compiling Linux sources on MacOS 10.8 :

i installed a fresh 10.8 system
i downloaded and dezipped urbackup-linux 1.1.1
i installed xcode 4.4 + commandline tools (for gcc) : https://developer.apple.com/downloads/index.action
i installed quartz (x11 for Mac) : http://xquartz.macosforge.org/landing/
i installed macports ( easy-to-use system for compiling, installing, and upgrading) : http://www.macports.org/install.php + https://distfiles.macports.org/MacPorts/MacPorts-2.1.3-10.8-MountainLion.pkg
i updated mac ports : 'sudo port selfupdate’
i installed wxwidgets 'sudo port install -v wxwidgets30’
then i launched urbackup ./configure - then it asks me for cryptoplugin : (i do ‘sudo port -v install libcryptopp’)

then ‘./configure’ is ok

then i do ‘make’ and i obtain the next message :


make
make all-recursive
Making all in .
g++ -DHAVE_CONFIG_H -I. -D_THREAD_SAFE -pthread -DLINUX -g -O2 -MT AcceptThread.o -MD -MP -MF .deps/AcceptThread.Tpo -c -o AcceptThread.o AcceptThread.cpp
AcceptThread.cpp: In member function ‘virtual void OutputCallback::operator()(const void*, size_t)’:
AcceptThread.cpp:46: error: ‘MSG_NOSIGNAL’ was not declared in this scope
make[2]: *** [AcceptThread.o] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

As i’m not skilled in C/C++, can you provide some help ?

Do you think it would be interesting to submit urbackup client and server to macports project ?

http://www.macports.org/

“The MacPorts Project is an open-source community initiative to design an easy-to-use system for compiling, installing,
and upgrading either command-line, X11 or Aqua based open-source software on the
Mac OS X operating system. To that end we provide the command-line driven MacPorts software package under a BSD License, and through it easy access to thousands of ports
that greatly simplify the task of compiling and installing open-source software on your Mac.”

The compile error is likely only the top of the mountain. For this specific error you probably need to go to “socket_header.h” and add

#ifdef __APPLE__
#	define MSG_NOSIGNAL 0
#endif  

You can probably look for the #ifdef sun
things in the code, because that is another unix (like mac os x).

I don’t know anything about ports (I never had a Apple device). But you should probably be able to also distribute it the “normal” way. I just checked and the GUI framework the client uses is also used by e.g. Dropbox.

There is a French Guy who set MacOS on VMWARE … may be it’s “a good way to try before you buy”:

http://www.cachem.fr/vmware-mac-os-x-lion-pc-windows/

Help yourself with google to translate :)

OK the code added to socket_header.h enable the make process to go further … till this message :

file_linux.cpp: In member function ‘bool File::Open(std::wstring, int)’:
file_linux.cpp:84: error: ‘O_LARGEFILE’ was not declared in this scope
file_linux.cpp:84: error: ‘open64’ was not declared in this scope
file_linux.cpp: In member function ‘virtual bool File::Seek(_i64)’:
file_linux.cpp:157: error: ‘off64_t’ was not declared in this scope
file_linux.cpp:157: error: expected `;’ before ‘ot’
file_linux.cpp:158: error: ‘ot’ was not declared in this scope
file_linux.cpp: In member function ‘virtual _i64 File::Size()’:
file_linux.cpp:171: warning: ‘fstat64’ is deprecated (declared at /usr/include/sys/stat.h:463)
file_linux.cpp:171: warning: ‘fstat64’ is deprecated (declared at /usr/include/sys/stat.h:463)
make[2]: *** [file_linux.o] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

Hi Martin,

is it possible to simplify MacOS urbackup client without the interface.
Thus, there is only the urbackup client daemon to compile and to start
The parameters will be set from the web admin interface though.

Regards

Mehdi

The 1.3 client has a configure option (–enabled-headless) for that. It won’t fix all compile errors on Mac Os, I think.

Today I tried compiling the Client for MacOS X. I resolved some MSG_NOSIGNAL and other differences for the mac. Now It’s hanging on the sendfile differences, that can maybe resolved like here http://www.opensource.apple.com/source/distcc/distcc-2503/distcc_dist/src/sendfile.c

Is someone interested to help to port them to MacOS X (maybe with more C/C++ skills ) or it nobody interested that the client is also running on MacOS X?

I can continue to try, but I’m not a C/C++ Programmer so I don’t know If I can resolve all issues…

Thanks

I have created a package for Mac OS X now: WIP: Mac OS X client

Hello:

I hope I’m not going to waste anybody’s time, but I’m starting to look into the Mac client to see if I can make any headway with the current packaging problem.

I’ve made some decent progress with getting a development environment configured - but I’m running into some errors during the compile process. Here’s the last few lines in my log:

mv -f .deps/urbackupclientbackend-Client.Tpo .deps/urbackupclientbackend-Client.Po
g++ -DHAVE_CONFIG_H -I.     -DNDEBUG    -I/usr/include -I/usr/include -D_THREAD_SAFE -pthread -DLINUX -DSTATIC_PLUGIN -DVARDIR='"/Applications/UrBackup Client.app/Contents/MacOS/var"' -DSYSCONFDIR='"/Applications/UrBackup Client.app/Contents/MacOS/etc"' -DDATADIR='"/Applications/UrBackup Client.app/Contents/MacOS/share"' -DCRYPTOPP_INCLUDE_PREFIX='cryptoplugin/src'  -DNO_ZSTD_COMPRESSION -DURB_WITH_CLIENTUPDATE -mmacosx-version-min=10.6 -DNDEBUG -DURB_WITH_CLIENTUPDATE -MT urbackupclientbackend-Query.o -MD -MP -MF .deps/urbackupclientbackend-Query.Tpo -c -o urbackupclientbackend-Query.o `test -f 'Query.cpp' || echo './'`Query.cpp
mv -f .deps/urbackupclientbackend-Database.Tpo .deps/urbackupclientbackend-Database.Po
g++ -DHAVE_CONFIG_H -I.     -DNDEBUG    -I/usr/include -I/usr/include -D_THREAD_SAFE -pthread -DLINUX -DSTATIC_PLUGIN -DVARDIR='"/Applications/UrBackup Client.app/Contents/MacOS/var"' -DSYSCONFDIR='"/Applications/UrBackup Client.app/Contents/MacOS/etc"' -DDATADIR='"/Applications/UrBackup Client.app/Contents/MacOS/share"' -DCRYPTOPP_INCLUDE_PREFIX='cryptoplugin/src'  -DNO_ZSTD_COMPRESSION -DURB_WITH_CLIENTUPDATE -mmacosx-version-min=10.6 -DNDEBUG -DURB_WITH_CLIENTUPDATE -MT urbackupclientbackend-SelectThread.o -MD -MP -MF .deps/urbackupclientbackend-SelectThread.Tpo -c -o urbackupclientbackend-SelectThread.o `test -f 'SelectThread.cpp' || echo './'`SelectThread.cpp
1 error generated.
make[2]: *** [client/gui/urbackupclientgui-GUISetupWizard.o] Error 1
make[2]: *** Waiting for unfinished jobs....
mv -f .deps/urbackupclientbackend-Query.Tpo .deps/urbackupclientbackend-Query.Po
mv -f .deps/urbackupclientbackend-SelectThread.Tpo .deps/urbackupclientbackend-SelectThread.Po
1 error generated.
make[2]: *** [client/urbackupclientgui-CbtStatus.o] Error 1
1 error generated.
make[2]: *** [client/urbackupclientgui-SetupWizard.o] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

I’m basing this off the dev branch. Any clues where I should go hunting?

Thanks!

Sorry, you didn’t paste enough of the output. It doesn’t include the actual error.

Hi:

Oops sorry - my bad - don’t know why I didn’t spot that… Here’s a bit more:

mv -f clientctl/.deps/urbackupclientctl-jsoncpp.Tpo clientctl/.deps/urbackupclientctl-jsoncpp.Po
g++ -DHAVE_CONFIG_H -I.  -I/usr/local/lib/wx/include/osx_cocoa-unicode-3.0 -I/usr/local/include/wx-3.0 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXMAC__ -D__WXOSX__ -D__WXOSX_COCOA__ -DNDEBUG -I/usr/include -I/usr/include -DLINUX -I/usr/local/lib/wx/include/osx_cocoa-unicode-3.0 -I/usr/local/include/wx-3.0 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXMAC__ -D__WXOSX__ -D__WXOSX_COCOA__ -DDATADIR='"/Applications/UrBackup Client.app/Contents/MacOS/share"' -DVARDIR='"/Applications/UrBackup Client.app/Contents/MacOS/var"' -DSBINDIR='"/Applications/UrBackup Client.app/Contents/MacOS/sbin"' -DBINDIR='"/Applications/UrBackup Client.app/Contents/MacOS/bin"' -mmacosx-version-min=10.6 -DNDEBUG -DURB_WITH_CLIENTUPDATE -MT client/urbackupclientgui-CbtStatus.o -MD -MP -MF client/.deps/urbackupclientgui-CbtStatus.Tpo -c -o client/urbackupclientgui-CbtStatus.o `test -f 'client/CbtStatus.cpp' || echo './'`client/CbtStatus.cpp
8 warnings generated.
mv -f urbackupcommon/.deps/urbackupclientctl-os_functions_lin.Tpo urbackupcommon/.deps/urbackupclientctl-os_functions_lin.Po
In file included from client/SetupWizard.cpp:19:
In file included from client/SetupWizard.h:1:
In file included from client/gui/GUISetupWizard.h:11:
In file included from /usr/local/include/wx-3.0/wx/artprov.h:14:
In file included from /usr/local/include/wx-3.0/wx/string.h:46:
/usr/local/include/wx-3.0/wx/strvararg.h:25:14: fatal error: 'type_traits' file not
      found
    #include <type_traits>
             ^~~~~~~~~~~~~
g++ -DHAVE_CONFIG_H -I.     -DNDEBUG    -I/usr/include -I/usr/include -D_THREAD_SAFE -pthread -DLINUX -DSTATIC_PLUGIN -DVARDIR='"/Applications/UrBackup Client.app/Contents/MacOS/var"' -DSYSCONFDIR='"/Applications/UrBackup Client.app/Contents/MacOS/etc"' -DDATADIR='"/Applications/UrBackup Client.app/Contents/MacOS/share"' -DCRYPTOPP_INCLUDE_PREFIX='cryptoplugin/src'  -DNO_ZSTD_COMPRESSION -DURB_WITH_CLIENTUPDATE -mmacosx-version-min=10.6 -DNDEBUG -DURB_WITH_CLIENTUPDATE -MT urbackupclientbackend-AcceptThread.o -MD -MP -MF .deps/urbackupclientbackend-AcceptThread.Tpo -c -o urbackupclientbackend-AcceptThread.o `test -f 'AcceptThread.cpp' || echo './'`AcceptThread.cpp
mv -f clientctl/.deps/urbackupclientctl-tcpstack.Tpo clientctl/.deps/urbackupclientctl-tcpstack.Po
g++ -DHAVE_CONFIG_H -I.     -DNDEBUG    -I/usr/include -I/usr/include -D_THREAD_SAFE -pthread -DLINUX -DSTATIC_PLUGIN -DVARDIR='"/Applications/UrBackup Client.app/Contents/MacOS/var"' -DSYSCONFDIR='"/Applications/UrBackup Client.app/Contents/MacOS/etc"' -DDATADIR='"/Applications/UrBackup Client.app/Contents/MacOS/share"' -DCRYPTOPP_INCLUDE_PREFIX='cryptoplugin/src'  -DNO_ZSTD_COMPRESSION -DURB_WITH_CLIENTUPDATE -mmacosx-version-min=10.6 -DNDEBUG -DURB_WITH_CLIENTUPDATE -MT urbackupclientbackend-Client.o -MD -MP -MF .deps/urbackupclientbackend-Client.Tpo -c -o urbackupclientbackend-Client.o `test -f 'Client.cpp' || echo './'`Client.cpp
In file included from client/CbtStatus.cpp:1:
In file included from client/CbtStatus.h:3:
In file included from client/gui/GUI.h:11:
In file included from /usr/local/include/wx-3.0/wx/string.h:46:
/usr/local/include/wx-3.0/wx/strvararg.h:25:14: fatal error: 'type_traits' file not
      found
    #include <type_traits>
             ^~~~~~~~~~~~~
mv -f .deps/urbackupclientbackend-AcceptThread.Tpo .deps/urbackupclientbackend-AcceptThread.Po
g++ -DHAVE_CONFIG_H -I.     -DNDEBUG    -I/usr/include -I/usr/include -D_THREAD_SAFE -pthread -DLINUX -DSTATIC_PLUGIN -DVARDIR='"/Applications/UrBackup Client.app/Contents/MacOS/var"' -DSYSCONFDIR='"/Applications/UrBackup Client.app/Contents/MacOS/etc"' -DDATADIR='"/Applications/UrBackup Client.app/Contents/MacOS/share"' -DCRYPTOPP_INCLUDE_PREFIX='cryptoplugin/src'  -DNO_ZSTD_COMPRESSION -DURB_WITH_CLIENTUPDATE -mmacosx-version-min=10.6 -DNDEBUG -DURB_WITH_CLIENTUPDATE -MT urbackupclientbackend-Database.o -MD -MP -MF .deps/urbackupclientbackend-Database.Tpo -c -o urbackupclientbackend-Database.o `test -f 'Database.cpp' || echo './'`Database.cpp
mv -f .deps/urbackupclientbackend-Client.Tpo .deps/urbackupclientbackend-Client.Po
g++ -DHAVE_CONFIG_H -I.     -DNDEBUG    -I/usr/include -I/usr/include -D_THREAD_SAFE -pthread -DLINUX -DSTATIC_PLUGIN -DVARDIR='"/Applications/UrBackup Client.app/Contents/MacOS/var"' -DSYSCONFDIR='"/Applications/UrBackup Client.app/Contents/MacOS/etc"' -DDATADIR='"/Applications/UrBackup Client.app/Contents/MacOS/share"' -DCRYPTOPP_INCLUDE_PREFIX='cryptoplugin/src'  -DNO_ZSTD_COMPRESSION -DURB_WITH_CLIENTUPDATE -mmacosx-version-min=10.6 -DNDEBUG -DURB_WITH_CLIENTUPDATE -MT urbackupclientbackend-Query.o -MD -MP -MF .deps/urbackupclientbackend-Query.Tpo -c -o urbackupclientbackend-Query.o `test -f 'Query.cpp' || echo './'`Query.cpp
mv -f .deps/urbackupclientbackend-Database.Tpo .deps/urbackupclientbackend-Database.Po
g++ -DHAVE_CONFIG_H -I.     -DNDEBUG    -I/usr/include -I/usr/include -D_THREAD_SAFE -pthread -DLINUX -DSTATIC_PLUGIN -DVARDIR='"/Applications/UrBackup Client.app/Contents/MacOS/var"' -DSYSCONFDIR='"/Applications/UrBackup Client.app/Contents/MacOS/etc"' -DDATADIR='"/Applications/UrBackup Client.app/Contents/MacOS/share"' -DCRYPTOPP_INCLUDE_PREFIX='cryptoplugin/src'  -DNO_ZSTD_COMPRESSION -DURB_WITH_CLIENTUPDATE -mmacosx-version-min=10.6 -DNDEBUG -DURB_WITH_CLIENTUPDATE -MT urbackupclientbackend-SelectThread.o -MD -MP -MF .deps/urbackupclientbackend-SelectThread.Tpo -c -o urbackupclientbackend-SelectThread.o `test -f 'SelectThread.cpp' || echo './'`SelectThread.cpp
1 error generated.
make[2]: *** [client/gui/urbackupclientgui-GUISetupWizard.o] Error 1
make[2]: *** Waiting for unfinished jobs....
mv -f .deps/urbackupclientbackend-Query.Tpo .deps/urbackupclientbackend-Query.Po
mv -f .deps/urbackupclientbackend-SelectThread.Tpo .deps/urbackupclientbackend-SelectThread.Po
1 error generated.
make[2]: *** [client/urbackupclientgui-CbtStatus.o] Error 1
1 error generated.
make[2]: *** [client/urbackupclientgui-SetupWizard.o] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

Seeing this has prompted me to investigate further - looks like a wxWidgets issue that has cropped up on macOS quite a bit - though not for a while. I’m continuing to investigate here…

For the record:

  • I’m compiling on macOS 10.12.6;
  • I’m using Homebrew to install required packages. I haven’t installed anything else weird;
  • Running the compile with --enable-headless passes over this issue.

Looking in the ./configure script, I see the following warning at line 8226:

			Please check that wx-config is in path, the directory
			where wxWidgets libraries are installed (returned by
			'wx-config --libs' or 'wx-config --static --libs' command)
			is in LD_LIBRARY_PATH or equivalent variable and
			wxWidgets version is $reqwx or above.

I can’t find any reference to LD_LIBRARY_PATH in create_osx_installer.sh - I don’t know if it’s required or not…

Apologies if these are rather noob questions - I know Mac-specific development much more than C++ environments…

I compiled my own wxWidgets using the same parameters (e.g. -mmacosx-version-min=10.6). I’d also use the latest version (3.1.x).

Hi:

Ah right - thanks! I’ll try that…