Bug 10630 - Solaris Studio fails to compile samba 4
Solaris Studio fails to compile samba 4
Status: RESOLVED FIXED
Product: Samba 4.1 and newer
Classification: Unclassified
Component: Build
4.1.7
All Solaris
: P5 normal
: 4.2
Assigned To: Björn Jacke
Samba QA Contact
:
Depends on: 11073
Blocks:
  Show dependency treegraph
 
Reported: 2014-05-26 13:01 UTC by Vladimír Marek
Modified: 2015-03-13 08:32 UTC (History)
2 users (show)

See Also:


Attachments
creating mostly empty c file on which the dynamic library is based (1.21 KB, application/octet-stream)
2014-05-26 13:01 UTC, Vladimír Marek
no flags Details
Vlad's update (fixed) (1.31 KB, patch)
2014-12-18 12:59 UTC, Jura Sasek
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimír Marek 2014-05-26 13:01:37 UTC
Created attachment 9977 [details]
creating mostly empty c file on which the dynamic library is based

Solaris studio can't compile 'empty' libraries the way gcc can:

gcc -shared -o a.so -lz

Samba build uses this feature. There was some attempty at working around the limitation here:

http://git.samba.org/?p=anatoliy/anatoliy.git;a=commitdiff_plain;h=65743f932b511db009655847e77288c95c0aa525

Basically adding '-' at the end of the command line. That does not work, or at least with recent versions of Solaris Studio:

$ cc -G -Bdynamic -o a.so -lz
usage: cc [ options ] files.  Use 'cc -flags' for details

$ cc -G -Bdynamic -o a.so -lz -
cc: standard input (-) valid only for preprocessor

$ cc -V
cc: Sun C 5.12 SunOS_i386 Patch 148918-08 2013/10/18

I'm ataching patch which fixes the issue. Basically creating mostly empty c file on which the dynamic library is based ... I am not sure it's the best fix, but it works well.
Comment 1 Vladimír Marek 2014-05-28 11:25:35 UTC
Hmmm, the patch sometimes works sometimes does not. I'll investigate more.
Comment 2 Jura Sasek 2014-12-18 12:59:17 UTC
Created attachment 10549 [details]
Vlad's update (fixed)

Vlad's fixed update of the patch  ...works fine to me
Comment 3 Stefan Metzmacher 2014-12-18 13:12:34 UTC
(In reply to Jura Sasek from comment #2)

can't we just pass /dev/null instead of - ?
Comment 4 Jura Sasek 2014-12-18 13:37:46 UTC
(In reply to Stefan (metze) Metzmacher from comment #3)


 $ /opt/SUNWspro/solarisstudio12.3/bin/cc -c -o tmp.o /dev/null
cc: No valid input files specified, no output generated
 $ touch tmp.c
 $ /opt/SUNWspro/solarisstudio12.3/bin/cc -c -o tmp.o tmp.c 
"tmp.c", line 1: warning: empty translation unit
 $ file tmp.o
tmp.o:          ELF 32-bit MSB relocatable SPARC32PLUS Version 1, V8+ Required
 $ ln -s /dev/null .
 $ mv null null.c
 $ rm tmp.o
 $ /opt/SUNWspro/solarisstudio12.3/bin/cc -c -o tmp.o null.c 
"null.c", line 1: warning: empty translation unit
 $ file tmp.o
tmp.o:          ELF 32-bit MSB relocatable SPARC32PLUS Version 1, V8+ Required

...it looks the "cc" needs the appropriate suffix appended to compiled file
Comment 5 Stefan Metzmacher 2014-12-18 15:40:41 UTC
I think we should avoid calling the compiler at all or autogenerate an empty file.
Comment 6 Tom Schulz 2014-12-18 17:08:24 UTC
See also bug 10315
Comment 7 Jura Sasek 2014-12-18 17:35:06 UTC
(In reply to Tom Schulz from comment #6)

...yes Bug 10315 is a duplicate. SunCC can not compile from "-" (stdin). It needs the file suffix at least (see above).
Comment 8 Stefan Metzmacher 2015-03-13 08:32:34 UTC
Fixed in bug #11073.