Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Link error when using MATHEMATICAL_USE_SYSTEM_LASEM in Cygwin #77

Open
jjulianoatnv opened this issue Aug 12, 2017 · 1 comment
Open
Labels

Comments

@jjulianoatnv
Copy link

Hi, I've encountered an error when trying to build mathematical on cygwin while using MATHEMATICAL_USE_SYSTEM_LASEM. The linker complains about undefined references to symbol names with the pattern lsm_dom_*.

In the build log (see below), the link command does not contain -llasem. It looks like extconf.rb is supposed to add -llasem to the makefile, but that's failing to happen in my environment.
I do not understand how to fix that problem.

$ grep -R llasem .
./ext/mathematical/extconf.rb:  $LIBS << ' -llasem'
./ext/mathematical/extconf.rb:    $LIBS << ' -llasem'
./ext/mathematical/lasem/lasem.pc.in:Libs: -L${libdir} -llasem-@LASEM_API_VERSION@

$ grep -R lasem ext/mathematical/Makefile
CPPFLAGS =  -I/home/jeff/.gem/ruby/2.3.0/gems/mathematical-1.6.9/ext/mathematical/mtex2MML/src -I/home/jeff/.gem/ruby/2.3.0/gems/mathematical-1.6.9/ext/mathematical/lasem/src  $(DEFS) $(cppflags)
ORIG_SRCS = cairo_callbacks.c lasem_overrides.c mathematical.c
OBJS = cairo_callbacks.o lasem_overrides.o mathematical.o
HDRS = $(srcdir)/cairo_callbacks.h $(srcdir)/lasem_overrides.h $(srcdir)/mathematical.h

extconf.rb contains this:

if !using_system_lasem?
[...]
else
  if dir_config('lasem').any? || system('dpkg -s liblasem >/dev/null')
    $LIBS << ' -llasem'
  else
    # NOTE: pkg_config implicitly adds right -l argument for the linker.
    pkg_config('liblasem') || pkg_config('lasem')
  end
end

FWIW, I'm following the instructions for setting up the build of a project that uses asciidoctor-mathematical, and this is failing while building mathematical. The instructions I'm following are the cygwin section of this: https://gitlab.khronos.org/vulkan/vulkan/blob/1.0/doc/specs/vulkan/README.adoc

I have installed these cygwin packages using cygwin's setup-x86_64.exe:

  • liblasem0.4-devel
  • liblasem0.4_4

And I have created a symbolic link named liblasem.dll.a as recommended in the above-referenced README.adoc.

$ find /usr/lib -iname '*lasem*'
/usr/lib/liblasem-0.4.dll.a
/usr/lib/liblasem.dll.a
/usr/lib/pkgconfig/lasem-0.4.pc

Here are relevant excerpts from the build log:

$ MATHEMATICAL_USE_SYSTEM_LASEM=1 gem install asciidoctor-mathematical
Building native extensions.  This could take a while...
ERROR:  Error installing asciidoctor-mathematical:
        ERROR: Failed to build gem native extension.

    current directory: /home/jeff/.gem/ruby/2.3.0/gems/mathematical-1.6.9/ext/mathematical
/usr/bin/ruby.exe -r ./siteconf20170812-11152-bj7qdh.rb extconf.rb

[...]

rm -f mathematical.so
gcc -shared -o mathematical.so cairo_callbacks.o lasem_overrides.o mathematical.o -L. -L/usr/lib -L/home/jeff/.gem/ruby/2.3.0/gems/mathematical-1.6.9/ext/mathematical/lib -L. -fstack-protector -lgdk_pixbuf-2.0 -lm -lgmodule-2.0 -lpng16 -lm -lz -lcairo -lz -lpixman-1 -lfontconfig -lexpat -lfreetype -lexpat -lfreetype -lbz2 -lz -lpng16 -lm -lz -lxcb-shm -lxcb-render -lXrender -lXext -lX11 -lxcb -lXau -lXdmcp -lpango-1.0 -lm -lgobject-2.0 -lffi -lglib-2.0 -lintl -lpcre -lintl -liconv -lpcre -Wl,--export-all-symbols -Wl,--enable-auto-image-base,--enable-auto-import    -lruby230 -lpangocairo-1.0 -lxml2  -lpthread -lgmp -ldl -lcrypt   -lmtex2MML
mathematical.o: In function `process':
/home/jeff/.gem/ruby/2.3.0/gems/mathematical-1.6.9/ext/mathematical/mathematical.c:111: undefined reference to `lsm_dom_document_new_from_memory'
/home/jeff/.gem/ruby/2.3.0/gems/mathematical-1.6.9/ext/mathematical/mathematical.c:111:(.text+0x6a9): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `lsm_dom_document_new_from_memory'
/home/jeff/.gem/ruby/2.3.0/gems/mathematical-1.6.9/ext/mathematical/mathematical.c:122: undefined reference to `lsm_dom_document_create_view'
/home/jeff/.gem/ruby/2.3.0/gems/mathematical-1.6.9/ext/mathematical/mathematical.c:122:(.text+0x6fb): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `lsm_dom_document_create_view'
/home/jeff/.gem/ruby/2.3.0/gems/mathematical-1.6.9/ext/mathematical/mathematical.c:123: undefined reference to `lsm_dom_view_set_resolution'
/home/jeff/.gem/ruby/2.3.0/gems/mathematical-1.6.9/ext/mathematical/mathematical.c:123:(.text+0x70a): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `lsm_dom_view_set_resolution'
/home/jeff/.gem/ruby/2.3.0/gems/mathematical-1.6.9/ext/mathematical/mathematical.c:128: undefined reference to `lsm_dom_view_get_size'
/home/jeff/.gem/ruby/2.3.0/gems/mathematical-1.6.9/ext/mathematical/mathematical.c:128:(.text+0x733): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `lsm_dom_view_get_size'
/home/jeff/.gem/ruby/2.3.0/gems/mathematical-1.6.9/ext/mathematical/mathematical.c:129: undefined reference to `lsm_dom_view_get_size_pixels'
/home/jeff/.gem/ruby/2.3.0/gems/mathematical-1.6.9/ext/mathematical/mathematical.c:129:(.text+0x748): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `lsm_dom_view_get_size_pixels'
/home/jeff/.gem/ruby/2.3.0/gems/mathematical-1.6.9/ext/mathematical/mathematical.c:145: undefined reference to `lsm_dom_view_render'
/home/jeff/.gem/ruby/2.3.0/gems/mathematical-1.6.9/ext/mathematical/mathematical.c:145:(.text+0x7a9): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `lsm_dom_view_render'
/home/jeff/.gem/ruby/2.3.0/gems/mathematical-1.6.9/ext/mathematical/mathematical.c:145: undefined reference to `lsm_dom_view_render'
/home/jeff/.gem/ruby/2.3.0/gems/mathematical-1.6.9/ext/mathematical/mathematical.c:145:(.text+0x88d): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `lsm_dom_view_render'
/home/jeff/.gem/ruby/2.3.0/gems/mathematical-1.6.9/ext/mathematical/mathematical.c:145: undefined reference to `lsm_dom_view_render'
/home/jeff/.gem/ruby/2.3.0/gems/mathematical-1.6.9/ext/mathematical/mathematical.c:145:(.text+0xa0c): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `lsm_dom_view_render'
collect2: error: ld returned 1 exit status
make: *** [Makefile:257: mathematical.so] Error 1

make failed, exit code 2

@jjulianoatnv jjulianoatnv changed the title Link error when using MATHEMATICAL_USE_SYSTEM_LASEM Link error when using MATHEMATICAL_USE_SYSTEM_LASEM in Cygwin Aug 12, 2017
@volkan-conffx
Copy link

volkan-conffx commented Aug 7, 2018

@gjtorikian

Any updates on this? I'm having the exact same issue.

@4e554c4c 4e554c4c added the bug label Nov 29, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants