Bug 582

Summary: IBM XL C/C++ compiler does not support visibility CFLAGS
Product: Sudo Reporter: Yannick Bergeron <yaberger>
Component: ConfigureAssignee: Todd C. Miller <Todd.Miller>
Status: RESOLVED FIXED    
Severity: normal    
Priority: low    
Version: 1.8.6   
Hardware: IBM   
OS: AIX   

Description Yannick Bergeron 2013-01-10 13:59:54 MST
Hi,

when following this procedure to compile Sudo 1.8.6p3 with IBM XL C/C++ compiler:
gzip -cd sudo-1.8.6p3.tar.gz|tar xf -
cd sudo-1.8.6p3
./configure --prefix=/usr/local/sudo-1.8.6p3 --sysconfdir=/etc --disable-zlib
make

I get this error:
        cc -qlanglvl=extc89 -I../include -I.. -I..  -g -fvisibility=hidden  -D_ALL_SOURCE -D_LINUX_SOURCE_COMPAT ./mksigname.c -o mksigname
ld: 0706-005 Cannot find or open file: visibility=hidden
        ld:fopen(): A file or directory in the path name does not exist.
make: 1254-004 The error code from the last command is 255.


Stop.
make: 1254-004 The error code from the last command is 2.


Stop.


The following line was displayed in the configure command output:
checking whether C compiler accepts -fvisibility=hidden... yes

grep visibility config.log
configure:20393: checking whether C compiler accepts -fvisibility=hidden
configure:20412: cc -qlanglvl=extc89 -c -g  -fvisibility=hidden  conftest.c >&5
configure:20774: cc -qlanglvl=extc89 -c -g -fvisibility=hidden  -fstack-protector  conftest.c >&5
configure:20805: cc -qlanglvl=extc89 -o conftest -g -fvisibility=hidden    -fstack-protector conftest.c  >&5
ld: 0706-005 Cannot find or open file: visibility=hidden
configure:20849: cc -qlanglvl=extc89 -o conftest -g -fvisibility=hidden    -Wl,-z,relro conftest.c  >&5
ld: 0706-005 Cannot find or open file: visibility=hidden
ax_cv_check_cflags___fvisibility_hidden=yes
CFLAGS='-g -fvisibility=hidden'

grep visibility config.status
CFLAGS='-g -fvisibility=hidden'
S["CFLAGS"]="-g -fvisibility=hidden"

Figured it might not be supported by IBM XL C/C++ compiler

I've used this temporary workaround to be able to compile it
/usr/bin/perl -i -pe "s/^(\s+CFLAGS=\"\\$\\{?CFLAGS\\}?\s+-fvisibility=hidden\")$/#\1/" configure

But think a proper modification would need to be done in the configure script so that IBM XL C/C++ is not detected to support -fvisibility=hidden
What would you suggest?

Best regards,

Yannick Bergeron
Comment 1 Todd C. Miller 2013-01-10 14:11:10 MST
Can you include the portion of config.log from the line containing:

checking whether C compiler accepts -fvisibility=hidden

up to and including the resule: line?  It sounds like the IBM XL C compiler isn't returning an error when the test is run.
Comment 2 Yannick Bergeron 2013-01-10 14:27:25 MST
sure

configure:20393: checking whether C compiler accepts -fvisibility=hidden
configure:20412: cc -qlanglvl=extc89 -c -g  -fvisibility=hidden  conftest.c >&5
configure:20412: $? = 0
configure:20421: result: yes

what would be the content of conftest.c to manually test this command?
cc -qlanglvl=extc89 -c -g  -fvisibility=hidden  conftest.c


Best regards,

Yannick Bergeron
Comment 3 Todd C. Miller 2013-01-10 14:42:44 MST
configure just uses an empty main() for the test.  E.g.

int
main()
{
  return 0;
}

If we can't rely on that test working I can just restrict it to gcc and workalikes.
Comment 4 Yannick Bergeron 2013-01-10 14:58:51 MST
# cat conftest.c 
int
main()
{
  return 0;
}

# cc -qlanglvl=extc89 -c -g  -fvisibility=hidden  conftest.c
root@aix53tst ==> echo $?
0

# ls conftest*
-rw-------    1 root     system           28 Jan 10 14:46 conftest.c
-rw-------    1 root     system         1431 Jan 10 14:46 conftest.o


ok... it compiles this way...
but if I try that way:
# pwd
/usr/src/sudo-1.8.6p3/compat

# cat conftest.c
int
main()
{
  return 0;
}

# cc -qlanglvl=extc89 -I../include -I.. -I..  -g -fvisibility=hidden  -D_ALL_SOURCE -D_LINUX_SOURCE_COMPAT ./conftest.c -o conftest
ld: 0706-005 Cannot find or open file: visibility=hidden
        ld:fopen(): A file or directory in the path name does not exist.

# echo $?
255



Best regards,

Yannick Bergeron
Comment 5 Yannick Bergeron 2013-01-10 15:13:43 MST
I think that the use of "-c" in the test make it passes
As "-c" is not used at the compilation, it fails

         -c     Instructs the compiler to pass source files to the
                compiler only. The compiled source files are not
                sent to the linker. This option produces an object
                file, file_name.o, for each valid source file.

         -f<file_name>
                Names a file to store a list of object files for
                the compiler to pass to the linker. The <file_name>
                file should contain only the names of object files.
                There should be one object file per line.

# cat conftest.c                                         
int
main()
{
  return 0;
}

# cc -qlanglvl=extc89 -g  -fvisibility=hidden  conftest.c
ld: 0706-005 Cannot find or open file: visibility=hidden
        ld:fopen(): A file or directory in the path name does not exist.

# echo $?
255

# cc -qlanglvl=extc89 -g conftest.c                      

# echo $?
0
Comment 6 Todd C. Miller 2013-01-16 11:52:18 MST
Fixed in sudo 1.8.6p4.