Opened 12 years ago

Closed 7 years ago

#36551 closed defect (fixed)

openmotif @2.3.3 -- Undefined symbols for architecture x86_64: "_main"

Reported by: ggpolo@… Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: ports Version: 2.1.2
Keywords: Cc: plm_macports@…, x.pechoultres@…, eriwaldo.teixeira@…, ryandesign (Ryan Carsten Schmidt)
Port: openmotif

Description

Hello,

After some time without upgrading, I decided to do so yesterday and moved everything I could to +universal. Apparently, most of it went fine except for openmotif (which I need for geomview). I searched for related tickets and the best one I found was #24237, but all of the openmotif deps were built with +universal (except for xbitmaps).

I get the following linker error when running "port install openmotif +universal":

/usr/bin/clang -fno-strict-aliasing -arch x86_64 -arch i386 -Wall -g -fno-strict-aliasing 
-Wno-unused -Wno-comment -fno-tree-ter -I/opt/local/include -I/opt/local/include/freetype2 
-arch x86_64 -arch i386 -o wmluiltok wmluiltok.o  -L/opt/local/lib /opt/local/lib/libXp.dylib 
/opt/local/lib/libXext.dylib /opt/local/lib/libXft.dylib /opt/local/lib/libfontconfig.dylib 
/opt/local/lib/libiconv.dylib /opt/local/lib/libexpat.dylib /opt/local/lib/libfreetype.dylib -lbz2 
/opt/local/lib/libXrender.dylib /opt/local/lib/libX11.dylib /opt/local/lib/libxcb.dylib 
/opt/local/lib/libXau.dylib /opt/local/lib/libXdmcp.dylib /opt/local/lib/libjpeg.dylib 
/opt/local/lib/libpng15.dylib -lz

Undefined symbols for architecture x86_64:
  "_main", referenced from:
     -u command line option
ld: symbol(s) not found for architecture x86_64

Any ideas ? I got Xcode 4.5.1 and OS X 10.8.2. The same problem happens if I opt to perform openmotif -universal.

Thanks for your time.

Attachments (1)

main.log (547.8 KB) - added by ggpolo@… 12 years ago.
Log from "port -d install openmotif"

Download all attachments as: .zip

Change History (14)

Changed 12 years ago by ggpolo@…

Attachment: main.log added

Log from "port -d install openmotif"

comment:1 Changed 12 years ago by ryandesign (Ryan Carsten Schmidt)

Keywords: linker removed

comment:2 Changed 12 years ago by ggpolo@…

I looked into this again and now I managed to solve the compilation problem. The problem is that the offending object file wmluiltok.o, which is generated from wmluiltok.c, may not have a main function after all (just like what the linker says). The file wmluiltok.c is generated by the flex program, which doesn't generate a main function except if the flex executable is actually a link to the lex binary (which generates the main function by default). I would think that nowadays most people moved to flex, but maybe it is not the case and openmotif prefers to assume lex is being used ?

Anyway, the (or, better, one) solution is to prepend the file openmotif-2.3.3/tools/wml/wmluiltok.l with the directive %option main

comment:3 in reply to:  2 Changed 12 years ago by ehesan@…

Could you please explain a bit how to "prepend the file openmotif-2.3.3/tools/wml/wmluiltok.l with the directive %option main" ? I am novice here .. and need to install opnemotif. I am facing exactly the same problem as it has been reported here for MacOS 10.8.2. Thanks a lot.

Replying to ggpolo@…:

I looked into this again and now I managed to solve the compilation problem. The problem is that the offending object file wmluiltok.o, which is generated from wmluiltok.c, may not have a main function after all (just like what the linker says). The file wmluiltok.c is generated by the flex program, which doesn't generate a main function except if the flex executable is actually a link to the lex binary (which generates the main function by default). I would think that nowadays most people moved to flex, but maybe it is not the case and openmotif prefers to assume lex is being used ?

Anyway, the (or, better, one) solution is to prepend the file openmotif-2.3.3/tools/wml/wmluiltok.l with the directive %option main

comment:4 Changed 12 years ago by ggpolo@…

Open wmluiltok.l for editing, insert the line %option main at top. The log file shows where the file lives.

comment:5 Changed 12 years ago by jmroot (Joshua Root)

Is this still a problem with 2.3.4?

comment:6 in reply to:  5 Changed 12 years ago by plm_macports@…

Replying to jmr@…:

Is this still a problem with 2.3.4?

yes

comment:7 Changed 12 years ago by plm_macports@…

Cc: plm_macports@… added

Cc Me!

comment:8 Changed 12 years ago by x.pechoultres@…

Cc: x.pechoultres@… added

Cc Me!

comment:9 Changed 12 years ago by x.pechoultres@…

Still not building.

I tried this patch to wmluiltok.l without success:

%option main

%{
/*
 * Motif
 *

comment:10 Changed 10 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: eriwaldo.teixeira@… ryandesign@… added

Has duplicate #44854.

The log says:

:info:configure checking for flex... flex
:info:configure checking lex output file root... lex.yy
:info:configure checking lex library... none needed

This last line is the problem. In fact "none needed" appears to be erroneous; it should print "none found"; whether or not it's needed is another matter, and in this case, it seems it is needed. On my system, when the flex port is installed, I get:

:info:configure checking for flex... flex
:info:configure checking lex output file root... lex.yy
:info:configure checking lex library... -lfl

On my system, when the flex port is not installed, I get:

:info:configure checking for flex... flex
:info:configure checking lex output file root... lex.yy
:info:configure checking lex library... -ll

So in my case there is always a lex library, but in both the log attached here and the one attached to #44854, there is not. So I would ask anyone experiencing this issue:

  • what does which flex say?
  • what does flex -V say?
  • is the flex port installed?
    • if not, does installing the flex port, then cleaning openmotif and trying again help or not?

I think the preferred resolution would be adding a build dependency on the flex port, if that will solve the problem.

comment:11 Changed 10 years ago by eriwaldo.teixeira@…

Installing port flex didnt solve it, I get the same error

--->  Building openmotif
Error: org.macports.build for port openmotif returned: command execution failed
Please see the log file for port openmotif for details:
    /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_x11_openmotif/openmotif/main.log
To report a bug, follow the instructions in the guide:
    http://guide.macports.org/#project.tickets
Error: Processing of port openmotif failed

the main.log still reports

:info:configure checking for flex... flex
:info:configure checking lex output file root... lex.yy
:info:configure checking lex library... none needed

comment:12 Changed 7 years ago by jmroot (Joshua Root)

Is this still a problem with 2.3.8?

comment:13 Changed 7 years ago by jmroot (Joshua Root)

Resolution: fixed
Status: newclosed

New version seems to have built fine on 10.8.

Note: See TracTickets for help on using tickets.