Ok after looking into the glib_c ones i found that on the mac 
v8_use_libm_trig_functions is true on the mac 
this causes this conditional to be defined since i'm building as a stati 
clibrary
#if defined(V8_USE_LIBM_TRIG_FUNCTIONS)
// To ensure there aren't problems with libm's sin/cos, both implementations
// are shipped. The plan is to transition to libm once we ensure there are 
no
// compatibility or performance issues.
V8_BASE_EXPORT double fdlibm_sin(double x);
V8_BASE_EXPORT double fdlibm_cos(double x);

#if !defined(BUILDING_V8_BASE_SHARED) && !defined(USING_V8_BASE_SHARED)
inline double libm_sin(double x) { return glibc_sin(x); }
inline double libm_cos(double x) { return glibc_cos(x); }
#else
V8_BASE_EXPORT double libm_sin(double x);
V8_BASE_EXPORT double libm_cos(double x);
#endif
#else
V8_BASE_EXPORT double cos(double x);
V8_BASE_EXPORT double sin(double x);
#endif

so on a mac it should either default to off or  additional check is needed 
when not using glibc to define it as seomthing else.
I set v8_use_libm_trig_functions to false and was able to link with not 
problem now.


On Sunday, December 3, 2023 at 6:55:41 PM UTC-6 Ronald Fenner wrote:

Ok after switching over to my windows build machine I'm getting some of the 
same link errors as on the mac. It would see after i poked around on the 
mac side that some of the .o files for zlib are not bundled into the static 
library that is generated. I'm going to assume that it's probably the same 
for the windows as well. 
My arg file for windows are these
gn_args_release = {
'is_debug': 'false',
'is_component_build': 'false',
'v8_monolithic': 'false',
'v8_use_external_startup_data': 'true',
'is_clang': 'false',
'dcheck_always_on': 'false',
'v8_static_library': 'true',
'v8_enable_pointer_compression_shared_cage ':'false',
}

gn_args_debug = {
'is_debug': 'true',
'is_component_build': 'false',
'v8_monolithic': 'false',
'v8_use_external_startup_data': 'true',
'is_clang': 'false',
'v8_enable_backtrace': 'true',
'v8_enable_slow_dchecks': 'false',
'v8_optimized_debug': 'false',
'v8_static_library': 'true',
'v8_enable_pointer_compression_shared_cage ': 'false',
'enable_iterator_debugging':'true'
}
And mac
gn_args_release = {
'is_debug': 'false',
'is_component_build': 'false',
'v8_monolithic': 'false',
'v8_use_external_startup_data': 'true',
'dcheck_always_on': 'false',
'use_custom_libcxx': 'false',
'v8_static_library': 'true',
'v8_enable_pointer_compression_shared_cage ': 'false',
}

gn_args_debug = {
'is_debug': 'true',
'is_component_build': 'false',
'v8_monolithic': 'false',
'v8_use_external_startup_data': 'true',
'v8_enable_backtrace': 'true',
'v8_enable_slow_dchecks': 'true',
'v8_optimized_debug': 'false',
'use_custom_libcxx': 'false',
'v8_static_library': 'true',
'v8_enable_pointer_compression_shared_cage ': 'false',
'enable_iterator_debugging': 'true'
}

I'm also asking for it to only build these modules
build_v8_modules = [
'v8_compiler',
'v8_base_without_compiler',
'v8_libplatform',
'v8_libbase',
'torque_generated_initializers',
'torque_generated_definitions',
'v8_bigint',
'v8_heap_base',
'v8_heap_base_headers',
'v8_snapshot',
'cppgc_base',
'inspector'
]

I guess for now i'll modify my build process to bundle the missing .o files 
into their own lib but I'm not sure how to handle the glibc ones on the mac.

On Saturday, December 2, 2023 at 12:11:01 PM UTC-6 Ronald Fenner wrote:

Ok got bazel to use the arm64 version of the libs and they are reproting 
some undefined ones as well
  _Cr_z_adler32_simd_, referenced from:
      _Cr_z_adler32_z in libchrome_zlib.a[2](adler32.o)
  _Cr_z_armv8_crc32_little, referenced from:
      _Cr_z_crc32_z in libchrome_zlib.a[5](crc32.o)
      _Cr_z_crc32 in libchrome_zlib.a[5](crc32.o)
  _Cr_z_armv8_crc32_pmull_little, referenced from:
      _Cr_z_crc32_z in libchrome_zlib.a[5](crc32.o)
      _Cr_z_crc32 in libchrome_zlib.a[5](crc32.o)
  _Cr_z_inflate, referenced from:
      zlib_internal::UncompressHelper(zlib_internal::WrapperType, unsigned 
char*, unsigned long*, unsigned char const*, unsigned long) in 
libcompression_utils_portable.a[2](compression_utils_portable.o)
  _Cr_z_inflateEnd, referenced from:
      zlib_internal::UncompressHelper(zlib_internal::WrapperType, unsigned 
char*, unsigned long*, unsigned char const*, unsigned long) in 
libcompression_utils_portable.a[2](compression_utils_portable.o)
      zlib_internal::UncompressHelper(zlib_internal::WrapperType, unsigned 
char*, unsigned long*, unsigned char const*, unsigned long) in 
libcompression_utils_portable.a[2](compression_utils_portable.o)
  _Cr_z_inflateInit2_, referenced from:
      zlib_internal::UncompressHelper(zlib_internal::WrapperType, unsigned 
char*, unsigned long*, unsigned char const*, unsigned long) in 
libcompression_utils_portable.a[2](compression_utils_portable.o)
  _glibc_cos, referenced from:
      v8::base::ieee754::libm_cos(double) in 
libv8_base_without_compiler.a[63](external-reference.o)
  _glibc_sin, referenced from:
      v8::base::ieee754::libm_sin(double) in 
libv8_base_without_compiler.a[63](external-reference.o)

On Friday, December 1, 2023 at 10:55:48 PM UTC-6 Ronald Fenner wrote:

I've compiled v8 for x86_64 on an Apple M3 Max macbook pro. When I try to 
link the static libraies into an app i get the following undefined symbols

  _Cr_z_adler32_simd_, referenced from:
      _Cr_z_adler32_z in libchrome_zlib.a[2](adler32.o)
  _Cr_z_crc32_sse42_simd_, referenced from:
      _Cr_z_crc32_z in libchrome_zlib.a[5](crc32.o)
  _Cr_z_crc_fold_512to32, referenced from:
      _Cr_z_crc_finalize in libchrome_zlib.a[5](crc32.o)
  _Cr_z_crc_fold_copy, referenced from:
      _Cr_z_copy_with_crc in libchrome_zlib.a[5](crc32.o)
  _Cr_z_crc_fold_init, referenced from:
      _Cr_z_crc_reset in libchrome_zlib.a[5](crc32.o)
  _Cr_z_inflate, referenced from:
      zlib_internal::UncompressHelper(zlib_internal::WrapperType, unsigned 
char*, unsigned long*, unsigned char const*, unsigned long) in 
libcompression_utils_portable.a[2](compression_utils_portable.o)
  _Cr_z_inflateEnd, referenced from:
      zlib_internal::UncompressHelper(zlib_internal::WrapperType, unsigned 
char*, unsigned long*, unsigned char const*, unsigned long) in 
libcompression_utils_portable.a[2](compression_utils_portable.o)
      zlib_internal::UncompressHelper(zlib_internal::WrapperType, unsigned 
char*, unsigned long*, unsigned char const*, unsigned long) in 
libcompression_utils_portable.a[2](compression_utils_portable.o)
  _Cr_z_inflateInit2_, referenced from:
      zlib_internal::UncompressHelper(zlib_internal::WrapperType, unsigned 
char*, unsigned long*, unsigned char const*, unsigned long) in 
libcompression_utils_portable.a[2](compression_utils_portable.o)
  _glibc_cos, referenced from:
      v8::base::ieee754::libm_cos(double) in 
libv8_base_without_compiler.a[63](external-reference.o)
  _glibc_sin, referenced from:
      v8::base::ieee754::libm_sin(double) in 
libv8_base_without_compiler.a[63](external-reference.o)

When i run nm on the libchome_zlib.a i see a number of U's for symbols of 
which the above are inclluded.

I'm wondering what I need to add to get these to be not undefined and I 
suspect it might be cause I'm cross compiling.

Haven't been able to test the arm64 versions cause bazel is wanting to 
build x86_64 instead of arm64 when i try to build my app.

-- 
-- 
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev
--- 
You received this message because you are subscribed to the Google Groups 
"v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/v8-dev/f4521091-1f11-464f-bced-e3ad15113917n%40googlegroups.com.

Reply via email to