Skip to contentSkip to conversation

Patch for toolchainfile.cmake absolut path references

Buildroot Uwe Strempel 2 participants 3 messages Feb 1, 2014 – Feb 2, 2014

lore
Share & tools
lore
#0 lore raw

Hi,
I've build a patch for BUG #6818

On build process of buildroot the toolchainfile.cmake is created, but with wrong absolut path.
When shareing the toolchain or move the folder you get problems this path settings.

A workarround for cmake files is
- get the path of the toolchainfile.cmake and set the the variables.

Regards
Uwe
-------------- next part --------------

package/Makefile.in +5 -0
index 2e433fd..aa86fca 100644
@@ -140,8 +140,10 @@ endif
 
 ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y)
 TARGET_CROSS=$(HOST_DIR)/usr/bin/$(GNU_TARGET_NAME)-
+TARGET_CROSS_WITHOUT_HOST_DIR=/usr/bin/$(GNU_TARGET_NAME)-
 else
 TARGET_CROSS=$(HOST_DIR)/usr/bin/$(call qstrip,$(BR2_TOOLCHAIN_EXTERNAL_PREFIX))-
+TARGET_CROSS_WITHOUT_HOST_DIR=/usr/bin/$(call qstrip,$(BR2_TOOLCHAIN_EXTERNAL_PREFIX))-
 endif
 
 # Quotes are needed for spaces et al in path components.
@@ -164,6 +166,9 @@ TARGET_OBJDUMP  = $(TARGET_CROSS)objdump
 TARGET_CC_NOCCACHE  := $(TARGET_CC)
 TARGET_CXX_NOCCACHE := $(TARGET_CXX)
 
+TARGET_CC_NOCCACHE_WITHOUT_HOST_DIR  := $(TARGET_CROSS_WITHOUT_HOST_DIR)gcc
+TARGET_CXX_NOCCACHE_WITHOUT_HOST_DIR :=  $(TARGET_CROSS_WITHOUT_HOST_DIR)g++
+
 ifeq ($(BR2_CCACHE),y)
 TARGET_CC  := $(CCACHE) $(TARGET_CC)
 TARGET_CXX := $(CCACHE) $(TARGET_CXX)
package/pkg-cmake.mk +6 -5
index 13be557..d30991c 100644
@@ -160,16 +160,17 @@ host-cmake-package = $(call inner-cmake-package,host-$(call pkgname),$(call UPPE
 $(HOST_DIR)/usr/share/buildroot/toolchainfile.cmake:
 	@mkdir -p $(@D)
 	@echo -en "\
+	get_filename_component(CMAKE_TOOLCHAIN_PATH ${CMAKE_CURRENT_LIST_FILE} PATH)\n\
 	set(CMAKE_SYSTEM_NAME Linux)\n\
-	set(CMAKE_C_COMPILER $(TARGET_CC_NOCCACHE))\n\
-	set(CMAKE_CXX_COMPILER $(TARGET_CXX_NOCCACHE))\n\
+	set(CMAKE_C_COMPILER \"${CMAKE_TOOLCHAIN_PATH}/$(TARGET_CC_NOCCACHE_WITHOUT_HOST_DIR)\")\n\
+	set(CMAKE_CXX_COMPILER \"${CMAKE_TOOLCHAIN_PATH}/$(TARGET_CXX_NOCCACHE_WITHOUT_HOST_DIR)\")\n\
 	set(CMAKE_C_FLAGS \"\$${CMAKE_C_FLAGS} $(TARGET_CFLAGS)\" CACHE STRING \"Buildroot CFLAGS\" FORCE)\n\
 	set(CMAKE_CXX_FLAGS \"\$${CMAKE_CXX_FLAGS} $(TARGET_CXXFLAGS)\" CACHE STRING \"Buildroot CXXFLAGS\" FORCE)\n\
 	set(CMAKE_INSTALL_SO_NO_EXE 0)\n\
-	set(CMAKE_PROGRAM_PATH \"$(HOST_DIR)/usr/bin\")\n\
-	set(CMAKE_FIND_ROOT_PATH \"$(STAGING_DIR)\")\n\
+	set(CMAKE_PROGRAM_PATH \"$(CMAKE_TOOLCHAIN_PATH)/usr/bin\")\n\
+	set(CMAKE_FIND_ROOT_PATH \"${CMAKE_TOOLCHAIN_PATH}/${STAGING_SUBDIR}\")\n\
 	set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)\n\
 	set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)\n\
 	set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)\n\
-	set(ENV{PKG_CONFIG_SYSROOT_DIR} \"$(STAGING_DIR)\")\n\
+	set(ENV{PKG_CONFIG_SYSROOT_DIR} \"${CMAKE_TOOLCHAIN_PATH}/${STAGING_SUBDIR}\")\n\
 	" > $@
#1 lore raw

Hi Uwe,

Quoted 4 lines · Uwe Strempel

Hi,
I've build a patch for BUG #6818

FIrst, thanks for your contribution, but please consider a patch using git,

and send it to the mailing list using 'git send-email' (see
http://www.buildroot.org/downloads/manual/manual.html#_contributing_to_buildroot
),
this is the way Buildroot community works.

Anyway, I looked at the patch.

Quoted 9 lines

On build process of buildroot the toolchainfile.cmake is created, but with wrong absolut path.
When shareing the toolchain or move the folder you get problems this path settings.

A workarround for cmake files is
- get the path of the toolchainfile.cmake and set the the variables.

I found the part touching the package/Makefile.in a bit confusing. The idea of what has to be done in the toolchainfile.cmake is good, though I think you miss some $-escaping...

Regards,

Signature · 4 lines
Samuel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20140202/dfb329ae/attachment.html>
#2 lore raw

Hi,

Quoted 1 line

The idea of what has to be done in the toolchainfile.cmake is good,

though I think you miss some $-escaping...
Ok I fix the patch :/.

Quoted 1 line

http://www.buildroot.org/downloads/manual/manual.html#_contributing_to_buildroot
),
I didn't know how to contribute the right the way. But for the next patches I will do it the right way.

Thanks!
Regards,
Uwe

2014-02-02 Samuel Martin <[email protected]>:

Quoted 32 lines

Hi Uwe,

Quoted 4 lines · Uwe Strempel

Hi,
I've build a patch for BUG #6818

FIrst, thanks for your contribution, but please consider a patch using

git,
and send it to the mailing list using 'git send-email' (see

http://www.buildroot.org/downloads/manual/manual.html#_contributing_to_buildroot
),
this is the way Buildroot community works.

Anyway, I looked at the patch.

Quoted 9 lines

On build process of buildroot the toolchainfile.cmake is created, but with wrong absolut path.
When shareing the toolchain or move the folder you get problems this path settings.

A workarround for cmake files is
- get the path of the toolchainfile.cmake and set the the variables.

I found the part touching the package/Makefile.in a bit confusing. The idea of what has to be done in the toolchainfile.cmake is good, though I think you miss some $-escaping...

Quoted 5 lines

Regards,

--
Samuel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20140202/5f89f533/attachment.html>