Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

JohnnieBBadde

macrumors regular
Original poster
Dec 11, 2014
119
103
Hi everyone,

I hope I can get help here - I had experienced some severe trouble with SMB shares in heterogeneous networks in the past and the solution was to kick Apple's SMB implementation to the curb and install Samba 3 with Homebrew.

Then I thought, if you get Samba why not manually install the latest stable Samba 4 release (Homebrew sticks to Samba 3.x, MacPorts to an out-dated Samba 4.x), to my understanding the general building process is ./configure, make and make install.

The ./configure part finishes successfully but the make step aborts, here are links to the Terminal outputs:

./configure: http://pastebin.com/mH96ZdGr

make: http://pastebin.com/cmEWHdpp

Does anyone know how to fix this? My system is 10.9.5, Xcode is up-to-date. Samba has been my first contact with compiling something from its source so any assistance is greatly appreciated!

Thank you very much for your help!
 
Hi everyone,

I hope I can get help here - I had experienced some severe trouble with SMB shares in heterogeneous networks in the past and the solution was to kick Apple's SMB implementation to the curb and install Samba 3 with Homebrew.

Then I thought, if you get Samba why not manually install the latest stable Samba 4 release (Homebrew sticks to Samba 3.x, MacPorts to an out-dated Samba 4.x), to my understanding the general building process is ./configure, make and make install.

The ./configure part finishes successfully but the make step aborts, here are links to the Terminal outputs:

./configure: http://pastebin.com/mH96ZdGr

make: http://pastebin.com/cmEWHdpp

Does anyone know how to fix this? My system is 10.9.5, Xcode is up-to-date. Samba has been my first contact with compiling something from its source so any assistance is greatly appreciated!

Thank you very much for your help!

You need to patch 2 files to compile samba-4.1.14 on OS X 10.9.5. If you unpacked the samba-4.1.14.tar.gz file you'll have a samba-4.1.14 directory.
In the example given ~ stands for /Users/username.

Files to patch :

  • ~/Downloads/samba-4.1.14/lib/crypto/md5.h
  • ~/Downloads/samba-4.1.14/source3/wscript

Info : https://trac.macports.org/ticket/38834 - https://lists.samba.org/archive/samba-technical/2014-October/103018.html

Note : You can use the patch command in Terminal to patch the files or make the changes with a text editor.

Code:
Billys-Mac-Pro:Samba kryten$ patch -b wscript patch.diff 
patching file wscript
Hunk #1 succeeded at 331 (offset -18 lines).
 

Attachments

  • Screen Shot 2014-12-12 at 05.36.49.png
    Screen Shot 2014-12-12 at 05.36.49.png
    77.7 KB · Views: 178
  • Screen Shot 2014-12-12 at 05.37.03.png
    Screen Shot 2014-12-12 at 05.37.03.png
    52.7 KB · Views: 175
  • Screen Shot 2014-12-12 at 05.42.32.png
    Screen Shot 2014-12-12 at 05.42.32.png
    253.7 KB · Views: 181
  • Screen Shot 2014-12-12 at 05.42.43.png
    Screen Shot 2014-12-12 at 05.42.43.png
    263.9 KB · Views: 163
Thanks, I'm almost there.

My last question is regarding the content of the text file "patch.diff" I assume I have to create in the /samba-4.1.14/source3/ directory.

Exactly what part of the second half of the linked message from the Samba Archive has to be in the file?

Thanks again! I'm sorry if I'm not seeing the obvious beginning and end of the actual patch.
 
Last edited:
I've tried the folllowing, placed the patch.diff in the /samba-4.1.14/source3/ directory

Content patch.diff
Code:
---
 source3/wscript | 26 +++++++++++++++++++++-----
 1 file changed, 21 insertions(+), 5 deletions(-)

diff --git a/source3/wscript b/source3/wscript
index 4f182bf..2083f01 100644
--- a/source3/wscript
+++ b/source3/wscript
@@ -349,12 +349,28 @@ int main(int argc, char **argv)
 
     # Check if the compiler will optimize out functions
     conf.CHECK_CODE('''
-if (0) {
-    this_function_does_not_exist();
-} else {
-    return 1;
+#include <sys/types.h>
+size_t __unsafe_string_function_usage_here_size_t__(void);
+#define CHECK_STRING_SIZE(d, len) (sizeof(d) != (len) && sizeof(d) != sizeof(char *))
+static size_t push_string_check_fn(void *dest, const char *src, size_t dest_len) {
+	return 0;
+}
+
+#define push_string_check(dest, src, dest_len) \
+    (CHECK_STRING_SIZE(dest, dest_len) \
+    ? __unsafe_string_function_usage_here_size_t__()	\
+    : push_string_check_fn(dest, src, dest_len))
+
+int main(int argc, char **argv) {
+    char outbuf[1024];
+    char *p = outbuf;
+    const char *foo = "bar";
+    p += 31 + push_string_check(p + 31, foo, sizeof(outbuf) - (p + 31 - outbuf));
+    return 0;
 }''', 'HAVE_COMPILER_WILL_OPTIMIZE_OUT_FNS',
-        msg="Checking if the compiler will optimize out functions")
+            addmain=False,
+            add_headers=False,
+            msg="Checking if the compiler will optimize out functions")
 
     # Check if the compiler supports the LL suffix on long long integers
     # AIX needs this
--
1.9.3

Then, the Terminal output is:

patch -b wscript patch.diff
patching file wscript
Hunk #1 succeeded at 331 (offset -18 lines).
patch unexpectedly ends in middle of line

Is there something wrong the the used code?

*Edit*: Never mind, just edited the wscript file manually and it works like a charm.
 
Last edited:
@kryten2 do you compile samba 4.1.14 on Mavericks?

@kryten2 do you compile samba 4.1.14 on Mavericks?
if yes how do you do? I´m stuck with samba bug#9665.

This is my WIP samba homebrew formula.
Thanks.
 
@kryten2 do you compile samba 4.1.14 on Mavericks?
if yes how do you do? I´m stuck with samba bug#9665.

This is my WIP samba homebrew formula.
Thanks.

Thank your for your response. As you know I mentioned this bug in my other thread regarding a completely manual Samba setup with ./configure, make and make install.
For me personally this bug is more of a cosmetic nature (I'm happy I could get an up-to-date Samba 4 working on OS X) since I know that the source directory has to be placed somewhere out of sight and that it cannot be deleted.

How does this bug affect the Homebrew way? (As stated I'm rather a beginner, how can I use your custom formula with Homebrew?) Does Homebrew store the downloaded and decompressed source directory somewhere or does it delete it automatically so Samba will not work afterwards?

I'm glad this topic gets a little bit of attention, it's sad that the bulk of OS X users seems to swallow Apple's shi**y SMB implementation or is content with getting out-dated Samba versions.
 
Hello
Homebrew unpack source tar on an "/tmp" folder. Then install build output on "/usr/local/Cellar/" and delete temporals.
You can test samba custom brew with this:
$ brew install -v https://raw.githubusercontent.com/bySabi/homebrew/master/Library/Formula/samba.rb
Then is you run, for example:
$ smbpassword
you got dynamic linked library error.

For uninstall samba:
$ brew uninstall -v https://raw.githubusercontent.com/bySabi/homebrew/master/Library/Formula/samba.rb

I reopen samba bug here.
 
Hello
Homebrew unpack source tar on an "/tmp" folder. Then install build output on "/usr/local/Cellar/" and delete temporals.
You can test samba custom brew with this:
$ brew install -v https://raw.githubusercontent.com/bySabi/homebrew/master/Library/Formula/samba.rb
Then is you run, for example:
$ smbpassword
you got dynamic linked library error. [...]

Then the "linking issues" I mentioned are a different pair of shoes. For example, I can use "/usr/local/samba/bin/smbpasswd -a username" (have to do it with sudo) to add share users and they work fine.
My manual Samba installation without Homebrew is working properly, the only thing that's bothering me is that I have to keep the source directory around.

*edit*: Do you really want to use "smbpassword"? I don't have that file, only "smbpasswd".
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.