postgresql make check报postgres.lto.o:(.note.stapsdt+0x4ac): undefined reference to `postgresql_lwlock__acquire_semaphore'
如下:
/usr/bin/ld: postgres.lto.o:(.note.stapsdt+0x24): undefined reference to `postgresql_statement__status_semaphore' /usr/bin/ld: postgres.lto.o:(.note.stapsdt+0x74): undefined reference to `postgresql_deadlock__found_semaphore' /usr/bin/ld: postgres.lto.o:(.note.stapsdt+0xbc): undefined reference to `postgresql_lwlock__condacquire_semaphore' /usr/bin/ld: postgres.lto.o:(.note.stapsdt+0x120): undefined reference to `postgresql_lwlock__condacquire__fail_semaphore' /usr/bin/ld: postgres.lto.o:(.note.stapsdt+0x188): undefined reference to `postgresql_lwlock__release_semaphore' /usr/bin/ld: postgres.lto.o:(.note.stapsdt+0x1e0): undefined reference to `postgresql_lwlock__wait__start_semaphore' /usr/bin/ld: postgres.lto.o:(.note.stapsdt+0x244): undefined reference to `postgresql_lwlock__wait__done_semaphore' /usr/bin/ld: postgres.lto.o:(.note.stapsdt+0x2a8): undefined reference to `postgresql_lwlock__acquire_semaphore' /usr/bin/ld: postgres.lto.o:(.note.stapsdt+0x308): undefined reference to `postgresql_lwlock__acquire__or__wait_semaphore' /usr/bin/ld: postgres.lto.o:(.note.stapsdt+0x374): undefined reference to `postgresql_lwlock__wait__start_semaphore' /usr/bin/ld: postgres.lto.o:(.note.stapsdt+0x3d8): undefined reference to `postgresql_lwlock__wait__done_semaphore' /usr/bin/ld: postgres.lto.o:(.note.stapsdt+0x43c): undefined reference to `postgresql_lwlock__acquire__or__wait__fail_semaphore' /usr/bin/ld: postgres.lto.o:(.note.stapsdt+0x4ac): undefined reference to `postgresql_lwlock__acquire_semaphore' /usr/bin/ld: postgres.lto.o:(.note.stapsdt+0x50c): undefined reference to `postgresql_lwlock__wait__start_semaphore' /usr/bin/ld: postgres.lto.o:(.note.stapsdt+0x570): undefined reference to `postgresql_lwlock__wait__done_semaphore' /usr/bin/ld: postgres.lto.o:(.note.stapsdt+0x5d0): undefined reference to `postgresql_sort__done_semaphore' /usr/bin/ld: postgres.lto.o:(.note.stapsdt+0x624): undefined reference to `postgresql_transaction__start_semaphore' /usr/bin/ld: postgres.lto.o:(.note.stapsdt+0x678): undefined reference to `postgresql_twophase__checkpoint__start_semaphore' /usr/bin/ld: postgres.lto.o:(.note.stapsdt+0x6cc): undefined reference to `postgresql_twophase__checkpoint__done_semaphore' /usr/bin/ld: postgres.lto.o:(.note.stapsdt+0x720): undefined reference to `postgresql_query__parse__start_semaphore' /usr/bin/ld: postgres.lto.o:(.note.stapsdt+0x774): undefined reference to `postgresql_query__parse__done_semaphore' /usr/bin/ld: postgres.lto.o:(.note.stapsdt+0x7c8): undefined reference to `postgresql_wal__buffer__write__dirty__start_semaphore' /usr/bin/ld: postgres.lto.o:(.note.stapsdt+0x824): undefined reference to `postgresql_wal__buffer__write__dirty__done_semaphore' /usr/bin/ld: postgres.lto.o:(.note.stapsdt+0x87c): undefined reference to `postgresql_wal__switch_semaphore' /usr/bin/ld: postgres.lto.o:(.note.stapsdt+0x8c0): undefined reference to `postgresql_wal__insert_semaphore' /usr/bin/ld: postgres.lto.o:(.note.stapsdt+0x914): undefined reference to `postgresql_lock__wait__start_semaphore' /usr/bin/ld: postgres.lto.o:(.note.stapsdt+0x99c): undefined reference to `postgresql_lock__wait__done_semaphore' /usr/bin/ld: postgres.lto.o:(.note.stapsdt+0xa20): undefined reference to `postgresql_sort__start_semaphore' /usr/bin/ld: postgres.lto.o:(.note.stapsdt+0xa90): undefined reference to `postgresql_sort__start_semaphore' /usr/bin/ld: postgres.lto.o:(.note.stapsdt+0xb04): undefined reference to `postgresql_clog__checkpoint__start_semaphore' /usr/bin/ld: postgres.lto.o:(.note.stapsdt+0xb5c): undefined reference to `postgresql_clog__checkpoint__done_semaphore' /usr/bin/ld: postgres.lto.o:(.note.stapsdt+0xbb0): undefined reference to `postgresql_clog__checkpoint__start_semaphore' /usr/bin/ld: postgres.lto.o:(.note.stapsdt+0xc08): undefined reference to `postgresql_clog__checkpoint__done_semaphore' /usr/bin/ld: postgres.lto.o:(.note.stapsdt+0xc5c): undefined reference to `postgresql_multixact__checkpoint__start_semaphore' /usr/bin/ld: postgres.lto.o:(.note.stapsdt+0xcb8): undefined reference to `postgresql_multixact__checkpoint__done_semaphore' /usr/bin/ld: postgres.lto.o:(.note.stapsdt+0xd14): undefined reference to `postgresql_multixact__checkpoint__start_semaphore' /usr/bin/ld: postgres.lto.o:(.note.stapsdt+0xd70): undefined reference to `postgresql_multixact__checkpoint__done_semaphore' /usr/bin/ld: postgres.lto.o:(.note.stapsdt+0xdcc): undefined reference to `postgresql_subtrans__checkpoint__start_semaphore' /usr/bin/ld: postgres.lto.o:(.note.stapsdt+0xe28): undefined reference to `postgresql_subtrans__checkpoint__done_semaphore' /usr/bin/ld: postgres.lto.o:(.note.stapsdt+0xe80): undefined reference to `postgresql_subtrans__checkpoint__start_semaphore' /usr/bin/ld: postgres.lto.o:(.note.stapsdt+0xedc): undefined reference to `postgresql_subtrans__checkpoint__done_semaphore' /usr/bin/ld: postgres.lto.o:(.note.stapsdt+0xf34): undefined reference to `postgresql_buffer__flush__start_semaphore' /usr/bin/ld: postgres.lto.o:(.note.stapsdt+0xfb8): undefined reference to `postgresql_buffer__flush__done_semaphore' /usr/bin/ld: postgres.lto.o:(.note.stapsdt+0x1038): undefined reference to `postgresql_buffer__read__start_semaphore' /usr/bin/ld: postgres.lto.o:(.note.stapsdt+0x10c4): undefined reference to `postgresql_buffer__read__done_semaphore' /usr/bin/ld: postgres.lto.o:(.note.stapsdt+0x1164): undefined reference to `postgresql_buffer__read__done_semaphore' /usr/bin/ld: postgres.lto.o:(.note.stapsdt+0x11fc): undefined reference to `postgresql_buffer__write__dirty__start_semaphore' /usr/bin/ld: postgres.lto.o:(.note.stapsdt+0x1280): undefined reference to `postgresql_buffer__write__dirty__done_semaphore' /usr/bin/ld: postgres.lto.o:(.note.stapsdt+0x1304): undefined reference to `postgresql_sort__start_semaphore' /usr/bin/ld: postgres.lto.o:(.note.stapsdt+0x1378): undefined reference to `postgresql_sort__start_semaphore' /usr/bin/ld: postgres.lto.o:(.note.stapsdt+0x13e8): undefined reference to `postgresql_buffer__sync__start_semaphore' /usr/bin/ld: postgres.lto.o:(.note.stapsdt+0x1444): undefined reference to `postgresql_buffer__sync__done_semaphore' /usr/bin/ld: postgres.lto.o:(.note.stapsdt+0x14b4): undefined reference to `postgresql_buffer__sync__written_semaphore' /usr/bin/ld: postgres.lto.o:(.note.stapsdt+0x150c): undefined reference to `postgresql_buffer__checkpoint__start_semaphore' /usr/bin/ld: postgres.lto.o:(.note.stapsdt+0x1568): undefined reference to `postgresql_buffer__checkpoint__sync__start_semaphore' /usr/bin/ld: postgres.lto.o:(.note.stapsdt+0x15c0): undefined reference to `postgresql_buffer__checkpoint__done_semaphore' /usr/bin/ld: postgres.lto.o:(.note.stapsdt+0x1614): undefined reference to `postgresql_checkpoint__start_semaphore' /usr/bin/ld: postgres.lto.o:(.note.stapsdt+0x1668): undefined reference to `postgresql_checkpoint__done_semaphore' /usr/bin/ld: postgres.lto.o:(.note.stapsdt+0x1734): undefined reference to `postgresql_transaction__abort_semaphore' /usr/bin/ld: postgres.lto.o:(.note.stapsdt+0x178c): undefined reference to `postgresql_query__rewrite__start_semaphore' /usr/bin/ld: postgres.lto.o:(.note.stapsdt+0x17e0): undefined reference to `postgresql_query__rewrite__done_semaphore' /usr/bin/ld: postgres.lto.o:(.note.stapsdt+0x1834): undefined reference to `postgresql_query__rewrite__start_semaphore' /usr/bin/ld: postgres.lto.o:(.note.stapsdt+0x1888): undefined reference to `postgresql_query__rewrite__done_semaphore' /usr/bin/ld: postgres.lto.o:(.note.stapsdt+0x18dc): undefined reference to `postgresql_transaction__commit_semaphore' /usr/bin/ld: postgres.lto.o:(.note.stapsdt+0x1934): undefined reference to `postgresql_query__plan__start_semaphore' /usr/bin/ld: postgres.lto.o:(.note.stapsdt+0x1980): undefined reference to `postgresql_query__plan__done_semaphore' /usr/bin/ld: postgres.lto.o:(.note.stapsdt+0x19cc): undefined reference to `postgresql_smgr__md__read__start_semaphore' /usr/bin/ld: postgres.lto.o:(.note.stapsdt+0x1a54): undefined reference to `postgresql_smgr__md__read__done_semaphore' /usr/bin/ld: postgres.lto.o:(.note.stapsdt+0x1aec): undefined reference to `postgresql_smgr__md__write__start_semaphore' /usr/bin/ld: postgres.lto.o:(.note.stapsdt+0x1b74): undefined reference to `postgresql_smgr__md__write__done_semaphore' /usr/bin/ld: postgres.lto.o:(.note.stapsdt+0x1c10): undefined reference to `postgresql_query__execute__start_semaphore' /usr/bin/ld: postgres.lto.o:(.note.stapsdt+0x1c60): undefined reference to `postgresql_query__execute__done_semaphore' /usr/bin/ld: postgres.lto.o:(.note.stapsdt+0x1cb0): undefined reference to `postgresql_query__execute__start_semaphore' /usr/bin/ld: postgres.lto.o:(.note.stapsdt+0x1d00): undefined reference to `postgresql_query__execute__done_semaphore' /usr/bin/ld: postgres.lto.o:(.note.stapsdt+0x1d50): undefined reference to `postgresql_query__start_semaphore' /usr/bin/ld: postgres.lto.o:(.note.stapsdt+0x1d9c): undefined reference to `postgresql_query__done_semaphore' collect2: error: ld returned 1 exit status make[2]: *** [Makefile:63: postgres] Error 1 make[2]: Leaving directory
原因make和make --check时候的编译选项不同所致,一个带了--enable-dtrace,另外一个没带。例如,debug模式带了,非debug模式不带。
if [ "$debug" = true ]; then if [ "$gprof" = true ]; then conf_opt="$conf_opt --enable-profiling" fi CFLAGS='-O0 -g3 -gdwarf-4' ./configure $conf_opt --enable-dtrace --enable-tap-tests --enable-depend --enable-cassert else CFLAGS='-O2 -g' ./configure $conf_opt --without-readline fi
而make --check是debug模式运行的,导致很多.o文件直接重用,所以会出现找不到符号的情况。