- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- troubleshooting bus errors compiling with gcc 3.4....
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2005 03:04 AM
05-20-2005 03:04 AM
I link the objects using:
gcc -o foo f1.o f2.o f3.o -lpthread -lrt
Upon running the application, I get a bus error whenever passing the address of a stack variable into a function call, e.g. main() calls f2_func(&stack_var). Avoiding that by allocating the variable using malloc, I consistently get -1 returns from *all* system calls with errno still 0. These are obviously audited calls like mkdir("/tmp/foo",S_IRWXU) when foo does not exist
The constituent objects are built with no command line options to gcc except -g:
gcc -g -c -o f1.o f1.c (and so forth)
Clearly there is some memory alignment problem in the first case and an application linking/compat problem in the latter, but I know not how to resolve then and my initial doc readings did not turn anything up. Any help would be appreciated. Thanks!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-21-2005 06:49 PM
05-21-2005 06:49 PM
Re: troubleshooting bus errors compiling with gcc 3.4.3 on 11.11
-mt
-pthread
Add support for multithreading using the POSIX threads library. This option sets flags for both the preprocessor and linker. It does not affect the thread safety of object code produced by the compiler or that of libraries supplied with it. These are HP-UX specific flags.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2005 02:36 AM
05-23-2005 02:36 AM
Re: troubleshooting bus errors compiling with gcc 3.4.3 on 11.11
[root@chpux1]# make
gcc -mt -pthread -Wall -g -c -o find.o find.c
cc1: error: invalid option `t'
gmake: *** [find.o] Error 1
[root@chpux1]# gcc -mmt -Wall -g -c -o find.o find.c
cc1: error: invalid option `mt'
[root@chpux1]# gcc --version
gcc (GCC) 3.4.3
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[root@chpux1]# uname -s -r -m
HP-UX B.11.11 9000/800
[root@chpux1]#
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2005 02:43 AM
05-23-2005 02:43 AM
Re: troubleshooting bus errors compiling with gcc 3.4.3 on 11.11
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2005 12:26 PM
05-23-2005 12:26 PM
Solution$ gcc -pthread -v test.c
...
/opt/local/libexec/gcc/hppa2.0w-hp-hpux11.11/3.4.2/cc1 -quiet -v -iprefix /opt/local/bin/../lib/gcc/hppa2.0w-hp-hpux11.11/3.4.2/ -D_REENTRANT -D_THREAD_SAFE -D_POSIX_C_SOURCE=199506L test.c -quiet -dumpbase test.c -auxbase test -version -o /var/tmp//ccYG5pet.s
...
$ gcc -dumpspecs | grep pthread
%{mt|pthread:-D_REENTRANT -D_THREAD_SAFE -D_POSIX_C_SOURCE=199506L}
If you specify -pthread it will add -D_REENTRANT -D_THREAD_SAFE -D_POSIX_C_SOURCE=199506L preprocessor flags.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2005 06:22 AM
05-24-2005 06:22 AM