- Почему в ядре линукс отсутствует config.h?
- config.h no such file or directory #422
- Comments
- Yoshimiga commented Feb 11, 2018
- pboettch commented Feb 11, 2018
- Yoshimiga commented Feb 12, 2018
- pboettch commented Feb 12, 2018
- Yoshimiga commented Feb 13, 2018
- stephane commented Jun 5, 2018
- Config.h — No such file or directory
- 2 Answers 2
- Not the answer you’re looking for? Browse other questions tagged c or ask your own question.
- Linked
- Related
- Hot Network Questions
- Subscribe to RSS
- Missing include «bits/c++config.h» when cross compiling 64 bit program on 32 bit in Ubuntu
- 9 Answers 9
Почему в ядре линукс отсутствует config.h?
Тот config.h, которые кушает команда make вместе с Makefile
«Почему он должен быть?» — возможно, спросите вы. Отвечаю: так я пришел к выводу из диаграммы к этой статье: https://en.wikipedia.org/wiki/Configure_script
А еще мне кажется, что этот момент можно отнести не только к ядру линукс, но и к куче других программ — это, в прицнипе, не особо важный момент. Просто в нем я впервые заметил отсутствие config.h
Потому что не каждый обязан использовать упоротую автотулзятину.
Это специфично для autotools. В ядре по другому организовано. Ядро с autotools было бы ужасным.
Так собирается ядро ведь командой make . Я что-то не понимаю. это какой-то другой make?
Это тот же самый. Но до команды надо make-файлы как-то сгенерировать. И тут уже есть разные способы. Autotools со скриптом configure только один из способов, пока ещё наиболее распространённый.
Потому что не нужен?
Autotools со скриптом configure только один из способов, пока ещё наиболее распространённый
Некоторые дегенераты ещё придумали cmake.
Ясно, я думал что эти все команды являются чем-то вроде монолита и make «привязан» к Makefile и config.h, и без них не будет работать.
А каким способом генерируется Makefile для ядра линукс, например? Просто интересно что ещё есть.
Make с автотулзятиной никак не связан. Мэйкфайлы можно генерить другим софтом или писать самому. Или make не использовать тоже, есть другие системы сборки.
Оу, круто. Это просто, когда знаешь где искать, а я даже не подозревал о существоании такой документации)
Там своя утилита kbuild есть, из конфига читает опции и формирует Makefile.
Хорошо, спасибо большое.
а я даже не подозревал о существоании такой документации
Ты ещё больше удивишься, узнав, что документация идёт в комплекте с исходным кодом?
Ты так говоришь, как будто я дурачок какой-то — не смотрел исходники. Хотя в гентушных я не увидел такой документации.
Ну а по теме: да я удивлен, и не очень понимаю зачем документацию пихать в исходники, мне это кажется нелогичным, архаичным.
Можно нубский вопрос?
Правильно я понимаю, что при сборке ядра буковка «M» рядом с некоторыми опциями говорит о том, что этот модуль будет собран; но в то же время, если я уберу эту буковку, я также могу в любой момент отдельно скомпилировать и подключить этот модуль? Просто я думаю, может эта возможность не просто так дана, и если я отключу её, то не смогу потом подключить отдельно собранный модуль.
Хотя в гентушных я не увидел такой документации.
Эту документацию не затрагивает даже USE=»-doc» и FEATURE=»nodoc» , так что ты или не смотрел, или что-то скрываешь.
Ну а по теме: да я удивлен, и не очень понимаю зачем документацию пихать в исходники, мне это кажется нелогичным, архаичным.
Это для того, чтобы держать документацию и код up-to-date. Плюс, данная документация удобна для всех, в том числе для пользователей.
Правильно я понимаю, что при сборке ядра буковка «M» рядом с некоторыми опциями говорит о том, что этот модуль будет собран; но в то же время, если я уберу эту буковку, я также могу в любой момент отдельно скомпилировать и подключить этот модуль? Просто я думаю, может эта возможность не просто так дана, и если я отключу её, то не смогу потом подключить отдельно собранный модуль.
От многого зависит. Видишь ли, опции в конфиге ядра зачастую включают не только саму возможность, но и возможности, от которой оно зависит (dependency graph). Потому скорее да, некоторые модули ты не сможешь подключить отдельно. Но в то же время, не вкомпиленный в блоб модуль ты сможешь выгрузить и загрузить на его место новый, если он совместим с текущим ядром.
make ничего не кушает, кроме Makefile, который ему подсунули
Это частный случай, когда при сборке используется config.h
Более того, в случае autotools config.h тоже необязательно применять
Источник
config.h no such file or directory #422
Comments
Yoshimiga commented Feb 11, 2018
I am trying to compile the source code but i keep getting this error
master@Master-Virtual:
/Downloads/libmodbus-master/src$ gcc *.c
modbus.c:21:20: fatal error: config.h: No such file or directory
compilation terminated.
modbus-data.c:24:20: fatal error: config.h: No such file or directory
compilation terminated.
In file included from modbus-rtu.c:17:0:
modbus-private.h:19:20: fatal error: config.h: No such file or directory
compilation terminated.
modbus-tcp.c:25:37: fatal error: config.h: No such file or directory
compilation terminated.
I checked to make sure every source file had #include file i tried moving config.h into the src directory but i still get this error. I know that i must somehow manually set a path for the header file in order for the compiler to know where to look for it while compiling but i have no idea how to do that. I have tried numerous attempts yet the gcc is not finding the header file. I have successfully compiled the contents in the «tests» folder without any issues and were able to run the executables. I have read the README file over 100 times and followed its instructions, however its not clear when it comes to the issue that i am experiencing. Would anyone please help, and thank you.
The text was updated successfully, but these errors were encountered:
pboettch commented Feb 11, 2018
Please read the installation section of the README-file:
Yoshimiga commented Feb 12, 2018
@pboettch i have read it many times. as i mentioned in my initial post.
pboettch commented Feb 12, 2018
Then what makes you try to compile it using gcc *.c ?
If you want to use this library from source, you’ll need to build it (with configure and make ), then install it.
After installation you can build and link your application with it.
Yoshimiga commented Feb 13, 2018
@pboettch Mr. Patrick i initially ran the autogen.sh file to generate the configure script. Then ran the ./configure, and got a confirmation that everything was installed. I used sudo make install to install the build, everything installed. (Libraries have been installed in:
/usr/local/lib) I also ran the config.status and made sure everything was up to date. Next i ran sudo ldconfig for linkage. I used an example from tests directory README file gcc random-test-server.c -o random-test-server pkg-config —libs —cflags libmodbus and it compiled. In the «tests» directory folder everything got compiled and i got executables from all the .c source codes inside the tests directory. I was able to run them without any issues.
Similarly i tried using the same gcc modbus.c -o modbus pkg-config —libs —cflags libmodbus in the src directory, but what ever i try to compile in it just leaves me with the error that in modbus.c:21:20: fatal error: config.h: No such file or directory compilation terminated.
So at this point im not sure why the compiler is not picking up the config.h file if it is included inside the source code #include I manually tried placing the config.h header file into the src directory but got the same error.
From my own research i saw that i must specify path directory to the config.h file in order for the gcc compiler to pick it up, because as of now it seems it is not locating this config.h file even though it is in the proper directory. Im not sure how to set this path. Am i right about this issue? Did other users of this library came up with a similar issue? I have checked the google discussion thread about stephane libmodbus library and also read all the issues on github and have not found anyone experiencing similar issue? Must i try to compile .c source codes in any given order if i want to run a tcp based communication? (I know i must swap ip addresses of two different machines inside source code for Client and Server to communicate. I have studied Modbus protocol carefully and have a good idea how socket programming works.)
Would you please point me in the right direction because i have been stuck on this issue for a while now and i want set up communication between Client and the Server so i can continue with my project. Any help would be greatly appreciated. Sorry for the long read but i wanted to include all details. Thank you for responding and thank you for you time.
stephane commented Jun 5, 2018
Please use the libmodbus mailing list for help.
Источник
Config.h — No such file or directory
The file ‘safe-read.c’ include the lib ‘config.h’, where is placed this file?
I’ve found many files with this name in the libs, but I don’t know what the right one.
I’ve my file with:
in the file safe-read.c there’s this include block
When I compile my file I’ve the following error:
file: X/Y/gnulib/lib/safe-read.c line: 19 message: fatal error: config.h: No such file or directory
2 Answers 2
config.h is normally generated by the ./configure script to reflect the target system’s characteristics. In your case, it’s tied into the whole gnulib «let’s replace all the system’s library functions with out own hacks» mess, so a lot of what’s in a gnulib project config.h is stuff that gnulib’s portion of configure generated.
You’re probably missing the libconfig-dev package from your system. Simply run the following command and it’ll fix it:
sudo apt-get install libconfig-dev
Not the answer you’re looking for? Browse other questions tagged c or ask your own question.
Linked
Related
Hot Network Questions
Subscribe to RSS
To subscribe to this RSS feed, copy and paste this URL into your RSS reader.
site design / logo © 2021 Stack Exchange Inc; user contributions licensed under cc by-sa. rev 2021.10.8.40416
By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.
Источник
Missing include «bits/c++config.h» when cross compiling 64 bit program on 32 bit in Ubuntu
I am running the 32bit version of Ubuntu 10.10 and trying to cross compile to a 64 bit target. Based on my research, I have installed the g++-multilib package.
The program is a very simple hello world:
I have found a c++config.h file but they reside under the i486-linux-gnu and i686-linux-gnu directories in /usr/include/c++/4.4/ There is not c++config.h in /usr/include/c++/bits .
Any ideas on what I am missing? Compiling without the -m64 flag works fine (a.out is created and runs correctly).
Edit Thanks to the hint from @nightcracker, I did a little more investigation into the include structure on the 32 and 64 bit systems. I have added an answer below that «fixes» the problem temporarily but I think it will break on the next update. Basically, I am missing a directory called /usr/include/c++/4.4/i686-linux-gnu/64 that should contain a subdirectory called bits that has the missing include file. Any idea what package should be taking care of this?
9 Answers 9
Adding this answer partially because it fixed my problem of the same issue and so I can bookmark this question myself.
I was able to fix it by doing the following:
If you’ve installed a version of gcc / g++ that doesn’t ship by default (such as g++-4.8 on lucid) you’ll want to match the version as well:
Did you try adding -I/usr/include/c++/4.4/i486-linux-gnu or -I/usr/include/c++/4.4/i686-linux-gnu ?
While compiling in RHEL 6.2 (x86_64), I installed both 32bit and 64bit libstdc++-dev packages, but I had the «c++config.h no such file or directory» problem.
The directory /usr/include/c++/4.4.6/x86_64-redhat-linux was missing.
I did the following:
I’m now able to compile 32bit binaries on a 64bit OS.
Seems to be a typo error in that package of gcc. The solution:
On my 64 bit system I noticed that the following directory existed:
It would then make sense that on my 32 bit system that had been setup for 64bit cross compiling there should be a corresponding directory like:
I double checked and this directory did not exist. Running g++ with the verbose parameter showed that the compiler was actually looking for something in this location:
The error regarding the ignoring nonexistent directory was the clue. Unfortunately, I still don’t know what package I need to install to have this directory show up so I just copied the /usr/include/c++/4.4/x86_64-linux-gnu/bits directory from my 64 bit machine to /usr/include/c++/4.4/i686-linux-gnu/64/bits on my 32 machine.
Now compiling with just the -m64 works correctly. The major drawback is that this is still not the correct way to do things and I am guessing the next time Update Manager installs and update to g++ things may break.
This bug is fixed in «gcc-4.6».
Basically It is used in HeapOverflows or other reversing type Problems i.e. If you want to change a 64 bit ELF to 32 bit ELF and it is showing error while converting.
You can simply run the commands
which will update your libraries Packages upgraded:
The following additional packages will be installed: g++-8-multilib gcc-8-multilib lib32asan5 lib32atomic1 lib32gcc-8-dev lib32gomp1 lib32itm1 lib32mpx2 lib32quadmath0 lib32stdc++-8-dev lib32ubsan1 libc-dev-bin libc6 libc6-dbg libc6-dev libc6-dev-i386 libc6-dev-x32 libc6-i386 libc6-x32 libx32asan5 libx32atomic1 libx32gcc-8-dev libx32gcc1 libx32gomp1 libx32itm1 libx32quadmath0 libx32stdc++-8-dev libx32stdc++6 libx32ubsan1 Suggested packages: lib32stdc++6-8-dbg libx32stdc++6-8-dbg glibc-doc The following NEW packages will be installed: g++-8-multilib g++-multilib gcc-8-multilib gcc-multilib lib32asan5 lib32atomic1 lib32gcc-8-dev lib32gomp1 lib32itm1 lib32mpx2 lib32quadmath0 lib32stdc++-8-dev lib32ubsan1 libc6-dev-i386 libc6-dev-x32 libc6-x32 libx32asan5 libx32atomic1 libx32gcc-8-dev libx32gcc1 libx32gomp1 libx32itm1 libx32quadmath0 libx32stdc++-8-dev libx32stdc++6 libx32ubsan1
similar to this will be shown to your terminal
Источник