Hi list and Waldemar,
Yes, I am trying to cross-compile on Mac OS X for Linux embedded (mipselsf) devices, within the Entware-ng environment.
I did search for “BR2_ENABLE_LOCALE”, “BR2_USE_WCHAR”, “BR2_TOOLCHAIN_BUILDROOT_LOCALE”, “BR2_TOOLCHAIN_BUILDROOT_WCHAR”, “BR2_ENABLE_LOCALE" in the Entware-ng folder (like $ grep -lr "BR2_ENABLE_LOCALE” *) without any results.
How can I disable LOCALE support?
But the locale support in uClibc-ng is really crappy and it assumes a Linux host for some tools running on the host.
I do still think that the issue here are that the headers (langinfo.h) can’t be found.
Is that more an issue of “toolchain” or of “uClibc-ng"?
-- Best regards, Ceriel
Op 21 nov. 2016, om 10:56 heeft Waldemar Brodkorb wbx@uclibc-ng.org het volgende geschreven:
Hi Ceriel, C. Jacobs wrote,
Hi Waldemar,
First question: Can I sent this message directly, or better via list devel@uclibc-ng.org?
Better via list, so the answers are in the archive. And maybe someone else can help, too.
Preface: I am trying to build a new package within the Entware-ng environment and have little ‘C’ knowledge.
I am stuck at Entware-ng its make process. That stops at uClibc-1.0.16 gen_locale:
error: use of undeclared identifier ‘ERA_YEAR’
I do think that the issue is that: ./build_dir/toolchain-mipsel_mips32r2_gcc-5.3.0_uClibc-1.0.16/uClibc-ng-1.0.16/extra/locale/gen_locale.c can’t find ./build_dir/toolchain-mipsel_mips32r2_gcc-5.3.0_uClibc-1.0.16/uClibc-ng-1.0.16/include/langinfo.h
How to best fix this situation?
Disable LOCALE support. I think you are cross-compiling from MacOS X. That's normally not a problem, I use Mac OS X every dy to cross-compile my Linux embedded system stuff. But the locale support in uClibc-ng is really crappy and it assumes a Linux host for some tools running on the host.
best regards Waldemar
Hi Ceriel, C. Jacobs wrote,
Hi list and Waldemar,
Yes, I am trying to cross-compile on Mac OS X for Linux embedded (mipselsf) devices, within the Entware-ng environment.
I did search for “BR2_ENABLE_LOCALE”, “BR2_USE_WCHAR”, “BR2_TOOLCHAIN_BUILDROOT_LOCALE”, “BR2_TOOLCHAIN_BUILDROOT_WCHAR”, “BR2_ENABLE_LOCALE" in the Entware-ng folder (like $ grep -lr "BR2_ENABLE_LOCALE” *) without any results.
How can I disable LOCALE support?
But the locale support in uClibc-ng is really crappy and it assumes a Linux host for some tools running on the host.
I do still think that the issue here are that the headers (langinfo.h) can’t be found.
Is that more an issue of “toolchain” or of “uClibc-ng"?
A combination of your host toolchain and uClibc-ng. The code in gen_locale.c is using headers which are not provided by your host toolchain. They might be non-posix, I don't know. I seldom use locale support in uClibc-ng, but if you want to work on better cross-compilation in this area, I would accept patches.
Where does someone could download the entware-ng you are using, I could take a look. Check the provided uClibc config, it might enable LOCALE, without a switch in the Buildroot-Clone.
best regards Waldemar
Hi Waldemar,
Except from meeting all dependencies (especially overwriting OS X tools with GNU versions) I did use these steps to setup my Entware-ng environment:
1. A case-sensitive filesystem is required for OpenWrt so I guess Entware-ng will need one too. Create the image in 2 steps to prevent EFI partition creation (for volumes over 2g). $ hdiutil create -size 512m -type SPARSEBUNDLE -fs "Case-sensitive HFS+" -volname Case-sensitive ~/src/Case-sensitive && hdiutil resize -size 38g ~/src/Case-sensitive.sparsebundle
2. Mount the image and hide it from Finder and Desktop $ hdiutil attach ~/src/Case-sensitive.sparseimage -nobrowse
3. Go to the case sensitive location $ cd /Volumes/Case-sensitive
4. Download Entware-ng sources $ git clone https://github.com/Entware-ng/Entware-ng.git
5. Go to the root folder $ cd Entware-ng
6. Pick up the configuration for the mipselsf (mips, little endian, soft floating point) platform $ cp configs/mipselsf.config .config
6. Prepared the necessary fixes. $ make
For now I think the issue is after:
make[3]: Entering directory `/Volumes/Case-sensitive/Entware-ng/toolchain/uClibc/headers'
in this incomplete Make call:
make -C build_dir/toolchain-mipsel_mips32r2_gcc-5.3.0_uClibc-1.0.16/uClibc-ng-1.0.16 ... -I../..//extra/locale
A result the incorrect (FreeBSD) version of ‘langinfo.h’ at /usr/include/langinfo.h is used. $ gcc -M build_dir/toolchain-mipsel_mips32r2_gcc-5.3.0_uClibc-1.0.16/uClibc-ng-1.0.16/extra/locale/gen_locale.c | grep langinfo /usr/include/locale.h /usr/include/_locale.h /usr/include/langinfo.h \
To let the compiler find the correct ‘langinfo.h’ something/somewhere needs f.e. an addition like:
-I../../include
Note: This is my guess without any knowledge of how the compiler handles preferences of include locations
-- Best regards, Ceriel
Op 21 nov. 2016, om 13:53 heeft Waldemar Brodkorb wbx@uclibc-ng.org het volgende geschreven:
Hi Ceriel, C. Jacobs wrote,
Hi list and Waldemar,
Yes, I am trying to cross-compile on Mac OS X for Linux embedded (mipselsf) devices, within the Entware-ng environment.
I did search for “BR2_ENABLE_LOCALE”, “BR2_USE_WCHAR”, “BR2_TOOLCHAIN_BUILDROOT_LOCALE”, “BR2_TOOLCHAIN_BUILDROOT_WCHAR”, “BR2_ENABLE_LOCALE" in the Entware-ng folder (like $ grep -lr "BR2_ENABLE_LOCALE” *) without any results.
How can I disable LOCALE support?
But the locale support in uClibc-ng is really crappy and it assumes a Linux host for some tools running on the host.
I do still think that the issue here are that the headers (langinfo.h) can’t be found.
Is that more an issue of “toolchain” or of “uClibc-ng"?
A combination of your host toolchain and uClibc-ng. The code in gen_locale.c is using headers which are not provided by your host toolchain. They might be non-posix, I don't know. I seldom use locale support in uClibc-ng, but if you want to work on better cross-compilation in this area, I would accept patches.
Where does someone could download the entware-ng you are using, I could take a look. Check the provided uClibc config, it might enable LOCALE, without a switch in the Buildroot-Clone.
best regards Waldemar
Hi, C. Jacobs wrote,
Hi Waldemar,
Except from meeting all dependencies (especially overwriting OS X tools with GNU versions) I did use these steps to setup my Entware-ng environment:
- A case-sensitive filesystem is required for OpenWrt so I guess Entware-ng will need one too. Create the image in 2 steps to prevent EFI partition creation (for volumes over 2g).
$ hdiutil create -size 512m -type SPARSEBUNDLE -fs "Case-sensitive HFS+" -volname Case-sensitive ~/src/Case-sensitive && hdiutil resize -size 38g ~/src/Case-sensitive.sparsebundle
- Mount the image and hide it from Finder and Desktop
$ hdiutil attach ~/src/Case-sensitive.sparseimage -nobrowse
- Go to the case sensitive location
$ cd /Volumes/Case-sensitive
- Download Entware-ng sources
$ git clone https://github.com/Entware-ng/Entware-ng.git
- Go to the root folder
$ cd Entware-ng
- Pick up the configuration for the mipselsf (mips, little endian, soft floating point) platform
$ cp configs/mipselsf.config .config
- Prepared the necessary fixes.
$ make
Okay, I see. It is an modified OpenWrt. Disable CONFIG_BUILD_NLS in your .config.
best regards Waldemar
Hi,
Thank you for CONFIG_BUILD_NLS in .config.
Entware-ng make (on OS X) now bumps over the toolchain/uClibc/headers (which in fact is uClibc-ng-1.0.16) section: ... make[3] -C toolchain/kernel-headers install make[3] -C toolchain/uClibc/headers prepare make[3] -C toolchain/uClibc/headers compile make[3] -C toolchain/uClibc/headers install make[3] -C toolchain/gcc/initial prepare ...
I still would like to learn.
Where is the hook (read: correct location) to insert an additional include (-I../../include) property for the "toolchain/uClibc/headers install” phase?
And/or where does the for
make -C extra/locale locale_headers gcc ../../extra/locale/gen_locale.c -o ../..//extra/locale/gen_locale
added
-I../..//extra/locale
derives from?
-- kind regards, ~Ceriel
Op 21 nov. 2016, om 14:43 heeft Waldemar Brodkorb wbx@uclibc-ng.org het volgende geschreven:
Okay, I see. It is an modified OpenWrt. Disable CONFIG_BUILD_NLS in your .config.
best regards Waldemar
Hi Ceriel, C. Jacobs wrote,
Hi,
Thank you for CONFIG_BUILD_NLS in .config.
Entware-ng make (on OS X) now bumps over the toolchain/uClibc/headers (which in fact is uClibc-ng-1.0.16) section: ... make[3] -C toolchain/kernel-headers install make[3] -C toolchain/uClibc/headers prepare make[3] -C toolchain/uClibc/headers compile make[3] -C toolchain/uClibc/headers install make[3] -C toolchain/gcc/initial prepare ...
I still would like to learn.
Where is the hook (read: correct location) to insert an additional include (-I../../include) property for the "toolchain/uClibc/headers install” phase?
Good question. Normally UCLIBC_EXTRA_CFLAGS can be used. In this case I would add this to toolchain/uClibc/headers/Makefile .
And/or where does the for
make -C extra/locale locale_headers gcc ../../extra/locale/gen_locale.c -o ../..//extra/locale/gen_locale
added
-I../..//extra/locale
derives from?
For the host tools you need to extend BUILD_CFLAGS.
As mentioned earlier, it is a problem compiling a host tool in uClibc-ng required to generate some metadata. And I am not entirely sure this can be compiled _and_ used on a MacOS X host, without modifications of the code.
best regards Waldemar
Hi Waldemar,
After editing toolchain/uClibc/headers/Makefile:
$ cat toolchain/uClibc/headers/Makefile | grep UCLIBC_EXTRA_CFLAGS -a9
define Host/Install PATH='$(TARGET_PATH)' $(MAKE) -C $(HOST_BUILD_DIR) \ PREFIX="$(BUILD_DIR_TOOLCHAIN)/$(LIBC)-dev/" \ DEVEL_PREFIX=/ \ RUNTIME_PREFIX="$(BUILD_DIR_TOOLCHAIN)/$(LIBC)-dev/" \ HOSTCC="$(HOSTCC)" \ CC="$(TARGET_CC)" \ CPU_CFLAGS="$(TARGET_CFLAGS)" \ UCLIBC_EXTRA_CFLAGS=" -I../../include" \ ARCH="$(CONFIG_ARCH)" \ pregen \ install_headers endef
$(eval $(call HostBuild))
issuing “$ make clean", and run “$ make" again, I see the flag, but the “make” output is still stopping with the error:
make -C /Volumes/Case-sensitive/Entware-ng/build_dir/toolchain-mipsel_mips32r2_gcc-5.3.0_uClibc-1.0.16/uClibc-ng-1.0.16 PREFIX="/Volumes/Case-sensitive/Entware-ng/build_dir/toolchain-mipsel_mips32r2_gcc-5.3.0_uClibc-1.0.16/uClibc-dev/" DEVEL_PREFIX=/ RUNTIME_PREFIX="/Volumes/Case-sensitive/Entware-ng/build_dir/toolchain-mipsel_mips32r2_gcc-5.3.0_uClibc-1.0.16/uClibc-dev/" HOSTCC="gcc" CC="mipsel-openwrt-linux-uclibc-gcc" CPU_CFLAGS="-O2 -pipe -mno-branch-likely -mips32r2 -mtune=mips32r2 -fno-caller-saves -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float" UCLIBC_EXTRA_CFLAGS=" -I../../include" ARCH=""mipsel"" pregen install_headers
However the Makefile result at /Volumes/Case-sensitive/Entware-ng/build_dir/toolchain-mipsel_mips32r2_gcc-5.3.0_uClibc-1.0.16/uClibc-ng-1.0.16/extra/locale, is missing this -I../../include flag:
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C extra/locale locale_headers gcc ../../extra/locale/gen_locale.c -o ../..//extra/locale/gen_locale -Os -D_GNU_SOURCE -I../..//extra/locale
Possibly I haven’t yet understood how to insert extra CFLAGS for uClibc headers, or the UCLIBC_EXTRA_CFLAGS flag doesn’t flow down into the toolchain as it should.
-- Best regards, ~Ceriel
Op 22 nov. 2016, om 13:23 heeft Waldemar Brodkorb wbx@uclibc-ng.org het volgende geschreven:
Hi Ceriel, C. Jacobs wrote,
Hi,
Thank you for CONFIG_BUILD_NLS in .config.
Entware-ng make (on OS X) now bumps over the toolchain/uClibc/headers (which in fact is uClibc-ng-1.0.16) section: ... make[3] -C toolchain/kernel-headers install make[3] -C toolchain/uClibc/headers prepare make[3] -C toolchain/uClibc/headers compile make[3] -C toolchain/uClibc/headers install make[3] -C toolchain/gcc/initial prepare ...
I still would like to learn.
Where is the hook (read: correct location) to insert an additional include (-I../../include) property for the "toolchain/uClibc/headers install” phase?
Good question. Normally UCLIBC_EXTRA_CFLAGS can be used. In this case I would add this to toolchain/uClibc/headers/Makefile .
Hi Ceriel, C. Jacobs wrote,
Hi Waldemar,
After editing toolchain/uClibc/headers/Makefile:
$ cat toolchain/uClibc/headers/Makefile | grep UCLIBC_EXTRA_CFLAGS -a9
define Host/Install PATH='$(TARGET_PATH)' $(MAKE) -C $(HOST_BUILD_DIR) \ PREFIX="$(BUILD_DIR_TOOLCHAIN)/$(LIBC)-dev/" \ DEVEL_PREFIX=/ \ RUNTIME_PREFIX="$(BUILD_DIR_TOOLCHAIN)/$(LIBC)-dev/" \ HOSTCC="$(HOSTCC)" \ CC="$(TARGET_CC)" \ CPU_CFLAGS="$(TARGET_CFLAGS)" \ UCLIBC_EXTRA_CFLAGS=" -I../../include" \ ARCH="$(CONFIG_ARCH)" \ pregen \ install_headers endef
$(eval $(call HostBuild))
issuing “$ make clean", and run “$ make" again, I see the flag, but the “make” output is still stopping with the error:
However the Makefile result at /Volumes/Case-sensitive/Entware-ng/build_dir/toolchain-mipsel_mips32r2_gcc-5.3.0_uClibc-1.0.16/uClibc-ng-1.0.16/extra/locale, is missing this -I../../include flag:
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C extra/locale locale_headers gcc ../../extra/locale/gen_locale.c -o ../..//extra/locale/gen_locale -Os -D_GNU_SOURCE -I../..//extra/locale
Possibly I haven’t yet understood how to insert extra CFLAGS for uClibc headers, or the UCLIBC_EXTRA_CFLAGS flag doesn’t flow down into the toolchain as it should.
As mentioned earlier, UCLIBC_EXTRA_CFLAGS is only for target code. Your problem is natively compiling gen_locale.c on your host.
best regards Waldemar