Thread: postgresql-9.5.3 compilation on Solaris SPARC
../../src/port/libpgport_srv.a ../../src/common/libpgcommon_srv.a -lnsl -lrt -lsocket -lm -o postgres
Undefined first referenced
symbol in file
atomic_cas_64 port/atomics.o
atomic_cas_32 port/atomics.o
ld: fatal: Symbol referencing errors. No output written to postgres
make[2]: *** [postgres] Error 1
make[2]: Leaving directory `/opt/postgresql-9.5.3/src/backend'
make[1]: *** [all-backend-recurse] Error 2
make[1]: Leaving directory `/opt/postgresql-9.5.3/src'
make: *** [all-src-recurse] Error 2
Any help would be appreciated. Do i need to give any particular CFLAGS ?
Below is the configure command -
./configure --prefix=/opt/postgres/9.5.3 CC=/opt/SUNWspro/bin/cc 'CFLAGS=-xO3 -xarch=v9 -xspace -W0,-Lt -W2,-Rcond_elim -Xa -xildoff -xc99=none -xCC' --enable-cassert --without-readline --enable-thread-safety LDFLAGS='-L/usr/lib/sparcv9 -L/usr/ucblib/sparcv9'
Hi,"make" command is generating the following error while compiling postgresql-9.5.3 on Solaris SPARC.
I tried compiling 9.2 and 9.3, works fine. This is only happening on 9.5.../../src/port/libpgport_srv.a ../../src/common/libpgcommon_srv.a -lnsl -lrt -lsocket -lm -o postgres
Undefined first referenced
symbol in file
atomic_cas_64 port/atomics.o
atomic_cas_32 port/atomics.o
ld: fatal: Symbol referencing errors. No output written to postgres
make[2]: *** [postgres] Error 1
make[2]: Leaving directory `/opt/postgresql-9.5.3/src/backend'
make[1]: *** [all-backend-recurse] Error 2
make[1]: Leaving directory `/opt/postgresql-9.5.3/src'
make: *** [all-src-recurse] Error 2
Any help would be appreciated. Do i need to give any particular CFLAGS ?
Below is the configure command -
./configure --prefix=/opt/postgres/9.5.3 CC=/opt/SUNWspro/bin/cc 'CFLAGS=-xO3 -xarch=v9 -xspace -W0,-Lt -W2,-Rcond_elim -Xa -xildoff -xc99=none -xCC' --enable-cassert --without-readline --enable-thread-safety LDFLAGS='-L/usr/lib/sparcv9 -L/usr/ucblib/sparcv9'
#include <sys/atomic.h>
int main()
{
atomic_cas_64(NULL,NULL,NULL);
}
/opt/SUNWspro/bin/cc -m64 atomic_cas_64-test.c -o atomic_cas_64-test
ldd atomic_cas_64-test
I tried adding an option CFLAGS_SSE42='-msse4.2'. No luck.Operating System-bash-3.00$ uname -aSunOS sunfire2 5.10 Generic sun4u sparc SUNW,Sun-Fire-V210configure command output. Please let me know if you need config.log file-checking build system type... sparc-sun-solaris2.10checking host system type... sparc-sun-solaris2.10checking which template to use... solarischecking whether to build with 64-bit integer date/time support... yeschecking whether NLS is wanted... nochecking for default port number... 5432checking for block size... 8kBchecking for segment size... 1GBchecking for WAL block size... 8kBchecking for WAL segment size... 16MBchecking whether the C compiler works... yeschecking for C compiler default output file name... a.outchecking for suffix of executables...checking whether we are cross compiling... nochecking for suffix of object files... ochecking whether we are using the GNU C compiler... nochecking whether /opt/SUNWspro/bin/cc accepts -g... yeschecking for /opt/SUNWspro/bin/cc option to accept ISO C89... none neededchecking whether the C compiler still works... yeschecking how to run the C preprocessor... /opt/SUNWspro/bin/cc -Xa -Echecking allow thread-safe client libraries... yeschecking whether to build with Tcl... nochecking whether to build Perl modules... nochecking whether to build Python modules... nochecking whether to build with GSSAPI support... nochecking whether to build with PAM support... nochecking whether to build with LDAP support... nochecking whether to build with Bonjour support... nochecking whether to build with OpenSSL support... nochecking whether to build with SELinux support... nochecking for grep that handles long lines and -e... /usr/sfw/bin/ggrepchecking for egrep... /usr/sfw/bin/ggrep -Echecking for non-GNU ld... /usr/ucb/ldchecking if the linker (/usr/ucb/ld) is GNU ld... nochecking for ranlib... ranlibchecking for strip... stripchecking whether it is possible to strip libraries... nochecking for ar... archecking for a BSD-compatible install... config/install-sh -cchecking for tar... /usr/bin/tarchecking whether ln -s works... yeschecking for gawk... nochecking for mawk... nochecking for nawk... nawkchecking for a thread-safe mkdir -p... /opt/sfw/bin/gmkdir -pchecking for bison... /usr/sfw/bin/bisonconfigure: using bison (GNU Bison) 1.875checking for flex... configure: WARNING:*** The installed version of Flex, /usr/sfw/bin/flex, is too old to use with PostgreSQL.*** Flex version 2.5.31 or later is required, but this is /usr/sfw/bin/flex version 2.5.4.noconfigure: WARNING:*** Without Flex you will not be able to build PostgreSQL from Git nor*** change any of the scanner definition files. You can obtain Flex from*** a GNU mirror site. (If you are using the official distribution of*** PostgreSQL then you do not need to worry about this because the Flex*** output is pre-generated.)checking for perl... /usr/bin/perlconfigure: using perl 5.8.4checking for main in -lm... yeschecking for library containing setproctitle... nochecking for library containing dlopen... none requiredchecking for library containing socket... -lsocketchecking for library containing shl_load... nochecking for library containing getopt_long... none requiredchecking for library containing crypt... none requiredchecking for library containing shm_open... -lrtchecking for library containing shm_unlink... none requiredchecking for library containing fdatasync... none requiredchecking for library containing sched_yield... none requiredchecking for library containing gethostbyname_r... -lnslchecking for library containing shmget... none requiredchecking for inflate in -lz... yeschecking for ANSI C header files... yeschecking for sys/types.h... yeschecking for sys/stat.h... yeschecking for stdlib.h... yeschecking for string.h... yeschecking for memory.h... yeschecking for strings.h... yeschecking for inttypes.h... yeschecking for stdint.h... yeschecking for unistd.h... yeschecking atomic.h usability... yeschecking atomic.h presence... yeschecking for atomic.h... yeschecking crypt.h usability... yeschecking crypt.h presence... yeschecking for crypt.h... yeschecking dld.h usability... nochecking dld.h presence... nochecking for dld.h... nochecking fp_class.h usability... nochecking fp_class.h presence... nochecking for fp_class.h... nochecking getopt.h usability... yeschecking getopt.h presence... yeschecking for getopt.h... yeschecking ieeefp.h usability... yeschecking ieeefp.h presence... yeschecking for ieeefp.h... yeschecking ifaddrs.h usability... nochecking ifaddrs.h presence... nochecking for ifaddrs.h... nochecking langinfo.h usability... yeschecking langinfo.h presence... yeschecking for langinfo.h... yeschecking mbarrier.h usability... nochecking mbarrier.h presence... nochecking for mbarrier.h... nochecking poll.h usability... yeschecking poll.h presence... yeschecking for poll.h... yeschecking pwd.h usability... yeschecking pwd.h presence... yeschecking for pwd.h... yeschecking sys/ioctl.h usability... yeschecking sys/ioctl.h presence... yeschecking for sys/ioctl.h... yeschecking sys/ipc.h usability... yeschecking sys/ipc.h presence... yeschecking for sys/ipc.h... yeschecking sys/poll.h usability... yeschecking sys/poll.h presence... yeschecking for sys/poll.h... yeschecking sys/pstat.h usability... nochecking sys/pstat.h presence... nochecking for sys/pstat.h... nochecking sys/resource.h usability... yeschecking sys/resource.h presence... yeschecking for sys/resource.h... yeschecking sys/select.h usability... yeschecking sys/select.h presence... yeschecking for sys/select.h... yeschecking sys/sem.h usability... yeschecking sys/sem.h presence... yeschecking for sys/sem.h... yeschecking sys/shm.h usability... yeschecking sys/shm.h presence... yeschecking for sys/shm.h... yeschecking sys/socket.h usability... yeschecking sys/socket.h presence... yeschecking for sys/socket.h... yeschecking sys/sockio.h usability... yeschecking sys/sockio.h presence... yeschecking for sys/sockio.h... yeschecking sys/tas.h usability... nochecking sys/tas.h presence... nochecking for sys/tas.h... nochecking sys/time.h usability... yeschecking sys/time.h presence... yeschecking for sys/time.h... yeschecking sys/un.h usability... yeschecking sys/un.h presence... yeschecking for sys/un.h... yeschecking termios.h usability... yeschecking termios.h presence... yeschecking for termios.h... yeschecking ucred.h usability... yeschecking ucred.h presence... yeschecking for ucred.h... yeschecking utime.h usability... yeschecking utime.h presence... yeschecking for utime.h... yeschecking wchar.h usability... yeschecking wchar.h presence... yeschecking for wchar.h... yeschecking wctype.h usability... yeschecking wctype.h presence... yeschecking for wctype.h... yeschecking for net/if.h... yeschecking for sys/ucred.h... nochecking netinet/in.h usability... yeschecking netinet/in.h presence... yeschecking for netinet/in.h... yeschecking for netinet/tcp.h... yeschecking zlib.h usability... yeschecking zlib.h presence... yeschecking for zlib.h... yeschecking whether byte ordering is bigendian... yeschecking for inline... nochecking for quiet inline (no complaint if unreferenced)... nochecking for printf format archetype... printfchecking for flexible array members... nochecking for signed types... yeschecking for __func__... nochecking for __FUNCTION__... nochecking for _Static_assert... nochecking for __builtin_types_compatible_p... nochecking for __builtin_bswap32... nochecking for __builtin_constant_p... nochecking for __builtin_unreachable... nochecking for __VA_ARGS__... nochecking whether struct tm is in sys/time.h or time.h... time.hchecking for struct tm.tm_zone... nochecking for tzname... yeschecking for union semun... nochecking for struct sockaddr_un... yeschecking for struct sockaddr_storage... yeschecking for struct sockaddr_storage.ss_family... yeschecking for struct sockaddr_storage.__ss_family... nochecking for struct sockaddr_storage.ss_len... nochecking for struct sockaddr_storage.__ss_len... nochecking for struct sockaddr.sa_len... nochecking for struct addrinfo... yeschecking for intptr_t... yeschecking for uintptr_t... yeschecking for unsigned long long int... yeschecking for long long int... yeschecking for locale_t... nochecking for struct cmsgcred... nochecking for struct option... yeschecking for z_streamp... yeschecking for special C compiler options needed for large files... nochecking for _FILE_OFFSET_BITS value needed for large files... nochecking size of off_t... 8checking for int timezone... yeschecking types of arguments for accept()... int, int, struct sockaddr *, int *checking whether gettimeofday takes only one argument... nochecking for wcstombs_l declaration... nochecking for cbrt... yeschecking for dlopen... yeschecking for fdatasync... yeschecking for getifaddrs... nochecking for getpeerucred... yeschecking for getrlimit... yeschecking for mbstowcs_l... nochecking for memmove... yeschecking for poll... yeschecking for pstat... nochecking for pthread_is_threaded_np... nochecking for readlink... yeschecking for setproctitle... nochecking for setsid... yeschecking for shm_open... yeschecking for sigprocmask... yeschecking for symlink... yeschecking for sync_file_range... nochecking for towlower... yeschecking for utime... yeschecking for utimes... yeschecking for wcstombs... yeschecking for wcstombs_l... nochecking for fseeko... yeschecking for _LARGEFILE_SOURCE value needed for large files... nochecking whether fdatasync is declared... yeschecking whether strlcat is declared... yeschecking whether strlcpy is declared... yeschecking whether F_FULLFSYNC is declared... nochecking for struct sockaddr_in6... yeschecking for PS_STRINGS... nochecking for snprintf... yeschecking for vsnprintf... yeschecking whether snprintf is declared... yeschecking whether vsnprintf is declared... yeschecking for isinf... nochecking for fpclass... yeschecking for crypt... yeschecking for fls... nochecking for getopt... yeschecking for getrusage... yeschecking for inet_aton... nochecking for mkdtemp... nochecking for random... yeschecking for rint... yeschecking for srandom... yeschecking for strerror... yeschecking for strlcat... yeschecking for strlcpy... yeschecking for unsetenv... yeschecking for getpeereid... nochecking for getaddrinfo... yeschecking for getopt_long... yeschecking for sigsetjmp... yeschecking whether sys_siglist is declared... nochecking for syslog... yeschecking syslog.h usability... yeschecking syslog.h presence... yeschecking for syslog.h... yeschecking for opterr... yeschecking for optreset... nochecking for strtoll... yeschecking for strtoull... yeschecking whether pthreads work with -pthread... nochecking whether pthreads work with -pthreads... nochecking for the pthreads library -lpthread... nochecking whether pthreads work with -mt... nochecking for the pthreads library -lpthreads... nochecking whether pthreads work without any flags... nochecking whether pthreads work with -Kthread... nochecking whether pthreads work with -kthread... nochecking for the pthreads library -llthread... nochecking whether pthreads work with -pthread... nochecking whether pthreads work with -pthreads... nochecking whether pthreads work with -mthreads... nochecking for the pthreads library -lpthread... nochecking whether pthreads work with --thread-safe... nochecking whether pthreads work with -mt... nochecking for pthread-config... nochecking for the pthreads library -lpthreadGC2... nochecking pthread.h usability... yeschecking pthread.h presence... yeschecking for pthread.h... yeschecking for strerror_r... yeschecking for getpwuid_r... yeschecking for gethostbyname_r... yeschecking whether strerror_r returns int... yeschecking test program... okchecking whether long int is 64 bits... yeschecking whether snprintf supports the %z modifier... yeschecking size of void *... 8checking size of size_t... 8checking size of long... 8checking whether to build with float4 passed by value... yeschecking whether to build with float8 passed by value... yeschecking alignment of short... 2checking alignment of int... 4checking alignment of long... 8checking alignment of double... 8checking for int8... nochecking for uint8... nochecking for int64... nochecking for uint64... nochecking for sig_atomic_t... yeschecking for __int128... nochecking for builtin __sync char locking functions... nochecking for builtin __sync int32 locking functions... nochecking for builtin __sync int32 atomic operations... nochecking for builtin __sync int64 atomic operations... nochecking for builtin __atomic int32 atomic operations... nochecking for builtin __atomic int64 atomic operations... nochecking for __get_cpuid... nochecking for __cpuid... nochecking for _mm_crc32_u8 and _mm_crc32_u32 with CFLAGS=... nochecking for _mm_crc32_u8 and _mm_crc32_u32 with CFLAGS=-msse4.2... nochecking which CRC-32C implementation to use... slicing-by-8checking for POSIX signal interface... yeschecking for onsgmls... onsgmlschecking for openjade... openjadechecking for DocBook V4.2... nochecking for DocBook stylesheets... /usr/share/sgml/docbook/dsssl-stylesheetschecking for dbtoepub... nochecking for xmllint... xmllintchecking for xsltproc... xsltprocchecking for osx... osxchecking thread safety of required library functions... yeschecking whether /opt/SUNWspro/bin/cc -Xa supports -Wl,--as-needed... noconfigure: using compiler=cc: Sun C 5.8 2005/10/13configure: using CFLAGS= -xO3 -xarch=v9 -xspace -W0,-Lt -W2,-Rcond_elim -Xa -xildoff -xc99=none -xCC -msse4.2configure: using CPPFLAGS=configure: using LDFLAGS=-L/usr/lib/sparcv9 -L/usr/ucblib/sparcv9configure: creating ./config.statusconfig.status: creating GNUmakefileconfig.status: creating src/Makefile.globalconfig.status: creating src/include/pg_config.hconfig.status: src/include/pg_config.h is unchangedconfig.status: creating src/include/pg_config_ext.hconfig.status: src/include/pg_config_ext.h is unchangedconfig.status: creating src/interfaces/ecpg/include/ecpg_config.hconfig.status: src/interfaces/ecpg/include/ecpg_config.h is unchangedconfig.status: linking src/backend/port/tas/sunstudio_sparc.s to src/backend/port/tas.sconfig.status: linking src/backend/port/dynloader/solaris.c to src/backend/port/dynloader.cconfig.status: linking src/backend/port/sysv_sema.c to src/backend/port/pg_sema.cconfig.status: linking src/backend/port/sysv_shmem.c to src/backend/port/pg_shmem.cconfig.status: linking src/backend/port/unix_latch.c to src/backend/port/pg_latch.cconfig.status: linking src/backend/port/dynloader/solaris.h to src/include/dynloader.hconfig.status: linking src/include/port/solaris.h to src/include/pg_config_os.hconfig.status: linking src/makefiles/Makefile.solaris to src/Makefile.portRegards,Venkata B NFujitsu Australia
On Friday, May 20, 2016 3:14:54 PM EDT Venkata Balaji N wrote: > Hi, > > "make" command is generating the following error while compiling > postgresql-9.5.3 on Solaris SPARC. > > I tried compiling 9.2 and 9.3, works fine. This is only happening on 9.5. ... snip ... > > Regards, > Venkata B N > > Fujitsu Australia I would suggest reporting this on pgsql-hackers. I know some work was done on the atomics over the last little while.
On Fri, May 20, 2016 at 10:38 AM, Jan de Visser <jan@de-visser.net> wrote: > I would suggest reporting this on pgsql-hackers. I know some work was done on > the atomics over the last little while. If that's an issue (no sparc environment here), we're looking at b64d92f1 here that was new stuff in 9.5. -- Michael
Venkata Balaji N <nag1010@gmail.com> writes: > "make" command is generating the following error while compiling > postgresql-9.5.3 on Solaris SPARC. > Undefined first referenced > symbol in file > atomic_cas_64 port/atomics.o > atomic_cas_32 port/atomics.o Hmm. Do you get any warnings about references to those functions earlier in the build? src/include/port/atomics/generic-sunpro.h cites these references as authority for believing that those functions exist in Solaris: http://www.unix.com/man-page/opensolaris/3c/atomic_cas/ http://docs.oracle.com/cd/E23824_01/html/821-1465/atomic-cas-3c.html I see that the first of those mentions it's for SunOS 5.11 whereas your machine says it's 5.10 ... is it possible the functions were new in 5.11? regards, tom lane
On Fri, May 20, 2016 at 11:04 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote: > src/include/port/atomics/generic-sunpro.h cites these references > as authority for believing that those functions exist in Solaris: > > http://www.unix.com/man-page/opensolaris/3c/atomic_cas/ > http://docs.oracle.com/cd/E23824_01/html/821-1465/atomic-cas-3c.html > > I see that the first of those mentions it's for SunOS 5.11 whereas your > machine says it's 5.10 ... is it possible the functions were new in 5.11? Those two are listed in SunOS 5.10 man pages: http://www.unix.com/man-page/sunos/3c/atomic_cas/ -- Michael
Venkata Balaji N <nag1010@gmail.com> writes:
> "make" command is generating the following error while compiling
> postgresql-9.5.3 on Solaris SPARC.
> Undefined first referenced
> symbol in file
> atomic_cas_64 port/atomics.o
> atomic_cas_32 port/atomics.o
Hmm. Do you get any warnings about references to those functions earlier
in the build?
src/include/port/atomics/generic-sunpro.h cites these references
as authority for believing that those functions exist in Solaris:
http://www.unix.com/man-page/opensolaris/3c/atomic_cas/
http://docs.oracle.com/cd/E23824_01/html/821-1465/atomic-cas-3c.html
I see that the first of those mentions it's for SunOS 5.11 whereas your
machine says it's 5.10 ... is it possible the functions were new in 5.11?
Venkata Balaji N <nag1010@gmail.com> writes: > On Sat, May 21, 2016 at 1:04 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote: >> http://www.unix.com/man-page/opensolaris/3c/atomic_cas/ >> http://docs.oracle.com/cd/E23824_01/html/821-1465/atomic-cas-3c.html >> >> I see that the first of those mentions it's for SunOS 5.11 whereas your >> machine says it's 5.10 ... is it possible the functions were new in 5.11? > I am not 100% sure. By the error, what i understand is that for some reason > PostgreSQL version 9.5.x is expecting the SunOS version to be more recent > than 5.10. Well, it's not --- we have a buildfarm animal that's running 5.10, and it seems perfectly happy: http://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=castoroides&dt=2016-05-21%2014%3A00%3A47 At this point I suspect that Asif Naeem was correct upthread in questioning your compile options --- particularly the -L switches. castoroides seems to just be using this: 'config_env' => { 'CFLAGS' => '-m64 -xarch=native -xdepend -xO4 -xprefetch=auto,explicit', 'CC' => 'cc', 'LDFLAGS' => '' }, regards, tom lane
Venkata Balaji N <nag1010@gmail.com> writes:
> On Sat, May 21, 2016 at 1:04 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> http://www.unix.com/man-page/opensolaris/3c/atomic_cas/
>> http://docs.oracle.com/cd/E23824_01/html/821-1465/atomic-cas-3c.html
>>
>> I see that the first of those mentions it's for SunOS 5.11 whereas your
>> machine says it's 5.10 ... is it possible the functions were new in 5.11?
> I am not 100% sure. By the error, what i understand is that for some reason
> PostgreSQL version 9.5.x is expecting the SunOS version to be more recent
> than 5.10.
Well, it's not --- we have a buildfarm animal that's running 5.10, and
it seems perfectly happy:
http://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=castoroides&dt=2016-05-21%2014%3A00%3A47
At this point I suspect that Asif Naeem was correct upthread in
questioning your compile options --- particularly the -L switches.
castoroides seems to just be using this:
'config_env' => {
'CFLAGS' => '-m64 -xarch=native -xdepend -xO4 -xprefetch=auto,explicit',
'CC' => 'cc',
'LDFLAGS' => ''
},
Any help would be appreciated. Do i need to give any particular CFLAGS ?
Below is the configure command -
./configure --prefix=/opt/postgres/9.5.3 CC=/opt/SUNWspro/bin/cc 'CFLAGS=-xO3 -xarch=v9 -xspace -W0,-Lt -W2,-Rcond_elim -Xa -xildoff -xc99=none -xCC' --enable-cassert --without-readline --enable-thread-safety LDFLAGS='-L/usr/lib/sparcv9 -L/usr/ucblib/sparcv9'
AFAIR I deprived use of -xarch=v9 and used -m64 instead. I wonder why are you using LDFLAGS='-L/usr/lib/sparcv9 -L/usr/ucblib/sparcv9', when you provide -xarch=v9 compiler should automatically pick the correct libraries and headers I think. There seems lot of cflags used, are you using them because of any recommendation or any issue faced ?.
On Sun, May 22, 2016 at 1:59 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:Venkata Balaji N <nag1010@gmail.com> writes:
> On Sat, May 21, 2016 at 1:04 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> http://www.unix.com/man-page/opensolaris/3c/atomic_cas/
>> http://docs.oracle.com/cd/E23824_01/html/821-1465/atomic-cas-3c.html
>>
>> I see that the first of those mentions it's for SunOS 5.11 whereas your
>> machine says it's 5.10 ... is it possible the functions were new in 5.11?
> I am not 100% sure. By the error, what i understand is that for some reason
> PostgreSQL version 9.5.x is expecting the SunOS version to be more recent
> than 5.10.
Well, it's not --- we have a buildfarm animal that's running 5.10, and
it seems perfectly happy:
http://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=castoroides&dt=2016-05-21%2014%3A00%3A47
At this point I suspect that Asif Naeem was correct upthread in
questioning your compile options --- particularly the -L switches.
castoroides seems to just be using this:
'config_env' => {
'CFLAGS' => '-m64 -xarch=native -xdepend -xO4 -xprefetch=auto,explicit',
'CC' => 'cc',
'LDFLAGS' => ''
},Thanks. Then, as i suspected, the problem must be around using appropriate CFLAGS, which i am not sure at what to use. One thing i can say at this point is that, if i just add "-m64" option in CFLAGS, i get an error illegal option.I will re-test the compilation and get back with the inputs.