DaemonForums  

Go Back   DaemonForums > OpenBSD > OpenBSD General

OpenBSD General Other questions regarding OpenBSD which do not fit in any of the categories below.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 4 Weeks Ago
puffymon puffymon is offline
Real Name: Leonid
Port Guard
 
Join Date: Apr 2017
Location: Earth
Posts: 29
Default Compiler doesn't see headers in /usr/local/include

Hi. If I'm trying to compile anything manually and program includes headers from /usr/local/include, compilers (clang and gcc) print that files are not found and I have to manually edit these programs and change #include <file.h> to #include "/full/path/to/file.h". That problem appeared when I made a fresh install of OpenBSD snapshot.
Example compilations:
Code:
$ gcc test.c             
test.c:1:19: error: check.h: No such file or directory
$ cat test.c             
#include <check.h>

int main()
{
        return 0;
}
$ ls /usr/local/include/check*                                                                                                                                                                                                 
/usr/local/include/check.h           /usr/local/include/check_stdint.h
$ cmake ..
-- The C compiler identification is Clang 4.0.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/uTox/build
$ make
Scanning dependencies of target utoxAV
[  1%] Building C object CMakeFiles/utoxAV.dir/src/av/utox_av.c.o
In file included from /tmp/uTox/src/av/utox_av.c:2:
/tmp/uTox/src/av/utox_av.h:5:10: fatal error: 'tox/toxav.h' file not found
#include <tox/toxav.h>
         ^~~~~~~~~~~~~
1 error generated.
*** Error 1 in . (CMakeFiles/utoxAV.dir/build.make:63 'CMakeFiles/utoxAV.dir/src/av/utox_av.c.o': /usr/bin/cc  -I/usr/include/freetype2  -Wa...)
*** Error 1 in . (CMakeFiles/Makefile2:68 'CMakeFiles/utoxAV.dir/all')
*** Error 1 in /tmp/uTox/build (Makefile:130 'all')
$ ls /usr/local/include/tox/
tox.h            toxav.h          toxdns.h         toxencryptsave.h
$ uname -a
OpenBSD puffy.pc 6.2 GENERIC.MP#98 amd64
$
Reply With Quote
  #2   (View Single Post)  
Old 4 Weeks Ago
TronDD TronDD is offline
Package Pilot
 
Join Date: Sep 2014
Posts: 149
Default

You need to add -I/usr/local/include to your build command.

Not sure why CMake isn't picking it up for uTox, though.
Reply With Quote
  #3   (View Single Post)  
Old 4 Weeks Ago
ibara's Avatar
ibara ibara is offline
vBSDcon 2017 troublemaker
 
Join Date: Jan 2014
Posts: 470
Default

That's not how the compiler works. It doesn't know about any include directories you don't explicitly tell it about (it is told about /usr/include you just don't see it).

This is important for keeping base and ports separate. Having -I/usr/local/include in base compiles could be catastrophic. Same for /usr/X11R6, which is also kept separate.

If you need to add -I/usr/local/include to a CMake compile, add:
Code:
include_directories(${OPENBSD_LOCALBASE}/include)
to the top CMakeLists.txt.
Reply With Quote
Reply

Tags
bug, clang, gcc, include

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
gcc-4.9.3p0 missing some headers? notooth OpenBSD Packages and Ports 4 21st November 2015 04:20 PM
Viewing manpages: Headers and footers get repeated. Carpetsmoker Solaris 3 21st February 2010 02:55 AM
log from rc.conf.local and rc.local sdesilet OpenBSD General 1 21st January 2010 02:37 AM
Is /usr/X11R6/include/ supposed to be in $CPATH kasse OpenBSD General 4 3rd December 2008 05:34 PM
What include and shared library directories are searched by gcc kasse FreeBSD General 3 16th July 2008 08:44 PM


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


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