Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 882581

Summary: app-emulation/nemu-3.1.0 fails to compile (CLANG-STRICTER-SYSTEM): nm_network.c:142:24: error: use of undeclared identifier IFF_UP
Product: Gentoo Linux Reporter: Agostino Sarubbo <ago>
Component: Current packagesAssignee: Pavel Balaev <mail>
Status: CONFIRMED ---    
Severity: normal CC: mail, proxy-maint
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 870412    
Attachments: build.log

Description Agostino Sarubbo gentoo-dev 2022-11-23 07:49:54 UTC
https://blogs.gentoo.org/ago/2020/07/04/gentoo-tinderbox/

Issue: app-emulation/nemu-3.1.0 fails to compile (CLANG-STRICTER-SYSTEM).
Discovered on: amd64 (internal ref: clang-stricter_tinderbox)

NOTE:
(CLANG-STRICTER-SYSTEM) in the summary means that the bug was found on a machine that runs clang with stricter mode

This machine uses clang with CFLAGS/CXXFLAGS=-Werror=implicit-function-declaration -Werror=implicit-int -Werror=incompatible-function-pointer-types

See also:
https://archives.gentoo.org/gentoo-dev/message/dd9f2d3082b8b6f8dfbccb0639e6e240
https://wiki.gentoo.org/wiki/Modern_C_porting
Comment 1 Agostino Sarubbo gentoo-dev 2022-11-23 07:49:56 UTC
Created attachment 836003 [details]
build.log

build log and emerge --info
Comment 2 Agostino Sarubbo gentoo-dev 2022-11-23 07:49:57 UTC
Error(s) that match a know pattern in addition to what has been reported in the summary:


FAILED: CMakeFiles/nemu.dir/src/nm_network.c.o 
/var/tmp/portage/app-emulation/nemu-3.1.0/work/nemu-3.1.0/src/nm_network.c:142:24: error: use of undeclared identifier 'IFF_UP'
Comment 3 Pavel Balaev 2022-12-11 21:04:40 UTC
nEMu uses this in cmake:

try_compile(
    NET_IF
    "${CMAKE_CURRENT_BINARY_DIR}/CMake_Tests"
    "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Tests/net_if.c"
    COMPILE_DEFINITIONS "-Wall -Wextra -pedantic -Werror")

  if(NOT NET_IF)
    add_definitions(-DNM_NET_IF_FIX)
  endif()

This is done to bypass problem:

#ifdef NM_NET_IF_FIX                                                            
/* Temporary work-around for broken glibc vs. linux kernel header definitions   
 * This is already fixed upstream, remove this when distributions have updated. 
 * net/if.h this should be removed someday in future, when kernels <= 4.2     
 * will not be supported                                                        
 * https://github.com/systemd/systemd/commit/ \                                 
 *   08ce521fb2546921f2642bef067d2cc02158b121                                   
 * https://github.com/systemd/systemd/commit/ \                                 
 *   6f270e6bd8b78aedf9f77534d6d11141ea0bf8ca                                   
 */                                                                             
#define _NET_IF_H 1                                                             
#include <net/if.h>                                                             
#ifndef IFNAMSIZ                                                                
#define IFNAMSIZ 16                                                             
extern unsigned int if_nametoindex(const char *__ifname) __THROW;               
#endif                                                                          
#include <linux/if.h>                                                           
#else                                                                           
#include <net/if.h>                                                             
#include <linux/if.h>                                                           
#endif 

I'll check is this not actual now. And create the patch if so.
Comment 4 Pavel Balaev 2022-12-11 21:06:54 UTC
It seems to me that the problem described above somehow affects the problem in this bug.