Opened 6 years ago

Closed 6 years ago

#44704 closed defect (fixed)

octave:Undefined symbols for architecture x86_64: "_gl2psDisable"

Reported by: mojca (Mojca Miklavec) Owned by: michaelld (Michael Dickens)
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc: rspinney20@…
Port: octave

Description

Upgrading octave on Lion fails for me with:

:info:build clang: warning: argument unused during compilation: '-pthread'
:info:build clang: warning: argument unused during compilation: '-pthread'
:info:build Undefined symbols for architecture x86_64:
:info:build   "_gl2psDisable", referenced from:
:info:build       glps_renderer::set_polygon_offset(bool, double) in dldfcn___init_fltk___la-__init_fltk__.o
:info:build       glps_renderer::set_linestyle(std::string const&, bool) in dldfcn___init_fltk___la-__init_fltk__.o
:info:build   "_gl2psEnable", referenced from:
:info:build       glps_renderer::set_polygon_offset(bool, double) in dldfcn___init_fltk___la-__init_fltk__.o
:info:build       glps_renderer::set_linestyle(std::string const&, bool) in dldfcn___init_fltk___la-__init_fltk__.o
:info:build   "_gl2psLineWidth", referenced from:
:info:build       glps_renderer::set_linewidth(float) in dldfcn___init_fltk___la-__init_fltk__.o
:info:build ld: symbol(s) not found for architecture x86_64
:info:build clang: error: linker command failed with exit code 1 (use -v to see invocation)
:info:build make[3]: *** [dldfcn/__init_fltk__.la] Error 1
:info:build make[3]: *** Waiting for unfinished jobs....
:info:build libtool: link: warning: `/opt/local/lib/gcc48/gcc/x86_64-apple-darwin11/4.8.3/../../../libgfortran.la' seems to be moved

The workaround was to

cd $(port work octave)
cd octave-3.8.1/libinterp

and then manually add -lgl2ps at the end of:

sudo /bin/sh ../libtool  --tag=CXX   --mode=link /usr/bin/clang++  -Wall -W -Wshadow -Wold-style-cast -Wformat -Wpointer-arith -Wwrite-strings -Wcast-align -Wcast-qual -pipe -Os -arch x86_64 -stdlib=libstdc++ -D_THREAD_SAFE -pthread -avoid-version -module -no-undefined      -o dldfcn/__init_fltk__.la -rpath /opt/local/lib/octave/3.8.1 dldfcn/dldfcn___init_fltk___la-__init_fltk__.lo liboctinterp.la ../liboctave/liboctave.la -L/opt/local/lib -Wl,-headerpad_max_install_names -lfltk_gl -framework AGL -framework OpenGL -framework ApplicationServices -lfltk -lpthread -framework Cocoa -L/opt/local/lib -lfreetype  -L/opt/local/lib -lfontconfig -lfreetype  -Wl,-framework -Wl,OpenGL  -lm -lgl2ps

I've seen the problem mentioned in comment:19:ticket:41155, but no explicit resolution of it.

Change History (20)

comment:1 Changed 6 years ago by michaelld (Michael Dickens)

What is your MacPorts command -- "sudo port install octave +fltk"?

comment:2 Changed 6 years ago by michaelld (Michael Dickens)

I don't see this with the above command when using Octave 3.8.2 on OSX 10.8. Maybe this is Octave / OSX / Xcode specific?

comment:3 Changed 6 years ago by mojca (Mojca Miklavec)

I'm using 10.7, Xcode 4.6.3.

I didn't try to enable any extra options and fltk seems to be enabled automatically / by default (is fltk available as a separate option?):

:info:configure checking for FONTCONFIG... yes
:info:configure checking for fltk-config... /opt/local/bin/fltk-config
:info:configure checking for OpenGL support in FLTK... yes
:info:configure checking gl2ps.h usability... yes
:info:configure checking gl2ps.h presence... yes
:info:configure checking for gl2ps.h... yes
:info:configure checking how to print strings... printf

Maybe part of the problem lies in the fact that I have fltk-devel @1.3.x-r10425_0 installed? I need to test that.

comment:4 Changed 6 years ago by mojca (Mojca Miklavec)

Indeed. Uninstalling that port lead to successful compilation of octave.

comment:5 Changed 6 years ago by michaelld (Michael Dickens)

If you're using the defaults for octave, FLTK should not be made use of even if it is installed. So, seems like it might need a patch. If you try with +gui, the build should work (yes?).

comment:6 Changed 6 years ago by mojca (Mojca Miklavec)

I'm trying the +gui option now. (I kind of forget about this every time until I'm bitten again with exactly the same error during upgrade. I'm sorry for those delays in testing, but octave builds forever ...)

comment:7 Changed 6 years ago by mojca (Mojca Miklavec)

No, it doesn't work with +gui either. It fails with the same error:

Undefined symbols for architecture x86_64:
  "_gl2psDisable", referenced from:
      glps_renderer::set_polygon_offset(bool, double) in dldfcn___init_fltk___la-__init_fltk__.o
      glps_renderer::set_linestyle(std::string const&, bool) in dldfcn___init_fltk___la-__init_fltk__.o
  "_gl2psEnable", referenced from:
      glps_renderer::set_polygon_offset(bool, double) in dldfcn___init_fltk___la-__init_fltk__.o
      glps_renderer::set_linestyle(std::string const&, bool) in dldfcn___init_fltk___la-__init_fltk__.o
  "_gl2psLineWidth", referenced from:
      glps_renderer::set_linewidth(float) in dldfcn___init_fltk___la-__init_fltk__.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[3]: *** [dldfcn/__init_fltk__.la] Error 1
make[3]: *** Waiting for unfinished jobs....

I no longer have fltk-devel installed, but given that fltk is now at version @1.3.3_0, it might be that I'm experiencing the same problem as I did last time with fltk-devel@1.3.x.

comment:8 Changed 6 years ago by mojca (Mojca Miklavec)

I uninstalled fltk and installed port install octave +qtgui -glgui. That one worked.

comment:9 Changed 6 years ago by michaelld (Michael Dickens)

Has duplicate #46879.

comment:10 Changed 6 years ago by michaelld (Michael Dickens)

For folks experiencing this issue, can you go back to the failed build (if necessary):

sudo port clean octave
sudo port build octave

then do:

otool -L `port work octave`/octave-3.8.2/libinterp/.libs/liboctinterp.2.dylib | grep gl2ps

and post the result?

comment:11 Changed 6 years ago by michaelld (Michael Dickens)

Cc: rspinney20@… added

comment:12 Changed 6 years ago by mojca (Mojca Miklavec)

Which ports should I install/uninstall before building octave (based on observations in #46879)?

comment:13 Changed 6 years ago by michaelld (Michael Dickens)

Just leave the dependencies as they are. Clean and build octave using the default variants. The build should fail when it gets to a certain point, which is after liboctinterp has been created. liboctinterp is linked to libgl2ps.dylib, so the otool command will show if it is the one provided by MacPorts or some other. The octave configure script -assumes- the "-lgl2ps" exists, without checking for it or where it might be located. I'm tempted to make the dependency explicit ... but, this also might not be the issue. I have some other ideas for how to correct the issue if gl2ps linkage isn't the problem.

comment:14 Changed 6 years ago by michaelld (Michael Dickens)

From the buildbots, it's interesting that this issue occurs on Lion (10.7) and Mountain Lion (10.8), not on Mavericks (10.9) or Yosemite (10.10). I've no idea why ... I don't see it on my 10.10 or 10.8 boot disks.

comment:15 Changed 6 years ago by michaelld (Michael Dickens)

So it looks like the buildbots are running (according to the compiler blacklist):

  • Lion (10.7): clang 425.0.28
  • MTL (10.8): clang 421.11.66

On my 10.8 install I'm running "clang 503.0.40" (3.4 of some sort; Xcode 5.1.1). This compiler works for this issue. When I use "configure.compiler=macports-clang-3.3", the build fails with the errors listed on this ticket.

Thus, the actual issue -seems- to be that a C++ header defining a class contains inlined code which is being brought into the object by the compiler. Newer compilers are smart enough to discard the code since it's not actually being used; hence, the required symbols are not undefined for clang 3.4+ (Xcode 5.1+). I'm guessing that the older compilers don't have these "new smarts" and thus the issue.

One solution is to ban the use of older compilers. Another is to simply move the code from the header to the C++ file so that it is compiled into the library. There isn't much code in this regard, so it seems the lesser thing to do. I'll try it out & if it works push it upstream.

comment:16 Changed 6 years ago by michaelld (Michael Dickens)

Committed in r133137. Please do:

sudo port clean octave
sudo port selfupdate
sudo port install octave

and now it should work. Please report back here with results.

comment:17 in reply to:  13 Changed 6 years ago by mojca (Mojca Miklavec)

Replying to michaelld@…:

Just leave the dependencies as they are.

Last time I tried building octave succeeded if I first uninstalled fltk-devel and the other ticket also suggests that having some ports installed might lead into breaking the build. But I'll try a few combinations and let you know (compilation is very very slow). I'll be offline for the weekend though.

comment:18 Changed 6 years ago by michaelld (Michael Dickens)

On my setup, I've have success building octave with fltk and fltk-devel, using +glgui or -glgui, and lots of other variations. Maybe I'm lucky :) There's not rush, and I think I determined the root cause of the issue and fixed it. But, feedback (hopefully positive) is welcomed!

comment:19 Changed 6 years ago by rspinney20@…

Reporting from merged ticket #46879.

This now solves my problem.

Many thanks.

comment:20 Changed 6 years ago by michaelld (Michael Dickens)

Resolution: fixed
Status: newclosed

Great; thanks!

Note: See TracTickets for help on using tickets.