Conversation
liquidaty
left a comment
There was a problem hiding this comment.
I am not sufficiently familiar with this practice to opine very deeply on this approach, other than that I agree with this in general, and am good with these changes so long as you are comfortable that the manner of implementation conforms to industry standard / best practices.
UPDATETried to build and test the shared library on Fedora and ran into undefined reference issues.
#include <stdio.h>
#include <zsv.h>
int main() {
printf("zsv_lib_version: %s\n", zsv_lib_version());
return 0;
}Compile and link: $ gcc lib_test.c -o lib_test -lzsv
/usr/sbin/ld: /tmp/cc0N9dPk.o: in function `main':
lib_test.c:(.text+0x5): undefined reference to `zsv_lib_version'
collect2: error: ld returned 1 exit statusChecked $ nm -C /usr/lib/libzsv.so | grep zsv_lib_version
0000000000003ee0 t zsv_lib_versionObserve the lowercase $ nm -C /usr/lib/libzsv.so | grep zsv_
00000000000047b0 t zsv_abort
0000000000004810 t zsv_cell_count
0000000000005c90 t zsv_cum_scanned_length
0000000000005560 t zsv_delete
0000000000004be0 t zsv_finish
00000000000048c0 t zsv_get_cell
0000000000000460 t zsv_get_cell_1
00000000000048d0 t zsv_get_cell_len
0000000000004900 t zsv_get_cell_str
00000000000004b0 t zsv_get_cell_with_overwrite
0000000000003ee0 t zsv_lib_version
0000000000005630 t zsv_new
0000000000005380 t zsv_next_row
0000000000005cd0 t zsv_parse_bytes
0000000000004170 t zsv_parse_more
0000000000005bd0 t zsv_parse_status_desc
0000000000004bb0 t zsv_peek
0000000000000440 t zsv_pull_row
00000000000048a0 t zsv_quoted
00000000000047c0 t zsv_row_is_blank
0000000000005cc0 t zsv_row_length_raw_bytes
0000000000002710 t zsv_scan
0000000000000820 t zsv_scan_delim_pull
0000000000005c80 t zsv_scanned_length
0000000000004850 t zsv_set_context
0000000000004940 t zsv_set_fixed_offsets
0000000000004890 t zsv_set_input
0000000000004880 t zsv_set_read
0000000000004820 t zsv_set_row_handler
0000000000003ec0 t zsv_set_scan_filter
0000000000003f00 t zsv_strencode
0000000000000600 t zsv_strencode.constprop.0
00000000000024b0 t zsv_throwaway_rowAccording to Here's a related SO thread: The root cause is Line 671 in 93376e5 Line 826 in 93376e5 Lines 164 to 166 in 93376e5 Removing ${LIBZSV_SHARED_BUILD}: zsv.c zsv_internal.c
@mkdir -p `dirname "$@"`
- ${CC} ${CFLAGS} ${CFLAGS_VISIBILITY_HIDDEN} -DZSV_BUILD_SHARED -DZSV_VERSION=\"${VERSION}\" -I${INCLUDE_DIR} ${ZSV_OBJ_OPTS} -shared -fPIC ${LDFLAGS} -o $@ $< -I../app/external/sqlite3
+ ${CC} ${CFLAGS} -DZSV_BUILD_SHARED -DZSV_VERSION=\"${VERSION}\" -I${INCLUDE_DIR} ${ZSV_OBJ_OPTS} -shared -fPIC ${LDFLAGS} -o $@ $< -I../app/external/sqlite3
@echo Built $@
$ nm -C /usr/lib/libzsv.so | grep zsv_lib_version
00000000000007a0 T zsv_lib_versionVerified the rest and the ones marked as $ nm -C /usr/lib/libzsv.so | grep zsv_
0000000000003cf0 T zsv_abort
0000000000003d50 T zsv_cell_count
0000000000005970 T zsv_cum_scanned_length
0000000000005270 T zsv_delete
0000000000004920 T zsv_finish
0000000000004600 T zsv_get_cell
00000000000004e0 t zsv_get_cell_1
0000000000004610 T zsv_get_cell_len
0000000000004640 T zsv_get_cell_str
0000000000000530 t zsv_get_cell_with_overwrite
00000000000007a0 T zsv_lib_version
0000000000005310 T zsv_new
00000000000050d0 T zsv_next_row
00000000000059b0 T zsv_parse_bytes
00000000000036b0 T zsv_parse_more
00000000000058b0 T zsv_parse_status_desc
00000000000048f0 T zsv_peek
00000000000004c0 t zsv_pull_row
00000000000045e0 T zsv_quoted
0000000000003d00 T zsv_row_is_blank
00000000000059a0 T zsv_row_length_raw_bytes
0000000000002010 t zsv_scan
0000000000000a30 t zsv_scan_delim_pull
0000000000005960 T zsv_scanned_length
0000000000004590 T zsv_set_context
0000000000004680 T zsv_set_fixed_offsets
00000000000045d0 T zsv_set_input
00000000000045c0 T zsv_set_read
0000000000004560 T zsv_set_row_handler
0000000000000780 T zsv_set_scan_filter
00000000000007c0 T zsv_strencode
0000000000003d60 t zsv_throwaway_row
$ ldconfig -p | grep zsv
libzsv.so.1 (libc6,x86-64) => /lib/libzsv.so.1
libzsv.so (libc6,x86-64) => /lib/libzsv.soThe test program compiled, linked and ran successfully: $ gcc lib_test.c -o lib_test -lzsv
$ ./lib_test
zsv_lib_version: 1.1.0 |
|
Removed |
|
RE: #490 and #487 (comment) above Looks like both are related. |
|
@liquidaty: Need another look by you to finalize this. |
|
On the surface looks fine to me; I don't see any reason these changes would impact performance but generally with any compiler flag changes I prefer to check benchmarks to ensure expected performance. I've recently updated the benchmark tests in |
|
Sounds good. |
Related: #438 | #479
For RPM
zsv-develpackage, the versioned shared library has been required in the review.After this change,
make installwill generate the versioned shared library along with its symlinks:Under
builddirectory, onlylibzsv.so.1.1.0is generated.The symlinks are generated only for the installation directory.
SONAME verification with
objdump:$ objdump -p libzsv.so | grep SONAME SONAME libzsv.so.1NOTE: A new release will be required to proceed with the packaging.
Signed-off-by: Azeem Sajid [email protected]