Opened 12 years ago

Closed 12 years ago

#35619 closed defect (fixed)

sdcc: error: conflicting types for 'getline'

Reported by: fabrizio.giuliano@… Owned by: nerdling (Jeremy Lavergne)
Priority: Normal Milestone:
Component: ports Version: 2.1.2
Keywords: Cc:
Port: sdcc29

Description

I tried to install sdcc @2.9.0_0 in this way:

svn co -r 57740 http://svn.macports.org/repository/macports/trunk/dports/lang/sdcc
cd sdcc
sudo port install
--->  Building sdcc
Error: org.macports.build for port sdcc returned: command execution failed
Please see the log file for port sdcc for details:
    /opt/local/var/macports/logs/_private_tmp_sdcc/sdcc/main.log
To report a bug, follow the instructions in the guide:
    http://guide.macports.org/#project.tickets
Error: Processing of port sdcc failed

Attachments (1)

main.log (39.0 KB) - added by fabrizio.giuliano@… 12 years ago.
main.log

Download all attachments as: .zip

Change History (8)

Changed 12 years ago by fabrizio.giuliano@…

Attachment: main.log added

main.log

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

Owner: changed from macports-tickets@… to snc@…
Port: sdcc added
Summary: sdcc @2.9.0_0 building errorsdcc: error: conflicting types for 'getline'

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

Wait, why are you deliberately checking out a three-year-old version of the port? Use the current version of the port, please; it should build fine.

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

Resolution: wontfix
Status: newclosed

If you're deliberately trying to install an older version of the port, that's fine, but you might run into some problems that have been fixed in later versions. And this is one of those problems. On Lion and later, it's not legal to define a function with the name "getline", because Lion already defines function of that name. The developers of sdcc already fixed this in version 3.0, and MacPorts fixed it by updating the port to that version. If you must have sdcc 2.9, then you could manually apply the patch. Here's what the ChangeLog says about how they fixed it:

2009-05-03 Borut Razem <borut.razem AT siol.net>

	* as/link/hc08/Makefile.in, as/link/mcs51/Makefile.in,
	  as/link/z80/Makefile.in, as/link/lk_readnl.c, as/link/lk_readnl.h,
	  as/link/lklib.c, as/link/lkrel.c, as/link/lksdcclib.c:
	  getline renamed to lk_readln to prevent conflicts with Fedora 11
	  glibc-2.9.90-19 getline;
	  see https://bugzilla.redhat.com/show_bug.cgi?id=488217

comment:4 Changed 12 years ago by neverpanic (Clemens Lang)

There also is a sdcc29 port if you need a version < 3; it has the fix mentioned, but only for lion. It would probably have to be adapted to use this fix on mountain lion, too. Please file a bug against the sdcc29 port if that's what you want.

comment:5 Changed 12 years ago by fabrizio.giuliano@…

Thank you! i did:

sudo port install sdcc29
sudo port edit sdcc29

Insert this snippet (it works with Mountain Lion):

platform darwin 12 {
    post-patch {
        # 10.7 provides 'getline()' already, but it is not
        # interchangeable with that provided by SDCC. change SDCC's
        # internal to "sdcc_getline", but not the #includes
        reinplace "/getline/s@getline @sdcc_getline @g" \
            ${worksrcpath}/as/link/getline.h \
            ${worksrcpath}/as/link/getline.c \
            ${worksrcpath}/as/link/lklib.c \
            ${worksrcpath}/as/link/lkrel.c \
            ${worksrcpath}/as/link/lksdcclib.c
    }
}

It works!

Thanks a lot again!

comment:6 Changed 12 years ago by neverpanic (Clemens Lang)

Port: sdcc29 added; sdcc removed
Resolution: wontfix
Status: closedreopened

comment:7 Changed 12 years ago by neverpanic (Clemens Lang)

Resolution: fixed
Status: reopenedclosed
Note: See TracTickets for help on using tickets.