Re: Compilation fails on OS-X
On 2019/2/14 12:45, Olivier Houchard wrote: > Hi Patrick, > > On Thu, Feb 14, 2019 at 09:12:18AM -0500, Patrick Hemmer wrote: >> >> On 2019/2/14 08:20, Frederic Lecaille wrote: >>> On 2/14/19 1:32 PM, Frederic Lecaille wrote: On 2/13/19 7:30 PM, Patrick Hemmer wrote: > > On 2019/2/13 10:29, Olivier Houchard wrote: >> Hi Patrick, >> >> On Wed, Feb 13, 2019 at 10:01:01AM -0500, Patrick Hemmer wrote: >>> On 2019/2/13 09:40, Aleksandar Lazic wrote: Am 13.02.2019 um 14:45 schrieb Patrick Hemmer: > Trying to compile haproxy on my local machine for testing > purposes and am > running into the following: Which compiler do you use? >>> # gcc -v >>> Configured with: >>> --prefix=/Applications/Xcode.app/Contents/Developer/usr >>> --with-gxx-include-dir=/usr/include/c++/4.2.1 >>> Apple LLVM version 9.0.0 (clang-900.0.39.2) >>> Target: x86_64-apple-darwin17.7.0 >>> Thread model: posix >>> InstalledDir: >>> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin >>> >>> > # make TARGET=osx > src/proto_http.c:293:1: error: argument to 'section' > attribute is not > valid for this target: mach-o section specifier requires a > segment and section > separated by a comma > DECLARE_POOL(pool_head_http_txn, "http_txn", > sizeof(struct http_txn)); > ^ > include/common/memory.h:128:2: note: expanded from > macro 'DECLARE_POOL' > REGISTER_POOL(, name, size) > ^ > include/common/memory.h:123:2: note: expanded from > macro 'REGISTER_POOL' > INITCALL3(STG_POOL, > create_pool_callback, (ptr), (name), > (size)) > ^ > include/common/initcall.h:102:2: note: expanded from > macro 'INITCALL3' > _DECLARE_INITCALL(stage, __LINE__, > function, arg1, arg2, > arg3) > ^ > include/common/initcall.h:78:2: note: expanded from macro > '_DECLARE_INITCALL' > __DECLARE_INITCALL(__VA_ARGS__) > ^ > include/common/initcall.h:65:42: note: expanded from macro > '__DECLARE_INITCALL' > __attribute__((__used__,__section__("init_"#stg))) = \ > > > > Issue occurs on master, and the 1.9 branch > > -Patrick >> Does the (totally untested, because I have no Mac to test) patch >> works for >> you ? > Unfortunately not. Just introduces a lot of new errors: > > > In file included from src/ev_poll.c:22: > In file included from include/common/hathreads.h:26: > include/common/initcall.h:134:22: error: expected ')' > DECLARE_INIT_SECTION(STG_PREPARE); > ^ > include/common/initcall.h:134:1: note: to match this '(' > DECLARE_INIT_SECTION(STG_PREPARE); > ^ > include/common/initcall.h:124:82: note: expanded from macro > 'DECLARE_INIT_SECTION' > extern __attribute__((__weak__)) const struct > initcall *__start_init_##stg __asm("section$start$__DATA$" stg); \ > ^ Try to use -E in place of -c option of your compiler to stop after having preprocessed the code. Then have a look to how the code of src/ev_poll.c was preprocessed. This should help. Fred. >>> As this sounds to be a preprocessing issue, and to have a look to how >>> the code is preprocessed for Apple we can invert the two #ifdef >>> __APPLE__ condition of Olivier's patch to use the same preprocessor >>> commands on a Linux system. >>> >>> >>> Here is the code after having preprocessed it: >>> >>> >>> # 134 "include/common/initcall.h" >>> extern __attribute__((__weak__)) const struct initcall >>> *__start_init_STG_PREPARE __asm("section$start$__DATA$" STG_PREPARE); >>> extern __attribute__((__weak__)) const struct initcall >>> *__stop_init_STG_PREPARE __asm("section$end$__DATA$" STG_PREPARE); >>> extern __attribute__((__weak__)) const struct initcall >>> *__start_init_STG_LOCK __asm("section$start$__DATA$" STG_LOCK); extern >>> __attribute__((__weak__)) const struct initcall *__stop_init_STG_LOCK >>> __asm("section$end$__DATA$" STG_LOCK); >>> extern __attribute__((__weak__)) const struct initcall >>> *__start_init_STG_ALLOC __asm("section$start$__DATA$" STG_ALLOC); >>> extern __attribute__((__weak__)) const struct initcall >>> *__stop_init_STG_ALLOC __asm("section$end$__DATA$" STG_ALLOC); >>> extern __attribute__((__weak__)) const struct initcall >>>
Re: Compilation fails on OS-X
Hi Patrick, On Thu, Feb 14, 2019 at 09:12:18AM -0500, Patrick Hemmer wrote: > > > On 2019/2/14 08:20, Frederic Lecaille wrote: > > On 2/14/19 1:32 PM, Frederic Lecaille wrote: > >> On 2/13/19 7:30 PM, Patrick Hemmer wrote: > >>> > >>> > >>> On 2019/2/13 10:29, Olivier Houchard wrote: > Hi Patrick, > > On Wed, Feb 13, 2019 at 10:01:01AM -0500, Patrick Hemmer wrote: > > On 2019/2/13 09:40, Aleksandar Lazic wrote: > >> Am 13.02.2019 um 14:45 schrieb Patrick Hemmer: > >>> Trying to compile haproxy on my local machine for testing > >>> purposes and am > >>> running into the following: > >> Which compiler do you use? > > # gcc -v > > Configured with: > > --prefix=/Applications/Xcode.app/Contents/Developer/usr > > --with-gxx-include-dir=/usr/include/c++/4.2.1 > > Apple LLVM version 9.0.0 (clang-900.0.39.2) > > Target: x86_64-apple-darwin17.7.0 > > Thread model: posix > > InstalledDir: > > /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin > > > > > >>> # make TARGET=osx > >>> src/proto_http.c:293:1: error: argument to 'section' > >>> attribute is not > >>> valid for this target: mach-o section specifier requires a > >>> segment and section > >>> separated by a comma > >>> DECLARE_POOL(pool_head_http_txn, "http_txn", > >>> sizeof(struct http_txn)); > >>> ^ > >>> include/common/memory.h:128:2: note: expanded from > >>> macro 'DECLARE_POOL' > >>> REGISTER_POOL(, name, size) > >>> ^ > >>> include/common/memory.h:123:2: note: expanded from > >>> macro 'REGISTER_POOL' > >>> INITCALL3(STG_POOL, > >>> create_pool_callback, (ptr), (name), > >>> (size)) > >>> ^ > >>> include/common/initcall.h:102:2: note: expanded from > >>> macro 'INITCALL3' > >>> _DECLARE_INITCALL(stage, __LINE__, > >>> function, arg1, arg2, > >>> arg3) > >>> ^ > >>> include/common/initcall.h:78:2: note: expanded from macro > >>> '_DECLARE_INITCALL' > >>> __DECLARE_INITCALL(__VA_ARGS__) > >>> ^ > >>> include/common/initcall.h:65:42: note: expanded from macro > >>> '__DECLARE_INITCALL' > >>> __attribute__((__used__,__section__("init_"#stg))) = \ > >>> > >>> > >>> > >>> Issue occurs on master, and the 1.9 branch > >>> > >>> -Patrick > Does the (totally untested, because I have no Mac to test) patch > works for > you ? > >>> > >>> Unfortunately not. Just introduces a lot of new errors: > >>> > >>> > >>> In file included from src/ev_poll.c:22: > >>> In file included from include/common/hathreads.h:26: > >>> include/common/initcall.h:134:22: error: expected ')' > >>> DECLARE_INIT_SECTION(STG_PREPARE); > >>> ^ > >>> include/common/initcall.h:134:1: note: to match this '(' > >>> DECLARE_INIT_SECTION(STG_PREPARE); > >>> ^ > >>> include/common/initcall.h:124:82: note: expanded from macro > >>> 'DECLARE_INIT_SECTION' > >>> extern __attribute__((__weak__)) const struct > >>> initcall *__start_init_##stg __asm("section$start$__DATA$" stg); \ > >>> ^ > >> > >> Try to use -E in place of -c option of your compiler to stop after > >> having preprocessed the code. Then have a look to how the code of > >> src/ev_poll.c was preprocessed. > >> > >> This should help. > >> > >> Fred. > > > > As this sounds to be a preprocessing issue, and to have a look to how > > the code is preprocessed for Apple we can invert the two #ifdef > > __APPLE__ condition of Olivier's patch to use the same preprocessor > > commands on a Linux system. > > > > > > Here is the code after having preprocessed it: > > > > > > # 134 "include/common/initcall.h" > > extern __attribute__((__weak__)) const struct initcall > > *__start_init_STG_PREPARE __asm("section$start$__DATA$" STG_PREPARE); > > extern __attribute__((__weak__)) const struct initcall > > *__stop_init_STG_PREPARE __asm("section$end$__DATA$" STG_PREPARE); > > extern __attribute__((__weak__)) const struct initcall > > *__start_init_STG_LOCK __asm("section$start$__DATA$" STG_LOCK); extern > > __attribute__((__weak__)) const struct initcall *__stop_init_STG_LOCK > > __asm("section$end$__DATA$" STG_LOCK); > > extern __attribute__((__weak__)) const struct initcall > > *__start_init_STG_ALLOC __asm("section$start$__DATA$" STG_ALLOC); > > extern __attribute__((__weak__)) const struct initcall > > *__stop_init_STG_ALLOC __asm("section$end$__DATA$" STG_ALLOC); > > extern __attribute__((__weak__)) const struct initcall > > *__start_init_STG_POOL
Re: Compilation fails on OS-X
Looks like apples llvm is not based on master branch. https://news.ycombinator.com/item?id=16545037 Ursprüngliche Nachricht Von: Frederic Lecaille Gesendet: 14. Februar 2019 16:13:01 MEZ An: Patrick Hemmer CC: Olivier Houchard , Aleksandar Lazic , haproxy@formilux.org Betreff: Re: Compilation fails on OS-X On 2/14/19 3:12 PM, Patrick Hemmer wrote: > > > On 2019/2/14 08:20, Frederic Lecaille wrote: >> On 2/14/19 1:32 PM, Frederic Lecaille wrote: >>> On 2/13/19 7:30 PM, Patrick Hemmer wrote: >>>> >>>> >>>> On 2019/2/13 10:29, Olivier Houchard wrote: >>>>> Hi Patrick, >>>>> >>>>> On Wed, Feb 13, 2019 at 10:01:01AM -0500, Patrick Hemmer wrote: >>>>>> On 2019/2/13 09:40, Aleksandar Lazic wrote: >>>>>>> Am 13.02.2019 um 14:45 schrieb Patrick Hemmer: >>>>>>>> Trying to compile haproxy on my local machine for testing >>>>>>>> purposes and am >>>>>>>> running into the following: >>>>>>> Which compiler do you use? >>>>>> # gcc -v >>>>>> Configured with: >>>>>> --prefix=/Applications/Xcode.app/Contents/Developer/usr >>>>>> --with-gxx-include-dir=/usr/include/c++/4.2.1 >>>>>> Apple LLVM version 9.0.0 (clang-900.0.39.2) >>>>>> Target: x86_64-apple-darwin17.7.0 >>>>>> Thread model: posix >>>>>> InstalledDir: >>>>>> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin >>>>>> >>>>>> >>>>>> >>>>>>>> # make TARGET=osx >>>>>>>> src/proto_http.c:293:1: error: argument to 'section' >>>>>>>> attribute is not >>>>>>>> valid for this target: mach-o section specifier requires a >>>>>>>> segment and section >>>>>>>> separated by a comma >>>>>>>> DECLARE_POOL(pool_head_http_txn, "http_txn", >>>>>>>> sizeof(struct http_txn)); >>>>>>>> ^ >>>>>>>> include/common/memory.h:128:2: note: expanded from >>>>>>>> macro 'DECLARE_POOL' >>>>>>>> REGISTER_POOL(, name, size) >>>>>>>> ^ >>>>>>>> include/common/memory.h:123:2: note: expanded from >>>>>>>> macro 'REGISTER_POOL' >>>>>>>> INITCALL3(STG_POOL, >>>>>>>> create_pool_callback, (ptr), (name), >>>>>>>> (size)) >>>>>>>> ^ >>>>>>>> include/common/initcall.h:102:2: note: expanded from >>>>>>>> macro 'INITCALL3' >>>>>>>> _DECLARE_INITCALL(stage, __LINE__, >>>>>>>> function, arg1, arg2, >>>>>>>> arg3) >>>>>>>> ^ >>>>>>>> include/common/initcall.h:78:2: note: expanded from macro >>>>>>>> '_DECLARE_INITCALL' >>>>>>>> __DECLARE_INITCALL(__VA_ARGS__) >>>>>>>> ^ >>>>>>>> include/common/initcall.h:65:42: note: expanded from macro >>>>>>>> '__DECLARE_INITCALL' >>>>>>>> __attribute__((__used__,__section__("init_"#stg))) = \ >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> Issue occurs on master, and the 1.9 branch >>>>>>>> >>>>>>>> -Patrick >>>>> Does the (totally untested, because I have no Mac to test) patch >>>>> works for >>>>> you ? >>>> >>>> Unfortunately not. Just introduces a lot of new errors: >>>> >>>> >>>> In file included from src/ev_poll.c:22: >>>> In file included from include/common/hathreads.h:26: >>>> include/common/initcall.h:134:22: error: expected ')' >>>> DECLARE_INIT_SECTION(STG_PREPARE); >>>> ^ >>>> include/common/initcall.h:134:1: note: to match th
Re: Compilation fails on OS-X
On 2/14/19 3:12 PM, Patrick Hemmer wrote: On 2019/2/14 08:20, Frederic Lecaille wrote: On 2/14/19 1:32 PM, Frederic Lecaille wrote: On 2/13/19 7:30 PM, Patrick Hemmer wrote: On 2019/2/13 10:29, Olivier Houchard wrote: Hi Patrick, On Wed, Feb 13, 2019 at 10:01:01AM -0500, Patrick Hemmer wrote: On 2019/2/13 09:40, Aleksandar Lazic wrote: Am 13.02.2019 um 14:45 schrieb Patrick Hemmer: Trying to compile haproxy on my local machine for testing purposes and am running into the following: Which compiler do you use? # gcc -v Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1 Apple LLVM version 9.0.0 (clang-900.0.39.2) Target: x86_64-apple-darwin17.7.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin # make TARGET=osx src/proto_http.c:293:1: error: argument to 'section' attribute is not valid for this target: mach-o section specifier requires a segment and section separated by a comma DECLARE_POOL(pool_head_http_txn, "http_txn", sizeof(struct http_txn)); ^ include/common/memory.h:128:2: note: expanded from macro 'DECLARE_POOL' REGISTER_POOL(, name, size) ^ include/common/memory.h:123:2: note: expanded from macro 'REGISTER_POOL' INITCALL3(STG_POOL, create_pool_callback, (ptr), (name), (size)) ^ include/common/initcall.h:102:2: note: expanded from macro 'INITCALL3' _DECLARE_INITCALL(stage, __LINE__, function, arg1, arg2, arg3) ^ include/common/initcall.h:78:2: note: expanded from macro '_DECLARE_INITCALL' __DECLARE_INITCALL(__VA_ARGS__) ^ include/common/initcall.h:65:42: note: expanded from macro '__DECLARE_INITCALL' __attribute__((__used__,__section__("init_"#stg))) = \ Issue occurs on master, and the 1.9 branch -Patrick Does the (totally untested, because I have no Mac to test) patch works for you ? Unfortunately not. Just introduces a lot of new errors: In file included from src/ev_poll.c:22: In file included from include/common/hathreads.h:26: include/common/initcall.h:134:22: error: expected ')' DECLARE_INIT_SECTION(STG_PREPARE); ^ include/common/initcall.h:134:1: note: to match this '(' DECLARE_INIT_SECTION(STG_PREPARE); ^ include/common/initcall.h:124:82: note: expanded from macro 'DECLARE_INIT_SECTION' extern __attribute__((__weak__)) const struct initcall *__start_init_##stg __asm("section$start$__DATA$" stg); \ ^ Try to use -E in place of -c option of your compiler to stop after having preprocessed the code. Then have a look to how the code of src/ev_poll.c was preprocessed. This should help. Fred. As this sounds to be a preprocessing issue, and to have a look to how the code is preprocessed for Apple we can invert the two #ifdef __APPLE__ condition of Olivier's patch to use the same preprocessor commands on a Linux system. Here is the code after having preprocessed it: # 134 "include/common/initcall.h" extern __attribute__((__weak__)) const struct initcall *__start_init_STG_PREPARE __asm("section$start$__DATA$" STG_PREPARE); extern __attribute__((__weak__)) const struct initcall *__stop_init_STG_PREPARE __asm("section$end$__DATA$" STG_PREPARE); extern __attribute__((__weak__)) const struct initcall *__start_init_STG_LOCK __asm("section$start$__DATA$" STG_LOCK); extern __attribute__((__weak__)) const struct initcall *__stop_init_STG_LOCK __asm("section$end$__DATA$" STG_LOCK); extern __attribute__((__weak__)) const struct initcall *__start_init_STG_ALLOC __asm("section$start$__DATA$" STG_ALLOC); extern __attribute__((__weak__)) const struct initcall *__stop_init_STG_ALLOC __asm("section$end$__DATA$" STG_ALLOC); extern __attribute__((__weak__)) const struct initcall *__start_init_STG_POOL __asm("section$start$__DATA$" STG_POOL); extern __attribute__((__weak__)) const struct initcall *__stop_init_STG_POOL __asm("section$end$__DATA$" STG_POOL); extern __attribute__((__weak__)) const struct initcall *__start_init_STG_REGISTER __asm("section$start$__DATA$" STG_REGISTER); extern __attribute__((__weak__)) const struct initcall *__stop_init_STG_REGISTER __asm("section$end$__DATA$" STG_REGISTER); extern __attribute__((__weak__)) const struct initcall *__start_init_STG_INIT __asm("section$start$__DATA$" STG_INIT); extern __attribute__((__weak__)) const struct initcall *__stop_init_STG_INIT __asm("section$end$__DATA$" STG_INIT); should be I guess extern __attribute__((__weak__)) const struct initcall *__start_init_STG_PREPARE __asm("section$start$__DATA$STG_PREPARE"); etc. and the compiler warns like
Re: Compilation fails on OS-X
On 2019/2/14 08:20, Frederic Lecaille wrote: > On 2/14/19 1:32 PM, Frederic Lecaille wrote: >> On 2/13/19 7:30 PM, Patrick Hemmer wrote: >>> >>> >>> On 2019/2/13 10:29, Olivier Houchard wrote: Hi Patrick, On Wed, Feb 13, 2019 at 10:01:01AM -0500, Patrick Hemmer wrote: > On 2019/2/13 09:40, Aleksandar Lazic wrote: >> Am 13.02.2019 um 14:45 schrieb Patrick Hemmer: >>> Trying to compile haproxy on my local machine for testing >>> purposes and am >>> running into the following: >> Which compiler do you use? > # gcc -v > Configured with: > --prefix=/Applications/Xcode.app/Contents/Developer/usr > --with-gxx-include-dir=/usr/include/c++/4.2.1 > Apple LLVM version 9.0.0 (clang-900.0.39.2) > Target: x86_64-apple-darwin17.7.0 > Thread model: posix > InstalledDir: > /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin > > >>> # make TARGET=osx >>> src/proto_http.c:293:1: error: argument to 'section' >>> attribute is not >>> valid for this target: mach-o section specifier requires a >>> segment and section >>> separated by a comma >>> DECLARE_POOL(pool_head_http_txn, "http_txn", >>> sizeof(struct http_txn)); >>> ^ >>> include/common/memory.h:128:2: note: expanded from >>> macro 'DECLARE_POOL' >>> REGISTER_POOL(, name, size) >>> ^ >>> include/common/memory.h:123:2: note: expanded from >>> macro 'REGISTER_POOL' >>> INITCALL3(STG_POOL, >>> create_pool_callback, (ptr), (name), >>> (size)) >>> ^ >>> include/common/initcall.h:102:2: note: expanded from >>> macro 'INITCALL3' >>> _DECLARE_INITCALL(stage, __LINE__, >>> function, arg1, arg2, >>> arg3) >>> ^ >>> include/common/initcall.h:78:2: note: expanded from macro >>> '_DECLARE_INITCALL' >>> __DECLARE_INITCALL(__VA_ARGS__) >>> ^ >>> include/common/initcall.h:65:42: note: expanded from macro >>> '__DECLARE_INITCALL' >>> __attribute__((__used__,__section__("init_"#stg))) = \ >>> >>> >>> >>> Issue occurs on master, and the 1.9 branch >>> >>> -Patrick Does the (totally untested, because I have no Mac to test) patch works for you ? >>> >>> Unfortunately not. Just introduces a lot of new errors: >>> >>> >>> In file included from src/ev_poll.c:22: >>> In file included from include/common/hathreads.h:26: >>> include/common/initcall.h:134:22: error: expected ')' >>> DECLARE_INIT_SECTION(STG_PREPARE); >>> ^ >>> include/common/initcall.h:134:1: note: to match this '(' >>> DECLARE_INIT_SECTION(STG_PREPARE); >>> ^ >>> include/common/initcall.h:124:82: note: expanded from macro >>> 'DECLARE_INIT_SECTION' >>> extern __attribute__((__weak__)) const struct >>> initcall *__start_init_##stg __asm("section$start$__DATA$" stg); \ >>> ^ >> >> Try to use -E in place of -c option of your compiler to stop after >> having preprocessed the code. Then have a look to how the code of >> src/ev_poll.c was preprocessed. >> >> This should help. >> >> Fred. > > As this sounds to be a preprocessing issue, and to have a look to how > the code is preprocessed for Apple we can invert the two #ifdef > __APPLE__ condition of Olivier's patch to use the same preprocessor > commands on a Linux system. > > > Here is the code after having preprocessed it: > > > # 134 "include/common/initcall.h" > extern __attribute__((__weak__)) const struct initcall > *__start_init_STG_PREPARE __asm("section$start$__DATA$" STG_PREPARE); > extern __attribute__((__weak__)) const struct initcall > *__stop_init_STG_PREPARE __asm("section$end$__DATA$" STG_PREPARE); > extern __attribute__((__weak__)) const struct initcall > *__start_init_STG_LOCK __asm("section$start$__DATA$" STG_LOCK); extern > __attribute__((__weak__)) const struct initcall *__stop_init_STG_LOCK > __asm("section$end$__DATA$" STG_LOCK); > extern __attribute__((__weak__)) const struct initcall > *__start_init_STG_ALLOC __asm("section$start$__DATA$" STG_ALLOC); > extern __attribute__((__weak__)) const struct initcall > *__stop_init_STG_ALLOC __asm("section$end$__DATA$" STG_ALLOC); > extern __attribute__((__weak__)) const struct initcall > *__start_init_STG_POOL __asm("section$start$__DATA$" STG_POOL); extern > __attribute__((__weak__)) const struct initcall *__stop_init_STG_POOL > __asm("section$end$__DATA$" STG_POOL); > extern __attribute__((__weak__)) const struct initcall > *__start_init_STG_REGISTER __asm("section$start$__DATA$" > STG_REGISTER); extern __attribute__((__weak__))
Re: Compilation fails on OS-X
On 2/14/19 1:32 PM, Frederic Lecaille wrote: On 2/13/19 7:30 PM, Patrick Hemmer wrote: On 2019/2/13 10:29, Olivier Houchard wrote: Hi Patrick, On Wed, Feb 13, 2019 at 10:01:01AM -0500, Patrick Hemmer wrote: On 2019/2/13 09:40, Aleksandar Lazic wrote: Am 13.02.2019 um 14:45 schrieb Patrick Hemmer: Trying to compile haproxy on my local machine for testing purposes and am running into the following: Which compiler do you use? # gcc -v Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1 Apple LLVM version 9.0.0 (clang-900.0.39.2) Target: x86_64-apple-darwin17.7.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin # make TARGET=osx src/proto_http.c:293:1: error: argument to 'section' attribute is not valid for this target: mach-o section specifier requires a segment and section separated by a comma DECLARE_POOL(pool_head_http_txn, "http_txn", sizeof(struct http_txn)); ^ include/common/memory.h:128:2: note: expanded from macro 'DECLARE_POOL' REGISTER_POOL(, name, size) ^ include/common/memory.h:123:2: note: expanded from macro 'REGISTER_POOL' INITCALL3(STG_POOL, create_pool_callback, (ptr), (name), (size)) ^ include/common/initcall.h:102:2: note: expanded from macro 'INITCALL3' _DECLARE_INITCALL(stage, __LINE__, function, arg1, arg2, arg3) ^ include/common/initcall.h:78:2: note: expanded from macro '_DECLARE_INITCALL' __DECLARE_INITCALL(__VA_ARGS__) ^ include/common/initcall.h:65:42: note: expanded from macro '__DECLARE_INITCALL' __attribute__((__used__,__section__("init_"#stg))) = \ Issue occurs on master, and the 1.9 branch -Patrick Does the (totally untested, because I have no Mac to test) patch works for you ? Unfortunately not. Just introduces a lot of new errors: In file included from src/ev_poll.c:22: In file included from include/common/hathreads.h:26: include/common/initcall.h:134:22: error: expected ')' DECLARE_INIT_SECTION(STG_PREPARE); ^ include/common/initcall.h:134:1: note: to match this '(' DECLARE_INIT_SECTION(STG_PREPARE); ^ include/common/initcall.h:124:82: note: expanded from macro 'DECLARE_INIT_SECTION' extern __attribute__((__weak__)) const struct initcall *__start_init_##stg __asm("section$start$__DATA$" stg); \ ^ Try to use -E in place of -c option of your compiler to stop after having preprocessed the code. Then have a look to how the code of src/ev_poll.c was preprocessed. This should help. Fred. As this sounds to be a preprocessing issue, and to have a look to how the code is preprocessed for Apple we can invert the two #ifdef __APPLE__ condition of Olivier's patch to use the same preprocessor commands on a Linux system. Here is the code after having preprocessed it: # 134 "include/common/initcall.h" extern __attribute__((__weak__)) const struct initcall *__start_init_STG_PREPARE __asm("section$start$__DATA$" STG_PREPARE); extern __attribute__((__weak__)) const struct initcall *__stop_init_STG_PREPARE __asm("section$end$__DATA$" STG_PREPARE); extern __attribute__((__weak__)) const struct initcall *__start_init_STG_LOCK __asm("section$start$__DATA$" STG_LOCK); extern __attribute__((__weak__)) const struct initcall *__stop_init_STG_LOCK __asm("section$end$__DATA$" STG_LOCK); extern __attribute__((__weak__)) const struct initcall *__start_init_STG_ALLOC __asm("section$start$__DATA$" STG_ALLOC); extern __attribute__((__weak__)) const struct initcall *__stop_init_STG_ALLOC __asm("section$end$__DATA$" STG_ALLOC); extern __attribute__((__weak__)) const struct initcall *__start_init_STG_POOL __asm("section$start$__DATA$" STG_POOL); extern __attribute__((__weak__)) const struct initcall *__stop_init_STG_POOL __asm("section$end$__DATA$" STG_POOL); extern __attribute__((__weak__)) const struct initcall *__start_init_STG_REGISTER __asm("section$start$__DATA$" STG_REGISTER); extern __attribute__((__weak__)) const struct initcall *__stop_init_STG_REGISTER __asm("section$end$__DATA$" STG_REGISTER); extern __attribute__((__weak__)) const struct initcall *__start_init_STG_INIT __asm("section$start$__DATA$" STG_INIT); extern __attribute__((__weak__)) const struct initcall *__stop_init_STG_INIT __asm("section$end$__DATA$" STG_INIT); should be I guess extern __attribute__((__weak__)) const struct initcall *__start_init_STG_PREPARE __asm("section$start$__DATA$STG_PREPARE"); etc. and the compiler warns like this: $ gcc -Iinclude -Iebtree -Wall -Wextra -O2 -g
Re: Compilation fails on OS-X
On 2/13/19 7:30 PM, Patrick Hemmer wrote: On 2019/2/13 10:29, Olivier Houchard wrote: Hi Patrick, On Wed, Feb 13, 2019 at 10:01:01AM -0500, Patrick Hemmer wrote: On 2019/2/13 09:40, Aleksandar Lazic wrote: Am 13.02.2019 um 14:45 schrieb Patrick Hemmer: Trying to compile haproxy on my local machine for testing purposes and am running into the following: Which compiler do you use? # gcc -v Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1 Apple LLVM version 9.0.0 (clang-900.0.39.2) Target: x86_64-apple-darwin17.7.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin # make TARGET=osx src/proto_http.c:293:1: error: argument to 'section' attribute is not valid for this target: mach-o section specifier requires a segment and section separated by a comma DECLARE_POOL(pool_head_http_txn, "http_txn", sizeof(struct http_txn)); ^ include/common/memory.h:128:2: note: expanded from macro 'DECLARE_POOL' REGISTER_POOL(, name, size) ^ include/common/memory.h:123:2: note: expanded from macro 'REGISTER_POOL' INITCALL3(STG_POOL, create_pool_callback, (ptr), (name), (size)) ^ include/common/initcall.h:102:2: note: expanded from macro 'INITCALL3' _DECLARE_INITCALL(stage, __LINE__, function, arg1, arg2, arg3) ^ include/common/initcall.h:78:2: note: expanded from macro '_DECLARE_INITCALL' __DECLARE_INITCALL(__VA_ARGS__) ^ include/common/initcall.h:65:42: note: expanded from macro '__DECLARE_INITCALL' __attribute__((__used__,__section__("init_"#stg))) = \ Issue occurs on master, and the 1.9 branch -Patrick Does the (totally untested, because I have no Mac to test) patch works for you ? Unfortunately not. Just introduces a lot of new errors: In file included from src/ev_poll.c:22: In file included from include/common/hathreads.h:26: include/common/initcall.h:134:22: error: expected ')' DECLARE_INIT_SECTION(STG_PREPARE); ^ include/common/initcall.h:134:1: note: to match this '(' DECLARE_INIT_SECTION(STG_PREPARE); ^ include/common/initcall.h:124:82: note: expanded from macro 'DECLARE_INIT_SECTION' extern __attribute__((__weak__)) const struct initcall *__start_init_##stg __asm("section$start$__DATA$" stg); \ ^ Try to use -E in place of -c option of your compiler to stop after having preprocessed the code. Then have a look to how the code of src/ev_poll.c was preprocessed. This should help. Fred.
Re: Compilation fails on OS-X
On 2019/2/13 10:29, Olivier Houchard wrote: > Hi Patrick, > > On Wed, Feb 13, 2019 at 10:01:01AM -0500, Patrick Hemmer wrote: >> >> On 2019/2/13 09:40, Aleksandar Lazic wrote: >>> Am 13.02.2019 um 14:45 schrieb Patrick Hemmer: Trying to compile haproxy on my local machine for testing purposes and am running into the following: >>> Which compiler do you use? >> # gcc -v >> Configured with: >> --prefix=/Applications/Xcode.app/Contents/Developer/usr >> --with-gxx-include-dir=/usr/include/c++/4.2.1 >> Apple LLVM version 9.0.0 (clang-900.0.39.2) >> Target: x86_64-apple-darwin17.7.0 >> Thread model: posix >> InstalledDir: >> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin >> # make TARGET=osx src/proto_http.c:293:1: error: argument to 'section' attribute is not valid for this target: mach-o section specifier requires a segment and section separated by a comma DECLARE_POOL(pool_head_http_txn, "http_txn", sizeof(struct http_txn)); ^ include/common/memory.h:128:2: note: expanded from macro 'DECLARE_POOL' REGISTER_POOL(, name, size) ^ include/common/memory.h:123:2: note: expanded from macro 'REGISTER_POOL' INITCALL3(STG_POOL, create_pool_callback, (ptr), (name), (size)) ^ include/common/initcall.h:102:2: note: expanded from macro 'INITCALL3' _DECLARE_INITCALL(stage, __LINE__, function, arg1, arg2, arg3) ^ include/common/initcall.h:78:2: note: expanded from macro '_DECLARE_INITCALL' __DECLARE_INITCALL(__VA_ARGS__) ^ include/common/initcall.h:65:42: note: expanded from macro '__DECLARE_INITCALL' __attribute__((__used__,__section__("init_"#stg))) = \ Issue occurs on master, and the 1.9 branch -Patrick > Does the (totally untested, because I have no Mac to test) patch works for > you ? Unfortunately not. Just introduces a lot of new errors: In file included from src/ev_poll.c:22: In file included from include/common/hathreads.h:26: include/common/initcall.h:134:22: error: expected ')' DECLARE_INIT_SECTION(STG_PREPARE); ^ include/common/initcall.h:134:1: note: to match this '(' DECLARE_INIT_SECTION(STG_PREPARE); ^ include/common/initcall.h:124:82: note: expanded from macro 'DECLARE_INIT_SECTION' extern __attribute__((__weak__)) const struct initcall *__start_init_##stg __asm("section$start$__DATA$" stg); \ ^ -Patrick
Re: Compilation fails on OS-X
Olivier, Am 13.02.19 um 16:29 schrieb Olivier Houchard: > Does the (totally untested, because I have no Mac to test) patch works for > you ? > Note: This was also reported in the bug tracker. Can you add a "see issue #42" to the message of the final patch? see: https://github.com/haproxy/haproxy/issues/42 Best regards Tim Düsterhus
Re: Compilation fails on OS-X
Hi Patrick, On Wed, Feb 13, 2019 at 10:01:01AM -0500, Patrick Hemmer wrote: > > > On 2019/2/13 09:40, Aleksandar Lazic wrote: > > Am 13.02.2019 um 14:45 schrieb Patrick Hemmer: > >> Trying to compile haproxy on my local machine for testing purposes and am > >> running into the following: > > Which compiler do you use? > > # gcc -v > Configured with: > --prefix=/Applications/Xcode.app/Contents/Developer/usr > --with-gxx-include-dir=/usr/include/c++/4.2.1 > Apple LLVM version 9.0.0 (clang-900.0.39.2) > Target: x86_64-apple-darwin17.7.0 > Thread model: posix > InstalledDir: > /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin > > >> # make TARGET=osx > >> src/proto_http.c:293:1: error: argument to 'section' attribute is > >> not > >> valid for this target: mach-o section specifier requires a segment and > >> section > >> separated by a comma > >> DECLARE_POOL(pool_head_http_txn, "http_txn", sizeof(struct > >> http_txn)); > >> ^ > >> include/common/memory.h:128:2: note: expanded from macro > >> 'DECLARE_POOL' > >> REGISTER_POOL(, name, size) > >> ^ > >> include/common/memory.h:123:2: note: expanded from macro > >> 'REGISTER_POOL' > >> INITCALL3(STG_POOL, create_pool_callback, (ptr), > >> (name), > >> (size)) > >> ^ > >> include/common/initcall.h:102:2: note: expanded from macro > >> 'INITCALL3' > >> _DECLARE_INITCALL(stage, __LINE__, function, arg1, > >> arg2, > >> arg3) > >> ^ > >> include/common/initcall.h:78:2: note: expanded from macro > >> '_DECLARE_INITCALL' > >> __DECLARE_INITCALL(__VA_ARGS__) > >> ^ > >> include/common/initcall.h:65:42: note: expanded from macro > >> '__DECLARE_INITCALL' > >> > >> __attribute__((__used__,__section__("init_"#stg))) = \ > >> > >> > >> > >> Issue occurs on master, and the 1.9 branch > >> > >> -Patrick > Does the (totally untested, because I have no Mac to test) patch works for you ? Thanks ! Olivier >From 2f68108ae32a66782b4c7518f8830896732be64d Mon Sep 17 00:00:00 2001 From: Olivier Houchard Date: Wed, 13 Feb 2019 16:22:17 +0100 Subject: [PATCH] BUILD/MEDIUM: initcall: Fix build on MacOS. MacOS syntax for sections is a bit different, so implement it. This should be backported to 1.9. --- include/common/initcall.h | 15 ++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/include/common/initcall.h b/include/common/initcall.h index 35d237fd..95e488ba 100644 --- a/include/common/initcall.h +++ b/include/common/initcall.h @@ -50,6 +50,12 @@ struct initcall { void *arg3; }; +#ifdef __APPLE__ +#define HA_SECTION(s) __section__("__DATA, " s) +#else +#define HA_SECTION(s) __section__((s)) +#endif + /* Declare a static variable in the init section dedicated to stage , * with an element referencing function and arguments . * is needed to deduplicate entries created from a same file. The @@ -62,7 +68,7 @@ struct initcall { */ #define __DECLARE_INITCALL(stg, linenum, function, a1, a2, a3) \ static const struct initcall *__initcb_##linenum \ - __attribute__((__used__,__section__("init_"#stg))) = \ + __attribute__((__used__,HA_SECTION("init_"#stg))) =\ (stg < STG_SIZE) ? &(const struct initcall) { \ .fct = (void (*)(void *,void *,void *))function, \ .arg1 = (void *)(a1), \ @@ -113,9 +119,16 @@ struct initcall { * empty. The corresponding sections must contain exclusively pointers to * make sure each location may safely be visited by incrementing a pointer. */ +#ifdef __APPLE__ +#define DECLARE_INIT_SECTION(stg) \ + extern __attribute__((__weak__)) const struct initcall *__start_init_##stg __asm("section$start$__DATA$" stg); \ + extern __attribute__((__weak__)) const struct initcall *__stop_init_##stg __asm("section$end$__DATA$" stg) + +#else #define DECLARE_INIT_SECTION(stg) \ extern __attribute__((__weak__)) const struct initcall *__start_init_##stg; \ extern __attribute__((__weak__)) const struct initcall *__stop_init_##stg +#endif /* Declare all initcall sections here */ DECLARE_INIT_SECTION(STG_PREPARE); -- 2.20.1
Re: Compilation fails on OS-X
On 2019/2/13 09:40, Aleksandar Lazic wrote: > Am 13.02.2019 um 14:45 schrieb Patrick Hemmer: >> Trying to compile haproxy on my local machine for testing purposes and am >> running into the following: > Which compiler do you use? # gcc -v Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1 Apple LLVM version 9.0.0 (clang-900.0.39.2) Target: x86_64-apple-darwin17.7.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin >> # make TARGET=osx >> src/proto_http.c:293:1: error: argument to 'section' attribute is not >> valid for this target: mach-o section specifier requires a segment and >> section >> separated by a comma >> DECLARE_POOL(pool_head_http_txn, "http_txn", sizeof(struct >> http_txn)); >> ^ >> include/common/memory.h:128:2: note: expanded from macro >> 'DECLARE_POOL' >> REGISTER_POOL(, name, size) >> ^ >> include/common/memory.h:123:2: note: expanded from macro >> 'REGISTER_POOL' >> INITCALL3(STG_POOL, create_pool_callback, (ptr), >> (name), >> (size)) >> ^ >> include/common/initcall.h:102:2: note: expanded from macro >> 'INITCALL3' >> _DECLARE_INITCALL(stage, __LINE__, function, arg1, >> arg2, >> arg3) >> ^ >> include/common/initcall.h:78:2: note: expanded from macro >> '_DECLARE_INITCALL' >> __DECLARE_INITCALL(__VA_ARGS__) >> ^ >> include/common/initcall.h:65:42: note: expanded from macro >> '__DECLARE_INITCALL' >> >> __attribute__((__used__,__section__("init_"#stg))) = \ >> >> >> >> Issue occurs on master, and the 1.9 branch >> >> -Patrick
Re: Compilation fails on OS-X
Am 13.02.2019 um 14:45 schrieb Patrick Hemmer: > Trying to compile haproxy on my local machine for testing purposes and am > running into the following: Which compiler do you use? > # make TARGET=osx > src/proto_http.c:293:1: error: argument to 'section' attribute is not > valid for this target: mach-o section specifier requires a segment and section > separated by a comma > DECLARE_POOL(pool_head_http_txn, "http_txn", sizeof(struct http_txn)); > ^ > include/common/memory.h:128:2: note: expanded from macro > 'DECLARE_POOL' > REGISTER_POOL(, name, size) > ^ > include/common/memory.h:123:2: note: expanded from macro > 'REGISTER_POOL' > INITCALL3(STG_POOL, create_pool_callback, (ptr), > (name), > (size)) > ^ > include/common/initcall.h:102:2: note: expanded from macro 'INITCALL3' > _DECLARE_INITCALL(stage, __LINE__, function, arg1, > arg2, > arg3) > ^ > include/common/initcall.h:78:2: note: expanded from macro > '_DECLARE_INITCALL' > __DECLARE_INITCALL(__VA_ARGS__) > ^ > include/common/initcall.h:65:42: note: expanded from macro > '__DECLARE_INITCALL' > > __attribute__((__used__,__section__("init_"#stg))) = \ > > > > Issue occurs on master, and the 1.9 branch > > -Patrick
Compilation fails on OS-X
Trying to compile haproxy on my local machine for testing purposes and am running into the following: # make TARGET=osx src/proto_http.c:293:1: error: argument to 'section' attribute is not valid for this target: mach-o section specifier requires a segment and section separated by a comma DECLARE_POOL(pool_head_http_txn, "http_txn", sizeof(struct http_txn)); ^ include/common/memory.h:128:2: note: expanded from macro 'DECLARE_POOL' REGISTER_POOL(, name, size) ^ include/common/memory.h:123:2: note: expanded from macro 'REGISTER_POOL' INITCALL3(STG_POOL, create_pool_callback, (ptr), (name), (size)) ^ include/common/initcall.h:102:2: note: expanded from macro 'INITCALL3' _DECLARE_INITCALL(stage, __LINE__, function, arg1, arg2, arg3) ^ include/common/initcall.h:78:2: note: expanded from macro '_DECLARE_INITCALL' __DECLARE_INITCALL(__VA_ARGS__) ^ include/common/initcall.h:65:42: note: expanded from macro '__DECLARE_INITCALL' __attribute__((__used__,__section__("init_"#stg))) = \ Issue occurs on master, and the 1.9 branch -Patrick