Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#44286 closed defect (fixed)

fixes for eggdrop port on mavericks

Reported by: dreness (Andre LaBranche) Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: ports Version: 2.3.1
Keywords: haspatch maintainer Cc: kurthindenburg (Kurt Hindenburg)
Port: eggdrop

Description

Symptom:

...
gcc -o ../eggdrop bg.o botcmd.o botmsg.o botnet.o chanprog.o cmds.o dcc.o dccutil.o dns.o flags.o language.o match.o main.o mem.o misc.o misc_file.o modules.o net.o rfc1459.o tcl.o tcldcc.o tclhash.o tclmisc.o tcluser.o userent.o userrec.o users.o  -L/usr/lib -ltcl8.5 -lm -ldl  -lpthread md5/md5c.o compat/*.o `cat mod/mod.xlibs`
Undefined symbols for architecture x86_64:
  "_cron_matchfld", referenced from:
      _cron_match in match.o
  "_garbage_collect_tclhash", referenced from:
      _mainloop in main.o
  "_open_listen", referenced from:
      _global_table in modules.o
      _tcl_listen in tcldcc.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[1]: *** [../eggdrop] Error 1
make: *** [modegg] Error 2

One possible solution involves a tweak to the port file and three new patch files. All patches and new files are attached and also shown below.

# Add some new patches for mavericks+

--- Portfile	2014-07-09 00:00:01.000000000 -0700
+++ Portfile.patched	2014-07-08 23:59:37.000000000 -0700
@@ -40,3 +40,9 @@
 if {${os.platform} eq "darwin" && ${os.major} >= 10} {
     patchfiles-append patch-Makefile.in.diff
 }
+
+if {${os.platform} eq "darwin" && ${os.major} >= 13} {
+    patchfiles-append tclhash.h.diff 
+    patchfiles-append proto.h.diff 
+    patchfiles-append match.c.diff 
+}

# the new patches are as follows.

# files/tclhash.h.diff

--- src/tclhash.h       2011-07-31 13:15:06.000000000 -0700
+++ src/tclhash.h.patched       2014-07-08 23:45:52.000000000 -0700
@@ -75,7 +75,7 @@
 
 #ifndef MAKING_MODS
 
-inline void garbage_collect_tclhash(void);
+void garbage_collect_tclhash(void);
 
 void init_bind(void);
 void kill_bind(void);

# files/proto.h.diff

--- src/proto.h 2011-07-09 08:07:48.000000000 -0700
+++ src/proto.h.patched 2014-07-08 23:46:09.000000000 -0700
@@ -271,7 +271,7 @@
 void killsock(int);
 void killtclsock(int);
 int answer(int, char *, unsigned long *, unsigned short *, int);
-inline int open_listen(int *);
+int open_listen(int *);
 int open_address_listen(IP addr, int *);
 int open_telnet(char *, int);
 int open_telnet_dcc(int, char *, char *);

# files/match.c.diff

--- src/match.c 2010-07-01 09:10:49.000000000 -0700
+++ src/match.c.patched 2014-07-08 23:46:27.000000000 -0700
@@ -367,7 +367,7 @@
 /* Inline for cron_match (obviously).
  * Matches a single field of a crontab expression.
  */
-inline int cron_matchfld(char *mask, int match)
+int cron_matchfld(char *mask, int match)
 {
   int skip = 0, f, t;
   char *p, *q;

Attachments (8)

match.c.diff (361 bytes) - added by dreness (Andre LaBranche) 10 years ago.
proto.h.diff (416 bytes) - added by dreness (Andre LaBranche) 10 years ago.
tclhash.h.diff (300 bytes) - added by dreness (Andre LaBranche) 10 years ago.
Portfile.patch (1017 bytes) - added by dreness (Andre LaBranche) 10 years ago.
Portfile-eggdrop.diff (2.6 KB) - added by dreness (Andre LaBranche) 10 years ago.
patch-src-proto.h.diff (413 bytes) - added by dreness (Andre LaBranche) 10 years ago.
patch-src-match.c.diff (358 bytes) - added by dreness (Andre LaBranche) 10 years ago.
patch-src-tclhash.h.diff (285 bytes) - added by dreness (Andre LaBranche) 10 years ago.

Download all attachments as: .zip

Change History (27)

Changed 10 years ago by dreness (Andre LaBranche)

Attachment: match.c.diff added

Changed 10 years ago by dreness (Andre LaBranche)

Attachment: proto.h.diff added

Changed 10 years ago by dreness (Andre LaBranche)

Attachment: tclhash.h.diff added

comment:1 Changed 10 years ago by dreness (Andre LaBranche)

I didn't test this much further than that the bot builds and executes with a pre-existing config I had laying around.

andre@flux [~] % cd /opt/local/share/eggdrop ; eggdrop ~/work/egg/constable.conf 

Eggdrop v1.6.20 (C) 1997 Robey Pointer (C) 2010 Eggheads
[00:26:22] --- Loading eggdrop v1.6.20 (Wed Jul  9 2014)
[00:26:22] Listening at telnet port 42000 (all).
[00:26:22] Can't load modules dns: Unknown module.
[00:26:22] Module loaded: channels        
[00:26:22] Module loaded: server          
[00:26:22] Module loaded: ctcp            
[00:26:22] Module loaded: irc             
[00:26:22] Module loaded: transfer         (with lang support)
[00:26:22] Module loaded: share           
[00:26:22] Module loaded: compress        
[00:26:22] Module loaded: filesys          (with lang support)
[00:26:22] Module loaded: notes            (with lang support)
[00:26:22] Module loaded: console          (with lang support)
[00:26:22] Module loaded: seen            
[00:26:22] Module loaded: blowfish        
[00:26:22] Module loaded: assoc            (with lang support)
[00:26:22] Module loaded: wire             (with lang support)
[00:26:22] Module loaded: uptime          
[00:26:22] Userinfo TCL v1.07 loaded (URL BF GF IRL EMAIL DOB PHONE ICQ).
[00:26:22] use '.help userinfo' for commands.
[00:26:22] GetOps v2.3c loaded.
[00:26:22] Writing channel file...
[00:26:22] Userfile loaded, unpacking...
[00:26:22] === constable: 1 channels, 1 users.
Launched into the background  (pid: 17338)

comment:2 Changed 10 years ago by kurthindenburg (Kurt Hindenburg)

Cc: khindenburg@… added

Cc Me!

comment:3 Changed 10 years ago by kurthindenburg (Kurt Hindenburg)

Port: eggdrop added

Did you want to use the latest version to patch? 1.6.21

comment:4 in reply to:  3 Changed 10 years ago by dreness (Andre LaBranche)

Replying to khindenburg@…:

Did you want to use the latest version to patch? 1.6.21

Seems like a good idea. I’ll give that a whirl and post updated patches.

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

Keywords: haspatch maintainer added

Changed 10 years ago by dreness (Andre LaBranche)

Attachment: Portfile.patch added

comment:6 Changed 10 years ago by dreness (Andre LaBranche)

Updated Portfile for 1.6.21; swapped the sha1 hash for a sha256. Updated Portfile is attached and also shown below:

--- Portfile	2014-07-09 21:23:45.000000000 -0700
+++ Portfile.patched	2014-07-09 21:23:34.000000000 -0700
@@ -4,7 +4,7 @@
 PortSystem 1.0
 
 name		eggdrop
-version		1.6.20
+version		1.6.21
 revision        1
 set branch	[join [lrange [split ${version} .] 0 1] .]
 categories	irc
@@ -16,8 +16,8 @@
 master_sites	ftp://ftp.eggheads.org/pub/eggdrop/source/${branch}/ freebsd
 distname        ${name}${version}
 
-checksums       sha1    7ebecd0955af36caa1846d0e7cd1f959f819f6b5 \
-                rmd160  567668974e971a0c8ad6674a0500b32991a95f3d
+checksums       rmd160  1006dfd6a6e735500c2b484eb3061f1d2dfd20f8 \
+                sha256  75bd5573a609eac3940c0b6ca8251c3f38ea5d54b520e1cad93c650b4bc21754
 
 use_bzip2	yes
 
@@ -40,3 +40,9 @@
 if {${os.platform} eq "darwin" && ${os.major} >= 10} {
     patchfiles-append patch-Makefile.in.diff
 }
+
+if {${os.platform} eq "darwin" && ${os.major} >= 13} {
+    patchfiles-append tclhash.h.diff 
+    patchfiles-append proto.h.diff 
+    patchfiles-append match.c.diff 
+}

Also did some more testing. No more DNS module error at startup.

andre@flux [share/eggdrop] % cd /opt/local/share/eggdrop ; eggdrop ~/work/egg/constable.conf

Eggdrop v1.6.21 (C) 1997 Robey Pointer (C) 2011 Eggheads
[20:56:35] --- Loading eggdrop v1.6.21 (Wed Jul  9 2014)
[20:56:35] Listening at telnet port 42000 (all).
[20:56:35] Module loaded: dns             
[20:56:35] Module loaded: channels        
[20:56:35] Module loaded: server          
[20:56:35] Module loaded: ctcp            
[20:56:35] Module loaded: irc             
[20:56:35] Module loaded: transfer         (with lang support)
[20:56:35] Module loaded: share           
[20:56:35] Module loaded: compress        
[20:56:35] Module loaded: filesys          (with lang support)
[20:56:35] Module loaded: notes            (with lang support)
[20:56:35] Module loaded: console          (with lang support)
[20:56:35] Module loaded: seen            
[20:56:35] Module loaded: blowfish        
[20:56:35] Module loaded: assoc            (with lang support)
[20:56:35] Module loaded: wire             (with lang support)
[20:56:35] Module loaded: uptime          
[20:56:35] Userinfo TCL v1.07 loaded (URL BF GF IRL EMAIL DOB PHONE ICQ).
[20:56:35] use '.help userinfo' for commands.
[20:56:35] GetOps v2.3c loaded.
[20:56:35] Writing channel file...
[20:56:35] Userfile loaded, unpacking...
[20:56:35] === constable: 2 channels, 1 users.
Launched into the background  (pid: 28242)

(elsewhere on IRC)

03:56 -!- constable [~constable@xyzzy.hsd1.ca.comcast.net] has 
          joined #foobarbaz

I think this is good to go. Eggdrop rides again!

comment:7 Changed 10 years ago by dreness (Andre LaBranche)

... and in the spirit of maybe educating others on this theme that I just learned in the process of figuring this out: the 'inline' keyword on a function exists purely as a (potential) performance optimization. When this keyword is present, it directs the compiler to integrate the function's code into the code of all the callers of that function, with the goal of eliminating the function call overhead (if you didn't know this fact and you are laughing, you have sufficiently modern sensibilities). Although the inline keyword was occasionally useful 'back in the day', modern compilers are very smart, and do not appreciate being told when to inline something. The compiler is so sure of itself that it's an error to declare something inline. Without the inline keyword, the function might still be inlined, at the compiler's discretion.

comment:8 Changed 10 years ago by kurthindenburg (Kurt Hindenburg)

It builds/installs here OK now

A couple of points - guide.macports.org has a lot of good stuff

  • Use -t when building and install - it is trace mode and it will show what the software is trying to do outside the sandbox.
  • Use port lint --nitpick eggdrop - this will show you a few issues (no license and the patches are not named "correctly")
  • Remove the revision line as you increased the version already
  • At some point you might want to go through and change all tabs to spaces and align the columns

Do you have commit access or did you need someone to commit this?

comment:9 in reply to:  8 Changed 10 years ago by mf2k (Frank Schima)

Replying to khindenburg@…:

Do you have commit access or did you need someone to commit this?

He needs someone to commit. Only someone with a @macports email address can commit.

comment:10 in reply to:  8 Changed 10 years ago by dreness (Andre LaBranche)

I'll make the suggested changes first, then somebody can commit for me.

comment:11 in reply to:  7 Changed 10 years ago by ryandesign (Ryan Carsten Schmidt)

Replying to dre@…:

... and in the spirit of maybe educating others on this theme that I just learned in the process of figuring this out: the 'inline' keyword on a function exists purely as a (potential) performance optimization. When this keyword is present, it directs the compiler to integrate the function's code into the code of all the callers of that function, with the goal of eliminating the function call overhead (if you didn't know this fact and you are laughing, you have sufficiently modern sensibilities). Although the inline keyword was occasionally useful 'back in the day', modern compilers are very smart, and do not appreciate being told when to inline something. The compiler is so sure of itself that it's an error to declare something inline. Without the inline keyword, the function might still be inlined, at the compiler's discretion.

It's not a problem to use the inline keyword with modern compilers. However, clang and gcc handle the inline keyword differently, as described here: http://clang.llvm.org/compatibility.html#inline

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

Have you already reported this problem to the develoers of eggdrop? What is the URL of that report? What do they say the correct solution is? I assume they would want to keep their functions marked as inline, only fixed to be compatible with clang's understanding of that keyword.

comment:13 Changed 10 years ago by dreness (Andre LaBranche)

I haven’t filed a bug with eggdrop. I’m somewhat reluctant to do so, as the entire project is basically end of life, but I suppose it couldn’t hurt. I’m willing to bet that these patches do not appreciably change the runtime behavior or performance of eggdrop, especially considering that clang’s docs suggest simply removing the ‘inline’ keyword as an alternative to ‘static inline’.

In any case, I’ve been a bit busy but hopefully I can get this wrapped up soon...

Changed 10 years ago by dreness (Andre LaBranche)

Attachment: Portfile-eggdrop.diff added

Changed 10 years ago by dreness (Andre LaBranche)

Attachment: patch-src-proto.h.diff added

Changed 10 years ago by dreness (Andre LaBranche)

Attachment: patch-src-match.c.diff added

Changed 10 years ago by dreness (Andre LaBranche)

Attachment: patch-src-tclhash.h.diff added

comment:14 Changed 10 years ago by dreness (Andre LaBranche)

Updated patches to address the specified issues.

{78} andre@flux [irc/eggdrop] % port lint --nitpick eggdrop
--->  Verifying Portfile for eggdrop
--->  0 errors and 0 warnings found.
  • removed revision
  • added license
  • renamed patch files
  • tabs --> spaces, removed some trailing white space

comment:15 Changed 10 years ago by dreness (Andre LaBranche)

I was unable to create an account on the egghead's trac (seems like their trac is broken), but I was able to get on their forums, so I posted this:

http://forum.egghelp.org/viewtopic.php?p=103019

comment:16 Changed 10 years ago by dreness (Andre LaBranche)

(I still see some out-of-sandbox activity when building with -t, but I see this for other ports also, and none of it seems alarming to me)

comment:17 Changed 10 years ago by kurthindenburg (Kurt Hindenburg)

Resolution: fixed
Status: newclosed

Thanks, I should have mentioned to do 1 patch for whitespace and another afterwards, but I went ahead and separated them. Also, since all the patches are for the same thing, you could have combined them IMHO. I wonder if adding these patches would fix the build for MtLion/Lion.

Committed r122561 and r122562

comment:18 in reply to:  17 Changed 10 years ago by jmroot (Joshua Root)

Replying to khindenburg@…:

I wonder if adding these patches would fix the build for MtLion/Lion.

I’m sure they would. I would apply them unconditionally, not just on a specific platform.

comment:19 Changed 10 years ago by kurthindenburg (Kurt Hindenburg)

Fixed license and apply patches to all OS in r122586

Note: See TracTickets for help on using tickets.