Skip to content

undefined reference to `cctz_extension::zone_info_source_factory' #28

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
uhrd opened this issue Aug 18, 2023 · 2 comments
Open

undefined reference to `cctz_extension::zone_info_source_factory' #28

uhrd opened this issue Aug 18, 2023 · 2 comments

Comments

@uhrd
Copy link

uhrd commented Aug 18, 2023

I am having issues linking this on cygwin.

`Installing package into ‘/usr/lib/R/site-library’
(as ‘lib’ is unspecified)

  • installing source package ‘timechange’ ...
    staged installation is only possible with locking
    ** using non-staged installation
    ** libs
    using C compiler: ‘gcc (GCC) 11.4.0’
    using C++ compiler: ‘g++ (GCC) 11.4.0’
    using C++11
    g++ -std=gnu++11 -I"/usr/lib/R/include" -DNDEBUG -I. -I./cctz/src/ -I'/usr/lib/R/site-library/cpp11/include' -ggdb -O2 -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=
    2 -fstack-protector-strong --param=ssp-buffer-size=4 -Werror=return-type -fdebug-prefix-map=/cygdrive/d/a/scallywag/R/R-4.3.0-1.x86_64/build=/usr/src/debug/R-4.3.0-1 -fdebug-prefix-ma
    p=/cygdrive/d/a/scallywag/R/R-4.3.0-1.x86_64/src/R-4.3.0=/usr/src/debug/R-4.3.0-1 -c cctz/src/time_zone_fixed.cc -o cctz/src/time_zone_fixed.o
    g++ -std=gnu++11 -I"/usr/lib/R/include" -DNDEBUG -I. -I./cctz/src/ -I'/usr/lib/R/site-library/cpp11/include' -ggdb -O2 -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=
    2 -fstack-protector-strong --param=ssp-buffer-size=4 -Werror=return-type -fdebug-prefix-map=/cygdrive/d/a/scallywag/R/R-4.3.0-1.x86_64/build=/usr/src/debug/R-4.3.0-1 -fdebug-prefix-ma
    p=/cygdrive/d/a/scallywag/R/R-4.3.0-1.x86_64/src/R-4.3.0=/usr/src/debug/R-4.3.0-1 -c cctz/src/time_zone_if.cc -o cctz/src/time_zone_if.o
    g++ -std=gnu++11 -I"/usr/lib/R/include" -DNDEBUG -I. -I./cctz/src/ -I'/usr/lib/R/site-library/cpp11/include' -ggdb -O2 -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=
    2 -fstack-protector-strong --param=ssp-buffer-size=4 -Werror=return-type -fdebug-prefix-map=/cygdrive/d/a/scallywag/R/R-4.3.0-1.x86_64/build=/usr/src/debug/R-4.3.0-1 -fdebug-prefix-ma
    p=/cygdrive/d/a/scallywag/R/R-4.3.0-1.x86_64/src/R-4.3.0=/usr/src/debug/R-4.3.0-1 -c cctz/src/time_zone_impl.cc -o cctz/src/time_zone_impl.o
    g++ -std=gnu++11 -I"/usr/lib/R/include" -DNDEBUG -I. -I./cctz/src/ -I'/usr/lib/R/site-library/cpp11/include' -ggdb -O2 -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=
    2 -fstack-protector-strong --param=ssp-buffer-size=4 -Werror=return-type -fdebug-prefix-map=/cygdrive/d/a/scallywag/R/R-4.3.0-1.x86_64/build=/usr/src/debug/R-4.3.0-1 -fdebug-prefix-ma
    p=/cygdrive/d/a/scallywag/R/R-4.3.0-1.x86_64/src/R-4.3.0=/usr/src/debug/R-4.3.0-1 -c cctz/src/time_zone_info.cc -o cctz/src/time_zone_info.o
    g++ -std=gnu++11 -I"/usr/lib/R/include" -DNDEBUG -I. -I./cctz/src/ -I'/usr/lib/R/site-library/cpp11/include' -ggdb -O2 -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=
    2 -fstack-protector-strong --param=ssp-buffer-size=4 -Werror=return-type -fdebug-prefix-map=/cygdrive/d/a/scallywag/R/R-4.3.0-1.x86_64/build=/usr/src/debug/R-4.3.0-1 -fdebug-prefix-ma
    p=/cygdrive/d/a/scallywag/R/R-4.3.0-1.x86_64/src/R-4.3.0=/usr/src/debug/R-4.3.0-1 -c cctz/src/time_zone_libc.cc -o cctz/src/time_zone_libc.o
    g++ -std=gnu++11 -I"/usr/lib/R/include" -DNDEBUG -I. -I./cctz/src/ -I'/usr/lib/R/site-library/cpp11/include' -ggdb -O2 -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=
    2 -fstack-protector-strong --param=ssp-buffer-size=4 -Werror=return-type -fdebug-prefix-map=/cygdrive/d/a/scallywag/R/R-4.3.0-1.x86_64/build=/usr/src/debug/R-4.3.0-1 -fdebug-prefix-ma
    p=/cygdrive/d/a/scallywag/R/R-4.3.0-1.x86_64/src/R-4.3.0=/usr/src/debug/R-4.3.0-1 -c cctz/src/time_zone_lookup.cc -o cctz/src/time_zone_lookup.o
    g++ -std=gnu++11 -I"/usr/lib/R/include" -DNDEBUG -I. -I./cctz/src/ -I'/usr/lib/R/site-library/cpp11/include' -ggdb -O2 -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=
    2 -fstack-protector-strong --param=ssp-buffer-size=4 -Werror=return-type -fdebug-prefix-map=/cygdrive/d/a/scallywag/R/R-4.3.0-1.x86_64/build=/usr/src/debug/R-4.3.0-1 -fdebug-prefix-ma
    p=/cygdrive/d/a/scallywag/R/R-4.3.0-1.x86_64/src/R-4.3.0=/usr/src/debug/R-4.3.0-1 -c cctz/src/time_zone_posix.cc -o cctz/src/time_zone_posix.o
    g++ -std=gnu++11 -I"/usr/lib/R/include" -DNDEBUG -I. -I./cctz/src/ -I'/usr/lib/R/site-library/cpp11/include' -ggdb -O2 -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=
    2 -fstack-protector-strong --param=ssp-buffer-size=4 -Werror=return-type -fdebug-prefix-map=/cygdrive/d/a/scallywag/R/R-4.3.0-1.x86_64/build=/usr/src/debug/R-4.3.0-1 -fdebug-prefix-ma
    p=/cygdrive/d/a/scallywag/R/R-4.3.0-1.x86_64/src/R-4.3.0=/usr/src/debug/R-4.3.0-1 -c cctz/src/zone_info_source.cc -o cctz/src/zone_info_source.o
    ar rcs libcctz.a ./cctz/src/time_zone_fixed.o ./cctz/src/time_zone_if.o ./cctz/src/time_zone_impl.o ./cctz/src/time_zone_info.o ./cctz/src/time_zone_libc.o ./cctz/src/time_zone_lookup
    .o ./cctz/src/time_zone_posix.o ./cctz/src/zone_info_source.o
    g++ -std=gnu++11 -shared -L/usr/lib/R/lib -o timechange.dll common.o cpp11.o get.o parse.o round.o tzone.o update.o -L. -lcctz -L/usr/lib/R/lib -lR -lpcre2-8 -llzma -lbz2 -lz -ltirpc
    -lrt -ldl -lm -liconv -licuuc -licui18n
    /usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: ./libcctz.a(time_zone_info.o):time_zone_info:(.rdata$.refptr._ZN14cctz_extension24zone_info_source_factoryE[.refp
    tr._ZN14cctz_extension24zone_info_source_factoryE]+0x0): undefined reference to cctz_extension::zone_info_source_factory' /usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: ./libcctz.a(zone_info_source.o):zone_info_source.cc:(.debug_info+0xa875): undefined reference to cctz_extension:
    :zone_info_source_factory'
    collect2: error: ld returned 1 exit status
    make: *** [/usr/lib/R/share/make/shlib.mk:10: timechange.dll] Error 1
    ERROR: compilation failed for package ‘timechange’
  • removing ‘/usr/lib/R/site-library/timechange’
    Warning message:
    In install.packages(type = "source", repo = NULL, INSTALL_opts = "--no-lock", :
    installation of package ‘timechange’ had non-zero exit status`

If I install the binary package (4.3), it won't load:

`Installing package into ‘/usr/lib/R/site-library’
(as ‘lib’ is unspecified)

  • installing binary package ‘timechange’ ...
  • DONE (timechange)

library(timechange)
Error: package or namespace load failed for ‘timechange’ in library.dynam(lib, package, package.lib):
shared object ‘timechange.dll’ not found
In addition: Warning message:
package ‘timechange’ was built under R version 4.3.1`

And then there's this:

$ ldd $(find /c/cygwin64/lib/ -name timechange.dll) ntdll.dll => /c/windows/SYSTEM32/ntdll.dll (0x7ffd94a30000) KERNEL32.DLL => /c/windows/System32/KERNEL32.DLL (0x7ffd937d0000) KERNELBASE.dll => /c/windows/System32/KERNELBASE.dll (0x7ffd92300000) ctiuser.dll => /c/windows/system32/ctiuser.dll (0x7ffd4ac00000) msvcrt.dll => /c/windows/System32/msvcrt.dll (0x7ffd92af0000) ADVAPI32.dll => /c/windows/System32/ADVAPI32.dll (0x7ffd94940000) sechost.dll => /c/windows/System32/sechost.dll (0x7ffd94150000) RPCRT4.dll => /c/windows/System32/RPCRT4.dll (0x7ffd93e20000) FLTLIB.DLL => /c/windows/system32/FLTLIB.DLL (0x7ffd78d00000) ucrtbase.dll => /c/windows/System32/ucrtbase.dll (0x7ffd92140000) timechange.dll => /c/cygwin64/lib/R/site-library/timechange/libs/x64/timechange.dll (0x7ffd4e610000) api-ms-win-crt-convert-l1-1-0.dll => not found api-ms-win-crt-environment-l1-1-0.dll => not found api-ms-win-crt-filesystem-l1-1-0.dll => not found api-ms-win-crt-heap-l1-1-0.dll => not found api-ms-win-crt-locale-l1-1-0.dll => not found api-ms-win-crt-math-l1-1-0.dll => not found api-ms-win-crt-private-l1-1-0.dll => not found api-ms-win-crt-runtime-l1-1-0.dll => not found api-ms-win-crt-stdio-l1-1-0.dll => not found api-ms-win-crt-string-l1-1-0.dll => not found api-ms-win-crt-time-l1-1-0.dll => not found api-ms-win-crt-utility-l1-1-0.dll => not found R.dll => not found

I had a similar issue before, and it was solved by tweaking Makevars.
Hope there's an easy fix for this as well. Any ideas?
Seems like pasting with backticks messed up the formatting, but I'm posting anyways.

@vspinu
Copy link
Owner

vspinu commented Aug 24, 2023

If you have a patch that is not affecting other builds I would be happy to consider. I don't know much about cygwin, so not sure I can be of any help.

@pbarill
Copy link

pbarill commented Feb 10, 2025

Ran into the same problem with R on cygwin.

/usr/lib/gcc/x86_64-pc-cygwin/12/../../../../x86_64-pc-cygwin/bin/ld: ./libcctz.a(time_zone_info.o):time_zone_info:(.rdata$.refptr._ZN14cctz_extension24zone_info_source_factoryE[.refptr._ZN14cctz_extension24zone_info_source_factoryE]+0x0): undefined reference to cctz_extension::zone_info_source_factory' /usr/lib/gcc/x86_64-pc-cygwin/12/../../../../x86_64-pc-cygwin/bin/ld: ./libcctz.a(zone_info_source.o):zone_info_source.cc:(.debug_info+0xbc82): undefined reference to cctz_extension::zone_info_source_factory'
collect2: error: ld returned 1 exit status
make: *** [/usr/lib/R/share/make/shlib.mk:10: timechange.dll] Error 1

My business with timechange is as a dependency of lubridate. I tried older versions of lubridate, and the latest that builds is 1.7.9 (it featured cctz material, yet it builds). Starting with 1.7.9.2, this kind of error shows up. This is a good enough workaround for me for the time being.

Could it be that something in cygwin's /usr/share/zoneinfo is missing? I borrowed the directory from Gentoo, and that makes no difference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants