Help compiling Samba 4.1.14 - error message

Discussion in 'Mac Programming' started by JohnnieBBadde, Dec 11, 2014.

  1. JohnnieBBadde macrumors newbie

    Joined:
    Dec 11, 2014
    #1
    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!
     
  2. kryten2 macrumors 6502a

    Joined:
    Mar 17, 2012
    Location:
    Belgium
    #2
    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).
     

    Attached Files:

  3. JohnnieBBadde, Dec 12, 2014
    Last edited: Dec 13, 2014

    JohnnieBBadde thread starter macrumors newbie

    Joined:
    Dec 11, 2014
    #3
    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.
     
  4. JohnnieBBadde, Dec 13, 2014
    Last edited: Dec 16, 2014

    JohnnieBBadde thread starter macrumors newbie

    Joined:
    Dec 11, 2014
    #4
    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.
     
  5. piterkater macrumors newbie

    Joined:
    Jan 15, 2015
    #5
    @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.
     
  6. JohnnieBBadde thread starter macrumors newbie

    Joined:
    Dec 11, 2014
    #6
    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.
     
  7. piterkater macrumors newbie

    Joined:
    Jan 15, 2015
    #7
    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.
     
  8. JohnnieBBadde thread starter macrumors newbie

    Joined:
    Dec 11, 2014
    #8
    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".
     

Share This Page