Thread: runs on Ubuntu, but segmentation faults on Kubuntu.....

  1. #1
    Registered User
    Join Date
    Oct 2008
    Posts
    51

    runs on Ubuntu, but segmentation faults on Kubuntu.....

    so I spent the last 4 days writing this program on ubuntu, everything runs nice.

    but on kubuntu it craps out with a segmentation fault....wtf?


    the program is being marked on kubuntu, so am I screwed?

    how do I know where it seg faults?

  2. #2
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by ktran03 View Post
    how do I know where it seg faults?
    A debugger, such as gdb.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  3. #3
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    Erm... what program?

    Learn how to use a debugger and find the problem.

  4. #4
    Registered User
    Join Date
    Oct 2008
    Posts
    51
    googling right now...brb

  5. #5
    ... kermit's Avatar
    Join Date
    Jan 2003
    Posts
    1,534
    Quote Originally Posted by ktran03 View Post
    so I spent the last 4 days writing this program on ubuntu, everything runs nice.

    but on kubuntu it craps out with a segmentation fault....wtf?


    the program is being marked on kubuntu, so am I screwed?

    how do I know where it seg faults?
    Post your code - you never know what someone might see as being the problem.

  6. #6
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Ubuntu has a very active and helpful forum - I'd ask there also, if it's Ubuntu/Kubuntu specific.

    I don't have the URL because I'm on a windows box here, but I've used it several times, and it's great - just google Ubuntu forum, it'll be top of the list.

  7. #7
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    I'd be willing to bet 2 pence that you are doing something that is undefined, and the difference in the two systems makes it "work" and "fault" respectively.

    Maybe using memory you don't own?

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  8. #8
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    Getting anything substantial to work on one system is half skill and half luck.

    It's only when you start porting the code to different systems and different compilers that you really begin to understand what all those "undefined" and "implementation-specific" statements mean.

    Have you used valgrind on Ubuntu yet?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  9. #9
    Fountain of knowledge.
    Join Date
    May 2006
    Posts
    794
    Quote Originally Posted by ktran03 View Post
    so I spent the last 4 days writing this program on ubuntu, everything runs nice.

    but on kubuntu it craps out with a segmentation fault....wtf?


    the program is being marked on kubuntu, so am I screwed?

    how do I know where it seg faults?
    What do you mean by 'marked on'?
    Sounds like the program has a bug and you just 'got lucky' on ubuntu.

  10. #10
    ... kermit's Avatar
    Join Date
    Jan 2003
    Posts
    1,534
    Quote Originally Posted by esbo View Post
    What do you mean by 'marked on'?
    Sounds like the program has a bug and you just 'got lucky' on ubuntu.
    I would imagine that he means that he will submit the source code (or possibly the executable) to his instructor who then compile/execute the program on a kubuntu machine.

    His segfault issue could be something simple like having a larger user stack size on his ubuntu machine. At this point it is all guesswork though; until the OP posts some code, it is hard to help.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Segmentation faults when initializing large arrays
    By MathFan in forum C++ Programming
    Replies: 5
    Last Post: 07-14-2008, 05:24 AM
  2. Trouble with DMA Segmentation Faults
    By firestorm717 in forum C Programming
    Replies: 2
    Last Post: 05-07-2006, 09:20 PM
  3. Segmentation faults on Linked Lists. (Please help!!)
    By summerrainx in forum C++ Programming
    Replies: 3
    Last Post: 03-19-2005, 07:23 AM
  4. segmentation faults pervade
    By ezwise in forum C Programming
    Replies: 8
    Last Post: 02-28-2005, 03:17 PM
  5. Locating A Segmentation Fault
    By Stack Overflow in forum C Programming
    Replies: 12
    Last Post: 12-14-2004, 01:33 PM