Message boards : Questions and problems : Can't compile boinc client on NetBSD
Message board moderation
Previous · 1 · 2
Author | Message |
---|---|
Send message Joined: 20 Nov 12 Posts: 801 ![]() |
It could be something like using uninitialised stack variable. Calling fprintf() then changes the stack in a way that the code is still using garbage but doesn't crash. Letting the compiler optimise code again changes things. According to the compiler output you posted earlier hw_addr is used uninitialised in get_mac_address(), maybe because of the problem with net/if_arp.h . I can't see how that would be a problem, it's just six bytes and you'll just get garbage MAC address but it shouldn't crash. You could add the fprintf() after functions calls, one at a time. |
![]() Send message Joined: 28 Sep 16 Posts: 16 ![]() |
Hi, funny you ask this... I continued to dig and I think I found it (in this exact function ).. In client/mac_address.cpp line 266 : fprintf(stderr, "I'm here before strcpy \n"); strcpy(address, ether_ntoa(hw_addr)); fprintf(stderr, "I'm here after strcpy \n"); Trace : sparc3# ./client/boinc 04-Oct-2016 16:50:23 [---] cc_config.xml not found - using defaults 04-Oct-2016 16:50:23 [---] Starting BOINC client version 7.7.0 for sparc64-unknown-netbsd 04-Oct-2016 16:50:23 [---] This a development version of BOINC and may not function properly 04-Oct-2016 16:50:23 [---] log flags: file_xfer, sched_ops, task 04-Oct-2016 16:50:23 [---] Libraries: libcurl/7.50.1 OpenSSL/1.0.1p zlib/1.2.3 libidn/1.30 04-Oct-2016 16:50:23 [---] Data directory: /root/boinc 04-Oct-2016 16:50:23 [---] No usable GPUs found 04-Oct-2016 16:50:23 [---] Creating new client state file I'm here at the beginning of generate_host_cpid I'm here 1 I'm here at the beginning of get_mac_address I'm here at the beginning of SIOCGIFCONF I'm here in ifedf else HAVE_STRUCT_LIFCONF 1 I'm here between 2 ifdef I'm here in ifedf else HAVE_STRUCT_LIFCONF 2 I'm here in ifedf else HAVE_STRUCT_LIFCONF 3 I'm here in ifedf else HAVE_STRUCT_LIFCONF 4 I'm here after ifedf else HAVE_STRUCT_LIFCONF 4 I'm here before struct ether_addr *hw_addr I'm here after struct ether_addr *hw_addr I'm here before strcpy SIGSEGV: segmentation violation |
![]() ![]() Send message Joined: 30 May 15 Posts: 265 ![]() |
Juha wrote: It could be something like using uninitialised stack variable. Calling fprintf() then changes the stack in a way that the code is still using garbage but doesn't crash. Letting the compiler optimise code again changes things. jusavard wrote:
My C is a little old now, just looking at the Free BSD man page for ether_ntoa seems that you can get a null If it is unable to convert the supplied ether_addr structure, it returns a NULL pointer. This seems different or not mentioned on the equivalent linux page. |
![]() Send message Joined: 28 Sep 16 Posts: 16 ![]() |
Not sure but I don't see anything like that in the NetBSD man : http://nixdoc.net/man-pages/NetBSD/man3/ether_ntoa.3.html The ether_ntoa() function converts this structure into an ASCII string of I must say that I just reach my "maximum level of incompetence". I'm mostly sysadmin not a developer. I did some java and php but C++ is out of my level of knowledge. I can build and test any suggestion and provide a "miraculous" working build in a tar format however I can't reproduce it. You can have it at this link : https://www.neiluj.ca/boinc-netbsd-working.tar.gz You will have to rebuild it for your architecture. This one has been compiled for sparc64. |
Send message Joined: 20 Nov 12 Posts: 801 ![]() |
I'm an idiot, or at least blind. In the strcpy() line hw_addr is uninitialised pointer. That's why it's crashing. You can comment out the line for now. I'll see if I can make a more permanent fix some day. I have an old laptop I was going to burn down with BOINC. I was going to install some Linux other than Debian like on it but I suppose I could try NetBSD first. |
![]() Send message Joined: 28 Sep 16 Posts: 16 ![]() |
IT'S WORKING !!! In client/mac_address.cpp : #elif defined(SIOCGIFARP) if(ioctl(sck, SIOCGIFARP, item) < 0) { perror("ioctl(SIOCGIFARP)"); close(sck); return -1; } hw_addr = (struct ether_addr *)&(item->lifr_lifru.lifru_enaddr); #endif //strcpy(address, ether_ntoa(hw_addr)); //Line up there commented by me #ifdef HAVE_STRUCT_LIFCONF if (strstr(item->lifr_name, "eth")) break; #else if (strstr(item->ifr_name, "eth")) break; #endif Stdout : sparc3# ./client/boinc 05-Oct-2016 16:20:32 [---] cc_config.xml not found - using defaults 05-Oct-2016 16:20:32 [---] Starting BOINC client version 7.7.0 for sparc64-unknown-netbsd 05-Oct-2016 16:20:32 [---] This a development version of BOINC and may not function properly 05-Oct-2016 16:20:32 [---] log flags: file_xfer, sched_ops, task 05-Oct-2016 16:20:32 [---] Libraries: libcurl/7.50.1 OpenSSL/1.0.1p zlib/1.2.3 libidn/1.30 05-Oct-2016 16:20:32 [---] Data directory: /root/boinc 05-Oct-2016 16:20:32 [---] No usable GPUs found 05-Oct-2016 16:20:32 [---] Creating new client state file I'm here at the beginning of generate_host_cpid I'm here 1 I'm here 2 I'm here in the if 05-Oct-2016 16:20:32 [---] Host name: sparc3.neiluj.intra 05-Oct-2016 16:20:32 [---] Processor: 1 sparc64 SUNW,UltraAX-i2 (SUNW,UltraSPARC-IIe @ 548 MHz) 05-Oct-2016 16:20:32 [---] Processor features: 05-Oct-2016 16:20:32 [---] OS: NetBSD: 7.0 05-Oct-2016 16:20:32 [---] Memory: 1.50 GB physical, 2.00 GB virtual 05-Oct-2016 16:20:32 [---] Disk: 34.19 GB total, 22.50 GB free 05-Oct-2016 16:20:32 [---] Local time is UTC -4 hours 05-Oct-2016 16:20:32 [---] No general preferences found - using defaults 05-Oct-2016 16:20:32 [---] Preferences: 05-Oct-2016 16:20:32 [---] max memory usage when active: 768.00MB 05-Oct-2016 16:20:32 [---] max memory usage when idle: 1382.40MB 05-Oct-2016 16:20:32 [---] max disk usage: 22.41GB 05-Oct-2016 16:20:32 [---] don't use GPU while active 05-Oct-2016 16:20:32 [---] suspend work if non-BOINC CPU load exceeds 25% 05-Oct-2016 16:20:32 [---] (to change preferences, visit a project web site or select Preferences in the Manager) 05-Oct-2016 16:20:32 [---] This computer is not attached to any projects 05-Oct-2016 16:20:32 [---] Visit http://boinc.berkeley.edu for instructions 05-Oct-2016 16:20:32 Initialization completed Thanks a lot ! I looking forward to see this in an official patch or update |
Copyright © 2025 University of California.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License,
Version 1.2 or any later version published by the Free Software Foundation.