Unable to install a shared library in yocto - linux

I wrote a recipe to build a shared library. Here is the recipe
SUMMARY = "test library"
SRC_URI = " file://file1.c \
file://file2.c \
file://internal.h"
LICENSE = "CLOSED"
FILES_${PN} = "libtest.so"
do_compile() {
${CC} -fPIC -c ${WORKDIR}/file1.c -o ${WORKDIR}/file1.o
${CC} -fPIC -c ${WORKDIR}/file2.c -o ${WORKDIR}/file2.o
${CC} -shared -o ${WORKDIR}/libesys.so ${WORKDIR}/file1.o ${WORKDIR}/file2.o
}
do_install() {
install -d ${D}${libdir}
install -m 0644 ${WORKDIR}/libtest.so ${D}${libdir}/
}
It fails with the following errors:
ERROR: test-0.1-r0 do_package_qa: QA Issue: -dev package contains non-symlink .so: test-dev path '/work/corei7-64-poky-linux/test/0.1-r0/packages-split/test-dev/usr/lib64/libtest.so' [dev-elf]
ERROR: test-0.1-r0 do_package_qa: QA Issue: No GNU_HASH in the elf binary: '/home/jamal/repotest1/build/tmp/work/corei7-64-poky-linux/test/0.1-r0/packages-split/test-dev/usr/lib64/libtest.so' [ldflags]
ERROR: test-0.1-r0 do_package_qa: QA run found fatal errors. Please consider fixing them.
ERROR: test-0.1-r0 do_package_qa: Function failed: do_package_qa
ERROR: Logfile of failure stored in: /home/jamal/repotest1/build/tmp/work/corei7-64-poky-linux/test/0.1-r0/temp/log.do_package_qa.20989
ERROR: Task (/home/jamal/repotest1/sources/meta-test/recipes-support/test/test_0.1.bb:do_package_qa) failed with exit code '1'
Can you please help me in to find out the issue.. Appreciate your efforts.

Default packaging rules assumes that libraries are versioned, and your libraries are not.
Either install versioned libraries, or if you really don't want to https://wiki.yoctoproject.org/wiki/TipsAndTricks/Packaging_Prebuilt_Libraries#Non-versioned_Libraries shows you how to manipulate the rules.

LICENSE = "CLOSED"
SRC_URI = "file://greetings.c \
file://greetings.h \
"
S = "${WORKDIR}"
TARGET_CC_ARCH += "${LDFLAGS}"
#INHIBIT_PACKAGE_STRIP = "1"
#INHIBIT_SYSROOT_STRIP = "1"
SOLIBS = ".so"
FILES_SOLIBSDEV = ""
do_configure () {
# Specify any needed configure commands here
:
}
do_compile () {
${CC} -fPIC -c ${WORKDIR}/greetings.c -o ${WORKDIR}/greetings.o
${CC} -shared -o ${WORKDIR}/libtest.so ${WORKDIR}/greetings.o
#g++ -fPIC -shared -Wl,-soname,libtest.so.1 -o libtest.so.1.1.0
}
do_install () {
install -d ${D}${libdir}
install -d ${D}${includedir}
#oe_soinstall ${WORKDIR}/libtest.so ${D}${libdir}
install -m 0644 ${WORKDIR}/libtest.so ${D}${libdir}
install -m 0755 ${S}/*.h ${D}${includedir}
}

Related

gcc undefined reference to `pthread_atfork'

I'm trying to compile a recent version of openssl on an optware-ng install with gcc 7.2.0 on x86_64 architecture
The system has 2 libpthreads, one in /lib:/usr/lib:/lib64:/usr/lib64 (link to each other). And one in the optware-ng install in /opt/lib:/opt/lib64 (also link to each other)
Compiling goes fine, but at link time I get the following error:
gcc -pthread -m64 -Wa,--noexecstack -Wall -O3 -L. -o apps/openssl apps/asn1pars.o apps/ca.o apps/ciphers.o apps/cms.o apps/crl.o apps/crl2p7.o apps/dgst.o apps/dhparam.o apps/dsa.o apps/dsaparam.o apps/ec.o apps/ecparam.o apps/enc.o apps/engine.o apps/errstr.o apps/gendsa.o apps/genpkey.o apps/genrsa.o apps/nseq.o apps/ocsp.o apps/openssl.o apps/passwd.o apps/pkcs12.o apps/pkcs7.o apps/pkcs8.o apps/pkey.o apps/pkeyparam.o apps/pkeyutl.o apps/prime.o apps/rand.o apps/rehash.o apps/req.o apps/rsa.o apps/rsautl.o apps/s_client.o apps/s_server.o apps/s_time.o apps/sess_id.o apps/smime.o apps/speed.o apps/spkac.o apps/srp.o apps/storeutl.o apps/ts.o apps/verify.o apps/version.o apps/x509.o apps/libapps.a -lssl -lcrypto -ldl -pthread
./libcrypto.so: undefined reference to `pthread_atfork'
collect2: error: ld returned 1 exit status
Adding -v to the output of gcc:
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/opt/libexec/gcc/x86_64-buildroot-linux-gnu/7.2.0/lto-wrapper
Target: x86_64-buildroot-linux-gnu
Configured with: ../gcc-7.2.0/configure --build=x86_64-pc-linux-gnu --host=x86_64-buildroot-linux-gnu --target=x86_64-buildroot-linux-gnu --prefix=/opt --disable-nls --disable-static --with-as=/opt/bin/as --with-ld=/opt/bin/ld --enable-languages=c,c++,go --disable-multilib --disable-werror --with-gxx-include-dir=/opt/include/c++/7.2.0 --disable-__cxa_atexit --with-gnu-ld --disable-libssp --disable-multilib --enable-libquadmath --enable-tls --disable-libmudflap --enable-threads --without-isl --without-cloog --disable-decimal-float --with-arch=nocona --enable-shared --disable-libgomp --with-gmp=/home/jenkins/Optware-ng/buildroot-x86_64/staging/opt --with-mpfr=/home/jenkins/Optware-ng/buildroot-x86_64/staging/opt --with-mpc=/home/jenkins/Optware-ng/buildroot-x86_64/staging/opt --with-system-zlib
Thread model: posix
gcc version 7.2.0 (GCC)
COMPILER_PATH=/opt/libexec/gcc/x86_64-buildroot-linux-gnu/7.2.0/:/opt/libexec/gcc/x86_64-buildroot-linux-gnu/7.2.0/:/opt/libexec/gcc/x86_64-buildroot-linux-gnu/:/opt/lib/gcc/x86_64-buildroot-linux-gnu/7.2.0/:/opt/lib/gcc/x86_64-buildroot-linux-gnu/:/opt/lib/gcc/x86_64-buildroot-linux-gnu/7.2.0/../../../../x86_64-buildroot-linux-gnu/bin/
LIBRARY_PATH=/opt/lib64/../lib64/:/opt/lib/gcc/x86_64-buildroot-linux-gnu/7.2.0/:/opt/lib/gcc/x86_64-buildroot-linux-gnu/7.2.0/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/opt/lib64/:/opt/lib/gcc/x86_64-buildroot-linux-gnu/7.2.0/../../../../x86_64-buildroot-linux-gnu/lib/:/opt/lib/gcc/x86_64-buildroot-linux-gnu/7.2.0/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-pthread' '-m64' '-Wall' '-O3' '-L.' '-o' 'apps/openssl' '-pthread' '-mtune=generic' '-march=nocona'
/opt/libexec/gcc/x86_64-buildroot-linux-gnu/7.2.0/collect2 -plugin /opt/libexec/gcc/x86_64-buildroot-linux-gnu/7.2.0/liblto_plugin.so -plugin-opt=/opt/libexec/gcc/x86_64-buildroot-linux-gnu/7.2.0/lto-wrapper -plugin-opt=-fresolution=/tmp/cc5Txvvm.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lpthread -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --eh-frame-hdr -m elf_x86_64 -dynamic-linker /opt/lib64/ld-linux-x86-64.so.2 -o apps/openssl /opt/lib/gcc/x86_64-buildroot-linux-gnu/7.2.0/../../../../x86_64-buildroot-linux-gnu/lib/crt1.o /opt/lib/gcc/x86_64-buildroot-linux-gnu/7.2.0/../../../../x86_64-buildroot-linux-gnu/lib/crti.o /opt/lib/gcc/x86_64-buildroot-linux-gnu/7.2.0/crtbegin.o -L. -L/opt/lib64/../lib64 -L/opt/lib/gcc/x86_64-buildroot-linux-gnu/7.2.0 -L/opt/lib/gcc/x86_64-buildroot-linux-gnu/7.2.0/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/opt/lib64 -L/opt/lib/gcc/x86_64-buildroot-linux-gnu/7.2.0/../../../../x86_64-buildroot-linux-gnu/lib -L/opt/lib/gcc/x86_64-buildroot-linux-gnu/7.2.0/../../.. -rpath=/opt/lib64 apps/asn1pars.o apps/ca.o apps/ciphers.o apps/cms.o apps/crl.o apps/crl2p7.o apps/dgst.o apps/dhparam.o apps/dsa.o apps/dsaparam.o apps/ec.o apps/ecparam.o apps/enc.o apps/engine.o apps/errstr.o apps/gendsa.o apps/genpkey.o apps/genrsa.o apps/nseq.o apps/ocsp.o apps/openssl.o apps/passwd.o apps/pkcs12.o apps/pkcs7.o apps/pkcs8.o apps/pkey.o apps/pkeyparam.o apps/pkeyutl.o apps/prime.o apps/rand.o apps/rehash.o apps/req.o apps/rsa.o apps/rsautl.o apps/s_client.o apps/s_server.o apps/s_time.o apps/sess_id.o apps/smime.o apps/speed.o apps/spkac.o apps/srp.o apps/storeutl.o apps/ts.o apps/verify.o apps/version.o apps/x509.o apps/libapps.a -lssl -lcrypto -ldl -lgcc --as-needed -lgcc_s --no-as-needed -lpthread -lc -lgcc --as-needed -lgcc_s --no-as-needed /opt/lib/gcc/x86_64-buildroot-linux-gnu/7.2.0/crtend.o /opt/lib/gcc/x86_64-buildroot-linux-gnu/7.2.0/../../../../x86_64-buildroot-linux-gnu/lib/crtn.o
./libcrypto.so: undefined reference to `pthread_atfork'
collect2: error: ld returned 1 exit status
which seem to indicate in LIBRARY_PATH that it is first looking in /opt/lib64, which should be ok.
The output of
nm -g /opt/lib64/libpthread.so | grep pthread_atfork
000000000000edd0 T pthread_atfork#GLIBC_2.2.5
indicates that the method should be there.
The following piece of C code, creates the same link issue on this system, but compiles/links fine on other systems:
// compile with: gcc -pthread mycode.c
#include <stdio.h>
#include <pthread.h>
int main() {
pthread_t f2_thread, f1_thread;
void *f2(), *f1(), prepare();
int i1,i2;
i1 = 1;
i2 = 2;
// int pthread_atfork(void (*prepare)(void), void (*parent)(void), void (*child)(void));
pthread_create(&f1_thread,NULL,f1,&i1);
pthread_atfork(&prepare,NULL,NULL);
pthread_create(&f2_thread,NULL,f2,&i2);
pthread_join(f1_thread,NULL);
pthread_join(f2_thread,NULL);
}
void prepare() {
printf("prepare");
}
void *f1(int *x) {
int i;
i = *x;
sleep(1);
printf("f1: %d",i);
pthread_exit(0);
}
void *f2(int *x){
int i;
i = *x;
sleep(1);
printf("f2: %d",i);
pthread_exit(0);
}
It seems to me that gcc is somehow still using the /lib version, but I'm stuck.
I've tried adding
-Wl,-rpath=/opt/lib64
But it doesn't help. Any suggestions?

nixos: my custom package derivation fails on `cargo build`

I'm writing a package derivation to install kryptco/kr and it fails on cargo build phase.
kryptco/kr has a submodule kryptco/sigchain which is written by rust.
In the Makefile of kryptco/sigchain, they use the cargo web deploy command to build its submodule. My package deriation fails on this cargo web deploy phase.
These two errors were given.
error: warning: replace for the non root package will be ignored, specify replace at the workspace root:
package: /build/src/github.com/kryptco/kr/sigchain/sigchain_client/Cargo.toml
workspace: /build/src/github.com/kryptco/kr/sigchain/Cargo.toml
error: failed to fetch `https://github.com/rust-lang/crates.io-index`
Caused by:
[6] Couldn't resolve host name; class=Net (12)
The former error says to edit Cargo.toml and add [replace] section, but I want to avoid edit source code if I can.
What is the cause of these error?
This is my package derivation:
# Original: https://github.com/bogsen/nixos-public/blob/a0dc497eab5de528ce3006d\
36c52bc601422cf87/pkgs/krypton/default.nix
{ config, lib, pkgs, ... }: with lib; let
cfg = config.services.krypton;
cargoWeb = with pkgs; rustPlatform.buildRustPackage rec {
...
};
dependencies = with pkgs; [
cargo
emscripten
go
makeWrapper
perl
];
kr = pkgs.stdenv.mkDerivation {
name = "kr";
src = pkgs.fetchFromGitHub {
owner = "kryptco";
repo = "kr";
rev = "2.4.10";
sha256 = "1xxhlkcw2d52q1y4h40iyvq25804w7hzv0lflqnib68aps491xnj";
fetchSubmodules = true;
};
buildInputs = dependencies ++ [cargoWeb];
dontBuild = true;
postUnpack = ''
# prevent referring /homeless-shelter
export HOME=$(pwd)
# https://github.com/kryptco/kr/issues/254#issuecomment-464890476
sed -i.bak -e '8,11d' source/sigchain/Cargo.toml
export GOPATH=$(pwd)
export GOCACHE=$GOPATH/.cache/go-build
mkdir -p src/github.com/kryptco
mv source src/github.com/kryptco/kr
ln -s src/github.com/kryptco/kr source
'';
postPatch = ''
substituteInPlace Makefile --replace sudo ""
'';
makeFlags = [ "PREFIX=$(out)" ];
};
in {
config = {
nixpkgs.config.packageOverrides = pkgs: { kr = kr; };
};
}
And whole error message is here.
# use rsync so that file modifed times are only updated when the contents change
cd dashboard_yew && cargo web deploy --release --target=wasm32-unknown-emscripten && rsync --checksum --delete -r ../target/deploy/* ../target/deploy-final
error: warning: replace for the non root package will be ignored, specify replace at the workspace root:
package: /build/src/github.com/kryptco/kr/sigchain/sigchain_client/Cargo.toml
workspace: /build/src/github.com/kryptco/kr/sigchain/Cargo.toml
Updating crates.io index
warning: spurious network error (2 tries remaining): [6] Couldn't resolve host name; class=Net (12)
warning: spurious network error (1 tries remaining): [6] Couldn't resolve host name; class=Net (12)
error: failed to fetch `https://github.com/rust-lang/crates.io-index`
Caused by:
[6] Couldn't resolve host name; class=Net (12)
make[1]: *** [Makefile:25: libsigchain-with-dashboard] Error 101
make[1]: Leaving directory '/build/src/github.com/kryptco/kr/sigchain'
make: *** [Makefile:71: all] Error 2
builder for '/nix/store/78r0kh34ljzgfx658f9n99f8lxydjfxy-kr.drv' failed with exit code 2
I don't think you'll get around the [replace] edit for the config files. The build failing at cargo web deploy is due to an outdated version of openssl-sys (which is discontinued). Here's how Parity fixed it. Looks like they edited the Cargo.lock file to depend on newer versions of this lib.
You need to make it a fixed-output path, for this take a look at nix-pills.

How to link .so library properly in C++?

I have project structure like this,
a.pb.h --- includes --> protobuf.h
b.grpc.pb.h --- includes --> a.pb.h & grpcpp.h
Also there are a.pb.cc and b.grpc.cc files.
A C++ wrapper with extern C which is wrapper.cc and wrapper.h which includes b.grpc.pb.h and grpcpp.h.
The function inside extern C is char* helloWorld(const char*, const char*, const char*);
Creating .o of a.pb.h and b.grpc.pb.h:
g++ -fpic -std=c++11 `pkg-config --cflags protobuf grpc` -c -o a.pb.o a.pb.cc
g++ -fpic -std=c++11 `pkg-config --cflags protobuf grpc` -c -o b.grpc.pb.o b.grpc.pb.cc
Steps to create libcombined.so:
The grpc and protobuf so are already provided under /usr/local/lib.
First created .so of a.pb.o and b.grpc.pb.o to compile wrapper file as:
g++ -shared -o libcombined.so *.o
Compiled wrapper as:
g++ -fpic wrapper.cc -l:./libcombined.so -c -o wrapper.o -std=c++11
.so of a.pb.o, b.grpc.pb.o and wrapper.o as libcombined.so:
g++ -shared -o libcombinedwrapper.so *.o
Compiled main.c as:
gcc main.c -l:./libcombinedwrapper.so -o main -ldl
I am calling helloWorld from my main.c file which is:
#include <stdio.h>
#include <dlfcn.h>
int main(){
char* (*fn)(const char*,const char*,const char*);
void *handle = dlopen("path_to/libcombined.so",RTLD_NOW);
if(handle==NULL){
fprintf(stderr, "Error: %s\n", dlerror());
}
fn = (char* (*)(const char*,const char*,const char*))dlsym(handle, "helloWorld");
if (!fn) {
/* no such symbol */
fprintf(stderr, "Error: %s\n", dlerror());
dlclose(handle);
return 0;
}
char* msg = fn("asd","asdas","asdasd");
printf("%s",msg);
return 0;
}
Error after executing: ./main
Error: path_to/libcombinedwrapper.so: undefined symbol: _ZN6google8protobuf2io20ZeroCopyOutputStream15WriteAliasedRawEPKvi
Error: ./main: undefined symbol: helloWorld
Segmentation fault (core dumped)
The first above error is from symbol from protobuf.h file.
Can someone please suggest what I am doing wrong while linking or is there something I am doing wrong in main.c file?
g++ -shared -o libcombined.so *.o
You need to also link in all dependencies of the objects (libgrpc here).
You can add -Wl,--no-allow-shlib-undefined to verify that libcombined.so is linking everything it needs.
P.S. To avoid core dump, you should exit or return once dlopen fails.
P.P.S. It is generally a very bad idea(TM) to link *.o. Use proper Makefile to avoid unnecessary compilations and explicitly list objects that you are intending to put into libcombined.so.

nix-env and nix-shell have different versions of snap

I was following directions on reflex-platfrom project development,trying to test servant-reflex as a submodule.
My project is here.
In my backend.cabal, I have a built-depend:
snap >= 1.1.1.0 && < 1.2
When I nix-shell -A shells.ghc --run "cabal new-build all", it tries to install heist-1.0.1.0 and snap-1.0.0.2, then failed at
Configuring heist-1.0.1.0...
Setup: Encountered missing dependencies:
aeson >=0.6 && <1.2
To see what in my nixos-unstable, I:
`nix-channel --list`
nixos https://nixos.org/channels/nixos-unstable
`nix-env -f "<nixpkgs>" -qaP -A haskellPackages.aeson`
warning: Nix search path entry '/home/demo/.nix-defexpr/channels' does not exist, ignoring
haskellPackages.aeson aeson-1.2.4.0
`nix-env -f "<nixpkgs>" -qaP -A haskellPackages.snap`
warning: Nix search path entry '/home/demo/.nix-defexpr/channels' does not exist, ignoring
haskellPackages.snap snap-1.1.0.0
`nix-env -f "<nixpkgs>" -qaP -A haskellPackages.heist`
warning: Nix search path entry '/home/demo/.nix-defexpr/channels' does not exist, ignoring
haskellPackages.heist heist-1.0.1.2
Q: Why does nix-shell install heist-1.0.1.0 and snap-1.0.0.2, instead of heist-1.0.1.2 and snap-1.1.0.0, which then can dependent on aeson-1.2.4.0?
Got an answer from elvishjerricco on IRC #nixos.
To doJailbreak heist, you'd use the overrides argument to
project
packages is for just declaring directories that you want to turn
into haskell packages; it'll run cabal2nix for you. overrides is for
doing derivation changes to the haskell package set.
default.nix
(import ./reflex-platform {}).project ({ pkgs, ... }: {
overrides = self: super: {
heist = pkgs.haskell.lib.doJailbreak super.heist;
map-syntax = pkgs.haskell.lib.doJailbreak super.map-syntax;
};
packages = {
common = ./common;
backend = ./backend;
frontend = ./frontend;
google-maps-reflex = ./google-maps-reflex;
};
shells = {
ghc = ["common" "backend" "frontend" "heist"]; # "backend" "frontend"];
ghcjs = ["common" "frontend"];
};
})

compile rpcgen program on ubuntu

I am new to rpcgen programming.
On compiling the following sample rpcgen example on ubuntu I get error.The main functionality is to calculate the square of a given number
square.X
struct square_in {
long arg1;
};
struct square_out {
long res1;
};
program SQUARE_PROG {
version SQUARE_VERS {
square_out SQUAREPROC(square_in) = 1;
/* procedure number = 1 */
} = 1; /* version number = 1 */
} = 0x31230000; /* program number = 0x31230000 */
client.c
#include <rpc/rpc.h>
#include "square.h"
int
main(int argc, char **argv)
{
CLIENT *cl;
square_in in;
square_out *outp;
if (argc != 3)
//err_quit("usage: client <hostname> <integer-value>");
exit(0);
cl = clnt_create(argv[1], SQUARE_PROG, SQUARE_VERS, "tcp");
in.arg1 = atol(argv[2]);
if ( (outp = squareproc_1(&in, cl)) == NULL)
//err_quit("%s", clnt_sperror(cl, argv[1]));
exit(0);
printf("result: %ld\n", outp->res1);
exit(0);
}
server.c
#include <rpc/rpc.h>
#include "square.h"
#include <stdio.h>
square_out *
squareproc_1_svc(square_in *inp, struct svc_req *rqstp)
{
static square_out out;
printf("thread %d started, arg = %ld\n",
pr_thread_id(NULL), inp->arg1);
sleep(5);
out.res1 = inp->arg1 * inp->arg1;
printf("thread %d done\n", pr_thread_id(NULL));
return(&out);
}
makefile:
PROGS = client server
CFLAGS += -DDEBUG
all: ${PROGS}
square.h square_clnt.c square_svc.c square_xdr.c: square.x
rpcgen -C square.x
square_clnt.o: square_clnt.c square.h
square_svc.o: square_svc.c square.h
client: square.h client.o square_clnt.o square_xdr.o
${CC} ${CFLAGS} -o $# client.o square_clnt.o square_xdr.o \
${LIBS} ${LIBS_RPC}
server: square.h server.o square_svc.o square_xdr.o
${CC} ${CFLAGS} -o $# server.o square_svc.o square_xdr.o \
${LIBS} ${LIBS_RPC}
clean:
rm -f ${PROGS} ${CLEANFILES} *_clnt.c *_svc.c *_xdr.c square.h
On execution, I get the following error:
cc -DDEBUG -c -o client.o client.c
cc -DDEBUG -o client client.o square_clnt.o square_xdr.o \
cc -DDEBUG -c -o server.o server.c
cc -DDEBUG -o server server.o square_svc.o square_xdr.o \
server.o: In function `squareproc_1_svc':
server.c:(.text+0x14): undefined reference to `pr_thread_id'
server.c:(.text+0x52): undefined reference to `pr_thread_id'
collect2: error: ld returned 1 exit status
make: *** [server] Error 1
use server file like this
// SERVER FILE: server.c
#include"rpc/rpc.h"
#include"square.h"
#include"stdio.h"
#include"stdlib.h"
#include"math.h"
square_out *squareproc_1_svc(square_in *inp,struct svc_req *rqstp)
{
static square_out out;
out.res1 = inp->arg1 * inp->arg1;
return(&out);
}
and run program using
[root#localhost ~]# rpcgen -C square.x
[root#localhost ~]# cc -c client.c -o client.o
[root#localhost ~]# cc -c square_clnt.c -o square_clnt.o
[root#localhost ~]# cc -c square_xdr.c -o square_xdr.o
[root#localhost ~]# cc -o client client.o square_clnt.o square_xdr.o
[root#localhost ~]# cc -c client.c server.c square_xdr.c
[root#localhost ~]# cc -c server.c -o server.o
[root#localhost ~]# cc -c square_svc.c -o square_svc.o
[root#localhost ~]# cc -o server server.o square_svc.o square_xdr.o
[root#localhost ~]# ./server &
[1] 3334
[root#localhost ~]# ./client localhost 4
result is : 16
I don't think you need to use pr_thread_id. Try compiling without it.

Resources