Bugzilla – Bug 582
IBM XL C/C++ compiler does not support visibility CFLAGS
Last modified: 2013-01-16 11:52:18 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
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.
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
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.
# 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
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
Fixed in sudo 1.8.6p4.