Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 Sep 2014 11:08:19 -0700
To:        Freebsd questions <>
Subject:   Please help with bash, clang, and gdb
Message-ID:  <>

Next in thread | Raw E-Mail | Index | Archive | Help

Greetings dear FreeBSD enthusiast. I have written a character mode
c-language program that is supposed to read data from a text file on a
floppy disk, perform calculations on that data, then write the result to
another text file on the same floppy disk. The operating system is
FreeBSD 9.1. The computer is a Hewlett-Packard xw4400 workstation
equipped with a Pentium D microprocessor. The D processor has only a
single core. 

I insert the floppy disk, then type as follows: 

mount -t msdosfs -w /dev/fd0 /mnt
clang -x c -g /mnt/ProgName.c > mnt/CompOut.txt 2>&1 

I do not understand the syntax of the last four characters of the second
line, but they somehow cause bash to redirect the output of clang
orginially directed to the monitor screen to the specified file. The
output file from clang is generated. It contains one warning, and no
errors. If I then type at the prompt 

/root/a.out /mnt/BmIn0001.txt 

the a.out program prints to the monitor screen instructions to the user,
which are followed immediatedly by the prompt symbol. The source-code
line to open the input file is as follows: 

if ((InpFileHand = fopen (argv[1], "rb"))==NULL)
printf ("nCould not open file %s.", argv [1]);
exit (11);

The source-code line to open the output file is as follows: 

if ((OutpFileHand = fopen (OutpFileName, "wt")) == NULL)
printf ("nCould not open file %s", OutpFileName);
exit (25);

where OutpFileName is an array of char read from the input file. If I
enter the following 

wait $!
echo $? 

the exit code of 0 is displayed. An exit code of 0 is generated by the
last line of the program. If the program failed to open either file, an
error code of either 11 or 25 should have been produced. Even though the
a.out program exitted normally as far as the operating system is
concerned, the indicator on the floppy drive never lights, causing me to
believe that the program failed to read the input file. When I enter 

cd /mnt

the expected output file is shown to be absent. How did my program get
all of the way from beginning to end without opening the files, yet not
exit with expected codes of 11 or 25? Attempting to answer this
question, I then enter at the prompt 

gdb /root/a.out 

then, at the gdb prompt, enter 

set args /mnt/BmIn0001.txt 

gdb fails with an error code of 0177. I research this error code with
the aid of Google, and am informed that it indicates that, under
p-threads, the libraries were loaded in an incorrect order. My program
is intended to be a c language, not c++ language program, with all
libraries loaded with the executable and linked statically. The only
libraries referenced in the program are stdio, stdlib, math, and time.
The only library functions called are printf(), fprintf(), fopen(),
fcloseall(), fgetc(), ungetc(), fwrite(), sqrtr(), time(), and ctime().
What do any of these have to do with p-threads? 

I realize that this is a long message, and that programmers may have
more important responsibilities than helping newbies. Is there a FreeBSD
developer who is familiar with these three programs who might be willing
to identify my error(s)? Any and all suggestions are appreciated.
Sincerely, Newby Lee 
From owner-freebsd-questions@FreeBSD.ORG  Mon Sep 15 18:13:52 2014
Return-Path: <owner-freebsd-questions@FreeBSD.ORG>
Received: from (
 (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by (Postfix) with ESMTPS id 8E15AC35
 for <>; Mon, 15 Sep 2014 18:13:52 +0000 (UTC)
Received: from (
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits))
 (Client CN "*", Issuer "MSIT Machine Auth CA 2" (verified OK))
 by (Postfix) with ESMTPS id 66FFDAA7
 for <>; Mon, 15 Sep 2014 18:13:52 +0000 (UTC)
Received: from COL128-W17 ([]) by with
 Microsoft SMTPSVC(7.5.7601.22724); Mon, 15 Sep 2014 11:13:51 -0700
X-TMN: [rHPRoO8gYrhW0S8laa2JSSJDcal2Yn+9]
X-Originating-Email: []
Message-ID: <COL128-W17573713233E242EE3150BC1C80@phx.gbl>
From: Jordan Boland <>
To: "" <>
Subject: linux-crashplan (relies on forbidden port: linux-f10-expat)
Date: Mon, 15 Sep 2014 11:13:51 -0700
Importance: Normal
MIME-Version: 1.0
X-OriginalArrivalTime: 15 Sep 2014 18:13:51.0381 (UTC)
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
X-Content-Filtered-By: Mailman/MimeDel 2.1.18-1
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: User questions <>
List-Unsubscribe: <>, 
List-Archive: <>;
List-Post: <>
List-Help: <>
List-Subscribe: <>, 
X-List-Received-Date: Mon, 15 Sep 2014 18:13:52 -0000

Hi Everyone=2C
I'd like to implement Crashplan=2C and was pleased to find some notes onlin=
e from others who have it running using the Linux ABI.  Crashplan requires =
a Linux JRE=2C which in turn requires linux-f10-expat=2C which has been for=
bidden (
Running `make -DNO_IGNORE` against linux-f10-expat fails with "error 1" - I=
 can't find any information on this error (I think the expectation is that =
make will provide a message=2C but it doesn't).
Do I have any options left?  There might not be a lot of us looking at Cras=
hplan in particular=2C but all of the linux-compatible JREs require the lin=
ux-f10-expat port=2C so I thought there should be someone else talking abou=
t it=2C but I seem to be mistaken about that.
Thank you for your help=2C
-Jordan 		 	   		  =

Want to link to this message? Use this URL: <>