why it shows 'ldd:FATAL: Could not load library libsocket.s'

i write a simple program

sockfd = socket(…)

and i add ‘-lsocket’ in project link optioins

it’s compiled well.

but when i run it, it shows

“ldd:FATAL: Could not load library libsocket.so.3”

why it happens? please help…

First let me guess. You are cross developing? If so, your target is missing the library.

If not, you have some kind of strange compiler, system mismatch. Something like this happens to me now and then if I compile on one version of QNX but try to run on another.

Or you are compiling for 6.5.0 and the target is 6.4.1 ( example )

well, i do it. target version is 641, IDE is 650.

can’t it works?

Yes, but you have to setup the IDE to compile for 641 targets. Don’t ask me how, I don’t do much with the IDE but I know it is possible.

Under Windows/Preferences/QNX or via the config program in the StartMenu of Windows.

thanks to all of you, i download a target of 6.5.0. it works now.

btw. i found the socket field differ between linux and qnx. as follows. why??

linux:
#define AF_UNIX 1 /* Unix domain sockets /
#define AF_LOCAL 1 /
POSIX name for AF_UNIX /
#define AF_INET 2 /
Internet IP Protocol /
#define AF_AX25 3 /
Amateur Radio AX.25 /
#define AF_IPX 4 /
Novell IPX /
#define AF_APPLETALK 5 /
AppleTalk DDP /
#define AF_NETROM 6 /
Amateur Radio NET/ROM /
#define AF_BRIDGE 7 /
Multiprotocol bridge /
#define AF_ATMPVC 8 /
ATM PVCs /
#define AF_X25 9 /
Reserved for X.25 project /
#define AF_INET6 10 /
IP version 6 /
#define AF_ROSE 11 /
Amateur Radio X.25 PLP /
#define AF_DECnet 12 /
Reserved for DECnet project /
#define AF_NETBEUI 13 /
Reserved for 802.2LLC project*/
#define AF_SECURITY 14 /* Security callback pseudo AF /
#define AF_KEY 15 /
PF_KEY key management API */
#define AF_NETLINK 16

qnx:
#define AF_UNSPEC 0 /* unspecified /
#define AF_LOCAL 1 /
local to host (pipes, portals) /
#define AF_UNIX AF_LOCAL /
backward compatibility /
#define AF_INET 2 /
internetwork: UDP, TCP, etc. /
#define AF_IMPLINK 3 /
arpanet imp addresses /
#define AF_PUP 4 /
pup protocols: e.g. BSP /
#define AF_CHAOS 5 /
mit CHAOS protocols /
#define AF_NS 6 /
XEROX NS protocols /
#define AF_ISO 7 /
ISO protocols /
#define AF_OSI AF_ISO
#define AF_ECMA 8 /
european computer manufacturers /
#define AF_DATAKIT 9 /
datakit protocols /
#define AF_CCITT 10 /
CCITT protocols, X.25 etc /
#define AF_SNA 11 /
IBM SNA /
#define AF_DECnet 12 /
DECnet /
#define AF_DLI 13 /
DEC Direct data link interface /
#define AF_LAT 14 /
LAT /
#define AF_HYLINK 15 /
NSC Hyperchannel */

Because it`s not the same stack, plain and simple. There is no requirement for it to be the same.