Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 Sep 2014 11:08:19 -0700
From:      leeoliveshackelford@surewest.net
To:        Freebsd questions <freebsd-questions@freebsd.org>
Subject:   Please help with bash, clang, and gdb
Message-ID:  <0a25d1f33a72a97d809538c6d23ee07b@surewest.net>

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);
fcloseall();
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
ls 

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>
Delivered-To: freebsd-questions@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 8E15AC35
 for <freebsd-questions@freebsd.org>; Mon, 15 Sep 2014 18:13:52 +0000 (UTC)
Received: from COL004-OMC4S6.hotmail.com (col004-omc4s6.hotmail.com
 [65.55.34.208])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits))
 (Client CN "*.outlook.com", Issuer "MSIT Machine Auth CA 2" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 66FFDAA7
 for <freebsd-questions@freebsd.org>; Mon, 15 Sep 2014 18:13:52 +0000 (UTC)
Received: from COL128-W17 ([65.55.34.199]) by COL004-OMC4S6.hotmail.com with
 Microsoft SMTPSVC(7.5.7601.22724); Mon, 15 Sep 2014 11:13:51 -0700
X-TMN: [rHPRoO8gYrhW0S8laa2JSSJDcal2Yn+9]
X-Originating-Email: [jordantboland@live.com]
Message-ID: <COL128-W17573713233E242EE3150BC1C80@phx.gbl>
From: Jordan Boland <jordantboland@live.com>
To: "freebsd-questions@freebsd.org" <freebsd-questions@freebsd.org>
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)
 FILETIME=[CD767C50:01CFD110]
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
X-Content-Filtered-By: Mailman/MimeDel 2.1.18-1
X-BeenThere: freebsd-questions@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: User questions <freebsd-questions.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/options/freebsd-questions>, 
 <mailto:freebsd-questions-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-questions/>;
List-Post: <mailto:freebsd-questions@freebsd.org>
List-Help: <mailto:freebsd-questions-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-questions>, 
 <mailto:freebsd-questions-request@freebsd.org?subject=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 (http://www.freshports.org/vuxml.php?vid=3D5f030587-e39a-11de-881e-0=
01aa0166822).
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: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?0a25d1f33a72a97d809538c6d23ee07b>