DaemonForums  

Go Back   DaemonForums > Miscellaneous > Programming

Programming C, bash, Python, Perl, PHP, Java, you name it.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 18th April 2010
Mr-Biscuit Mr-Biscuit is offline
Banned
 
Join Date: May 2008
Posts: 272
Thanked 0 Times in 0 Posts
Default Question on endianess

Environment: Linux- debian; powerpc
Package: gpart latest.tar.gz
Problem: bug reports state that since the package is little endian.

In order to build and create the package, I need to be able to force a build.
Is this possible with editing the Makefile or am I missing a build/make command?
Reply With Quote
  #2   (View Single Post)  
Old 18th April 2010
thirdm thirdm is offline
Package Pilot
 
Join Date: May 2009
Posts: 195
Thanked 3 Times in 3 Posts
Default

If it has an endian bug, forcing a build will do you no good. You need to understand the nature of the endian problem and correct it. There are functions in BSD that may help with this: try man byteorder
Reply With Quote
  #3   (View Single Post)  
Old 18th April 2010
Mr-Biscuit Mr-Biscuit is offline
Banned
 
Join Date: May 2008
Posts: 272
Thanked 0 Times in 0 Posts
Default

Unfortunately, there doesn't seem to be a byteorder package for what I'm using.
Not BSD, linux. Trying to get the disk written to with ufs2.

Hey, thanks for the information. I'll see if a package exists in another distribution.
Reply With Quote
  #4   (View Single Post)  
Old 18th April 2010
thirdm thirdm is offline
Package Pilot
 
Join Date: May 2009
Posts: 195
Thanked 3 Times in 3 Posts
Default RE: Question on endianess

Quote:
Originally Posted by Mr-Biscuit View Post
Unfortunately, there doesn't seem to be a byteorder package for what I'm using.
Not BSD, linux. Trying to get the disk written to with ufs2.
Sorry, as you guessed, I missed that you were using Linux. It must have some of the same kinds of functions, though.

If you look at the bottom of this OpenBSD man page, you see some of the functions you might use, depending on what's needed, (htonl, htons(), ntohl(), and ntohs()) are defined by POSIX, so Linux should have them too.

http://www.openbsd.org/cgi-bin/man.c...86&format=html

Debian unstable looks like it has a version 0.1h and you're using version 0.1f. Have you tried h with their patches yet?
Reply With Quote
  #5   (View Single Post)  
Old 19th April 2010
Mr-Biscuit Mr-Biscuit is offline
Banned
 
Join Date: May 2008
Posts: 272
Thanked 0 Times in 0 Posts
Default

I just started looking at that earlier.
Reply With Quote
  #6   (View Single Post)  
Old 21st April 2010
Mr-Biscuit Mr-Biscuit is offline
Banned
 
Join Date: May 2008
Posts: 272
Thanked 0 Times in 0 Posts
Default

This was added to the new snapshot by the developers.
Reply With Quote
  #7   (View Single Post)  
Old 18th April 2010
Mr-Biscuit Mr-Biscuit is offline
Banned
 
Join Date: May 2008
Posts: 272
Thanked 0 Times in 0 Posts
Default

More information including break.


Code:
debian:/home/moleque/gpart-0.1f# uname -a
Linux debian 2.6.26-2-powerpc #1 Tue Mar 9 23:07:18 UTC 2010 ppc GNU/Linux
debian:/home/moleque/gpart-0.1f# cat /proc/cpuinfo
processor       : 0
cpu             : 740/750
temperature     : 27-32 C (uncalibrated)
clock           : 400.000000MHz
revision        : 2.2 (pvr 0008 0202)
bogomips        : 49.79
timebase        : 24934516
platform        : PowerMac
model           : PowerMac1,1
machine         : PowerMac1,1
motherboard     : PowerMac1,1 MacRISC Power Macintosh
detected as     : 66 (Blue&White G3)
pmac flags      : 00000000
L2 cache        : 1024K unified
pmac-generation : NewWorld
debian:/home/moleque/gpart-0.1f# pwd
/home/moleque/gpart-0.1f
debian:/home/moleque/gpart-0.1f# make
make -C src
make[1]: Entering directory `/home/moleque/gpart-0.1f/src'
make[1]: Leaving directory `/home/moleque/gpart-0.1f/src'
make[1]: Entering directory `/home/moleque/gpart-0.1f/src'
gcc -Wall -O2 -pedantic -DVERSION=\"0.1f\"   -c -o gpart.o gpart.c
gpart.c:61: warning: built-in function ‘log’ declared as non-function
gpart.c: In function ‘is_ext_parttable’:
gpart.c:397: warning: suggest parentheses around comparison in operand of |
gpart.c: In function ‘print_disk_desc’:
gpart.c:590: warning: suggest parentheses around comparison in operand of |
gpart.c: In function ‘write_primary_ptbl’:
gpart.c:1205: warning: suggest parentheses around comparison in operand of |
gcc -Wall -O2 -pedantic -DVERSION=\"0.1f\"   -c -o gmodules.o gmodules.c
gmodules.c: In function ‘g_mod_addexternal’:
gmodules.c:189: warning: ISO C forbids conversion of object pointer to function pointer type
gmodules.c:191: warning: ISO C forbids conversion of object pointer to function pointer type
gmodules.c:193: warning: ISO C forbids conversion of object pointer to function pointer type
gcc -Wall -O2 -pedantic -DVERSION=\"0.1f\"   -c -o disku.o disku.c
disku.c: In function ‘disk_geometry’:
disku.c:48: error: ‘errno’ undeclared (first use in this function)
disku.c:48: error: (Each undeclared identifier is reported only once
disku.c:48: error: for each function it appears in.)
disku.c: In function ‘reread_partition_table’:
disku.c:78: error: ‘errno’ undeclared (first use in this function)
make[1]: *** [disku.o] Error 1
make[1]: Leaving directory `/home/moleque/gpart-0.1f/src'
make: *** [gpart] Error 2
debian:/home/moleque/gpart-0.1f#
Reply With Quote
  #8   (View Single Post)  
Old 18th April 2010
Mr-Biscuit Mr-Biscuit is offline
Banned
 
Join Date: May 2008
Posts: 272
Thanked 0 Times in 0 Posts
Default

The entire make process just breaks with each file.
I changed the cflags to optimize.

Why would you write script with that many undeclared functions?

Maybe there's something I'm not getting besides being tired.

Last edited by Mr-Biscuit; 18th April 2010 at 07:32 AM.
Reply With Quote
  #9   (View Single Post)  
Old 18th April 2010
TerryP's Avatar
TerryP TerryP is offline
Arp Constable
 
Join Date: May 2008
Location: USofA
Posts: 1,547
Thanked 112 Times in 104 Posts
Default

errno is a more of a standard global variable than a function. Perhaps once pre processing is complete it forgets to include errno.h?
__________________
My Journal

Thou shalt check the array bounds of all strings (indeed, all arrays), for surely where thou typest ``foo'' someone someday shall type ``supercalifragilisticexpialidocious''.
Reply With Quote
Old 18th April 2010
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 3,135
Thanked 182 Times in 149 Posts
Default

For some info about the errno issue, see http://cr.yp.to/docs/unixport.html#errno
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump
Reply With Quote
Old 18th April 2010
Mr-Biscuit Mr-Biscuit is offline
Banned
 
Join Date: May 2008
Posts: 272
Thanked 0 Times in 0 Posts
Default

I think it ha something to do with the code not made for big endian arcitecture.
I'm trying it out on the g3. Every file has to be edited.
Reply With Quote
Old 18th April 2010
TerryP's Avatar
TerryP TerryP is offline
Arp Constable
 
Join Date: May 2008
Location: USofA
Posts: 1,547
Thanked 112 Times in 104 Posts
Default

How much trouble porting between different endiannesses is mostly a weight on who wrote it in the first place; not everyone makes it easy to do (and it can be a pain).
__________________
My Journal

Thou shalt check the array bounds of all strings (indeed, all arrays), for surely where thou typest ``foo'' someone someday shall type ``supercalifragilisticexpialidocious''.
Reply With Quote
Reply

Tags
quasi-solved

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
external drive partition question + fdisk question gosha OpenBSD General 15 15th June 2009 02:00 PM


All times are GMT. The time now is 06:15 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick