Opened 19 years ago

Closed 18 years ago

Last modified 9 years ago

#6080 closed defect (fixed)

BUG: tsocks-1.8beta5_1 can't resolve libSystem symbols

Reported by: darren.bane@… Owned by: tobypeterson
Priority: Normal Milestone:
Component: ports Version: 1.0
Keywords: Cc: markd@…
Port: tsocks

Description (last modified by ryandesign (Ryan Carsten Schmidt))

the error log can be found here: INLINE

Description: When preloaded using DYLD_INSERT_LIBRARIES, libtsocks.dylib can't resolve symbols from libSystem.dylib like close and connect.

Comments: I used a sh-compatible shell. I also tried setting DYLD_INSERT_LIBRARIES to "/opt/local/ lib/libtsocks.dylib:/usr/lib/libSystem.dylib", to no avail.

================INLINE CONTENT================

$ port install tsocks
$ DYLD_INSERT_LIBRARIES=/opt/local/lib/libtsocks.dylib
$ export DYLD_INSERT_LIBRARIES
$ DYLD_FORCE_FLAT_NAMESPACE=t
$ export DYLD_FORCE_FLAT_NAMESPACE
$ telnet btmux.com 5555
Trying 130.127.67.247...
14:40:00 libtsocks(21133): Unresolved symbol: close
14:40:00 libtsocks(21133): Unresolved symbol: close
14:40:00 libtsocks(21133): Unresolved symbol: close
14:40:00 libtsocks(21133): Unresolved symbol: connect
telnet: connect to address 130.127.67.247: Unknown error: 0
telnet: Unable to connect to remote host
14:40:00 libtsocks(21133): Unresolved symbol: close
$ 

--
Darren Bane

Attachments (1)

patch-tsocks.c (515 bytes) - added by darren.bane@… 19 years ago.
Declares _init as having attribute((constructor))

Download all attachments as: .zip

Change History (8)

comment:1 Changed 19 years ago by darren.bane@…

I fixed this. The problem is that the symbol _init isn't special to dyld, like it would be in an ELF system. The solution from http://developer.apple.com/documentation/DeveloperTools/Conceptual/DynamicLibraries/Articles/DynamicLibraryDesignGuidelines.html#//apple_ref/doc/uid/TP40002013-SW17 is in the attached patch.

Last edited 9 years ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

Changed 19 years ago by darren.bane@…

Attachment: patch-tsocks.c added

Declares _init as having attribute((constructor))

comment:2 Changed 19 years ago by darren.bane@…

(From update of attachment 5079)

--- tsocks.c_orig	2005-12-14 18:12:36.000000000 +0000
+++ tsocks.c	2005-12-14 18:12:56.000000000 +0000
@@ -68,7 +68,6 @@
 static char *conffile = NULL;

 /* Exported Function Prototypes */
-void _init(void);
 int connect(CONNECT_SIGNATURE);
 int select(SELECT_SIGNATURE);
 int poll(POLL_SIGNATURE);
@@ -100,6 +99,7 @@
 static int read_socksv5_connect(struct connreq *conn);
 static int read_socksv5_auth(struct connreq *conn);

+__attribute__((constructor))
 static void _init(void) {
 #ifdef USE_OLD_DLSYM
	void *lib;
Last edited 9 years ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:3 Changed 19 years ago by darren.bane@…

Ah, I'm no good at driving Bugzilla. What I meant to do in the previous post was make the definition of _init static.

comment:4 Changed 19 years ago by darren.bane@…

dependson: 6735

comment:5 Changed 18 years ago by markd@…

Cc: markd@… added

A revision has been committed. Please test it.

comment:6 Changed 18 years ago by markd@…

Resolution: fixed
Status: newclosed

Please reopen if you still experience the problem.

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

Description: modified (diff)
Port: tsocks added
Note: See TracTickets for help on using tickets.